parsing

XML fetching and parsing solution/library that works with Ruby 1.9.1 on Rails 3

Does anyone know of a library that works with Ruby 1.9.1 on Rails 3 yet? Thanks, Nick ...

T-SQL: Parsing String with Multiple delimiters.

I need to be able to query a SharePoint database for survey results. The type of data I'm having problems with is a "Rating Scale" value. So the data in each table column represents a whole group of sub-questions and their answers. So the following is an example of what is found in ONE column: 1. Our function has defined how Availa...

Ruby parse string

I have a string input = "maybe (this is | that was) some ((nice | ugly) (day |night) | (strange (weather | time)))" How is the best method in Ruby to parse this string ? I mean the script should be able to build sententes like this : maybe this is some ugly night maybe that was some nice night maybe this was some strang...

Read plain text from binary file with PHP

File 1: asdffdsa File 2: asdfjklfdsaHGUik How do I read these binary files with PHP such that I can populate an array with the plaintext like: $file1_output = ["asdf", "fdsa"]; $file2_output = ["asdfjkl", "fdsaHGUik"]; ...

How can I create a parser combinator in which line endings are significant?

I am creating a DSL, and using Scala's parser combinator library to parse the DSL. The DSL follows a simple, Ruby-like syntax. A source file can contain a series of blocks that look like this: create_model do at 0,0,0 end Line endings are significant in the DSL, as they are effectively used as statement terminators. I wrote a Scala...

How to parse bit fields from a byte array in Java?

I've been given the arduous task of parsing some incoming UDP packets from a source into an appropriate Java representation. The kicker is the data held within the packets are not byte aligned. In an effort to make the protocol as tight as possible, there are a number of bit fields indicating the presence or absence of data fields. Fo...

Simple regex question to parse similar things in .NET?

Is there a way to gather all links that has a specific domain in a string where they only include ones that are either: href="http://yahoo.com/media/news.html" or >http://yahoo.com/media/news.html&lt; So basically links either prefixed by href=" and ends with " or links that are surrounded by ><. I tried to use Regex ( "href=\"(...

Simplest way to validate a GPS string in C++?

I have some MET data I want to validate which would look something like these: char validBuffer[] = {"N51374114W1160437"}; char invalidBuffer[] = {"bad data\n"}; char emptyBuffer[] = {""}; I've tried a simple sscanf, but that failed: int _tmain(int argc, _TCHAR* argv[]) { char validBuffer[] = {"N51374114W1160437"}; char inva...

How to get all input elements in a form with HtmlAgilityPack

Example HTML: <html><body> <form id="form1"> <input name="foo1" value="bar1" /> <!-- Other elements --> </form> <form id="form2"> <input name="foo2" value="bar2" /> <!-- Other elements --> </form> </body></html> Test code: HtmlDocument doc = new HtmlDocument(); doc.Load(@"D:\test.h...

Perl - Removing unwanted elements from an arrayref

I'm writing a script that parses the "pure-ftpwho -s" command to get a list of the current transfers. But when a user disconnects from the FTP and reconnects back and resumes a transfer, the file shows up twice. I want to remove the ghosted one with Perl. After parsing, here is what the arrayref looks like (dumped with Data::Dumper) $VA...

MSBuild 4.0 Regex parsing

I have heard that MSBuild 4.0 has increased Regex parsing support. However, I am unable to find any detailed documentation/links/material on this. Can anyone give a brief description of the new features and/or possibly give pointers to more material? Thanks in advance. ...

String to Numeric conversion and group separator

Hello everybody. When I try to convert a string to a numeric value with Parse or TryParse or Convert.ChangeType, I can't manage de thousand separator as it is defined in the system: if I enter : var d = double.Parse("1,234", CultureInfo.CurrentUICulture); it does not return 1234. If I want to use the group separator, I must type : ...

What is this JSON Variant?

{ members: [ [ { c1: [{fft: 5,v: '[email protected]'}], c2: [{fft: 9,v: 'tst'}], c3: [{sft: 1,v: 'Corporate Member'}]}, { c1: [{fft: 5,v: '[email protected]'}], c2: [{fft: 9,v: 'asd'}], c3: [{sft: 1,v: 'Company'}]} ...etc What is this JSON f...

How to write regex that searches for a dynamic amount of pairs?

Lets say a have a string such as this one: string txt = "Lore ipsum {{abc|prop1=\"asd\";prop2=\"bcd\";}} asd lore ipsum"; The information I want to extract "abc" and pairs like ("prop1","asd") , ("prop3", "bcd") where each pair used a ; as delimeter. Edit1: (based on MikeB's) code Ah, getting close. I found out how to parse the fol...

only parse a specific subtree of an XML file

I have a massive XML file. However, I'm only interested in a single small subtree of this massive tree. I want to parse this subtree, but I don't want to waste time parsing the entire massive tree when I'm going to only be using a small part of it. Ideally, I'd want to scan through the file until I find the start of this subtree, parse...

What's the easiest beginner book for learning parsing for writing a compiler?

It seems that parsing is a hard subject to learn. I was wondering what would be recommended as the very easiest books on the subject. The most basic, beginner, easiest books on parsing. Is there no parsing for dummies? ...

SimplePie not parsing flickr feed

I am trying to use SimplePie to pull a group pool flickr feed: $feed = new SimplePie(); $feed->set_feed_url('http://api.flickr.com/services/feeds/groups_pool.gne?id=25938750@N00&amp;lang=en-us&amp;format=rss_200'); $feed->init(); $feed->handle_content_type(); Then I use typical SimplePie php calls to loop through the feed items. How...

difference between top down and bottom up parsing techniques?

I guess the same logic is applied in both of them, i.e replacing the matched strings with the corresponding non-terminal elements as provided in the production rules. Why do they categorize LL as top down and LR as bottom-up? ...

android sdk main.out.xml parsing error?

I just started a new Android project, "WeekendStudy" to continue learning Android development and I got stumped compiling the default 'hello weekendstudy' compile / run. I think that I missed a step in configuration and setup, but I am at a loss to find out where. I have an AVD configured, set and launched. When I press 'run', the SDK...

What is the best way to get two parts of a Groovy string?

If I have a string in Groovy like so... 'user.company.name' ... and I want to get the the word "company" and "name" from that string, what is the best way to go about it? I was thinking of something like this, but I'm not sure if it's the most efficient/groovy way: def items = 'user.company.name'.tokenize('.') def company = items[-2...