parsing

Haskell: Parsing escape characters in single quotes

I'm currently making a scanner for a basic compiler I'm writing in Haskell. One of the requirements is that any character enclosed in single quotes (') is translated into a character literal token (type T_Char), and this includes escape sequences such as '\n' and '\t'. I've defined this part of the scanner function which works okay for m...

Yet another Java XML library question

I never liked XML, and always tried to avoid it. And the day finally has come. When I tried to parse XML it was really hard. I used DOM parser, when I called getChildNodes() of a Node, it returned NodeList. I had to use casting while using XPath. Is there any Java XML parsing library that is similar to WebDriver's WebElement mechanism,...

PHP what is the best approach to split these values up?

Hi all, Having a hard time with this one as I don't think I know all of my options. I have to parse a free form text field that I need to map the values to a database. Here is some example text, NOTE: not all fields have to be there, not all delimiters are the same and not all descriptors are available. I do need to check if the value ...

Last.FM API parse with PHP

Hi folks, I'm new to this so bear with my noobish question. Basically I want a user to enter a search phrase into a web-form and for the query to be passed to the lastFM API and return top artists using that phrase based on their "gettopartists" API node. Here's the code I have... function last($q){ $target_url='http://ws.audioscro...

How can I implement #include constructs with Flex and YACC?

During parsing, if I encounter a include token I want to instruct YACC to open the file specified as input and to begin parsing this. Once this parsing is finished, I want to instruct YACC to return to the file and continue parsing directly after the include expression. I will restrict the include depth level to one. ...

Finding <div> in html using C#

I've seen some results on StackOverflow already on a similar topic and they all recommended the HTML Agility Pack. I've also found a few examples on it too, but it isn't working. My current code: HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml("http://stackoverflow.com/"); List...

How to read the author, genre, etc infomation from a ASF file via C# ?

I am developing a small application to catalog my cd rips. don't know how to get these info. thanks in advance. ...

How to create an automatic news site?

Hi, I've seen sites like this (http://www.tradename.net/) on the web that seem to be nothing more than a collection of news articles pulled in from different places - all seemingly automated... I would like to know how can I create something like this that: (a) either automatically, one its own pulls data from different news feeds and c...

C# Compact-Framework friendly command line parser

I read this question: Command Line Parser for .NET. I thought that was what I was looking for, but the library Command Line Parser Library is not Compact framework friendly... I REALLY don't want to write a CL parser and I have been drifting away from the real purpose of my little app because of this unfortunate trial. Does someone kn...

Parsing BlogId from Blogspot.com in PHP using Regex

How can i get the blogid from a given blogspot.com url? I looked at the source code of the webpage from a blogspot.com it looks like this <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.blogger.com/rsd.g?blogID=4899870735344410268" /> how can i parse this to get the number 4899870735344410268 ...

Problem getting contents of class using php simple dom parser

Hi everyone, I can't work out how to get the contents of the second span 'cantfindme' using php simple html dom parser(http://simplehtmldom.sourceforge.net/manual.htm). Using the code below I can get the contents of the first span 'dontneedme'. I cant seem to get anything from second span at all. $html = str_get_html('<html><body><tab...

Is there jQuery like selectors for Java XML parsing?

When I want to find elements from XML in with jQuery, i can just use CSS selectors. Is there any similar selector system for XML parsing in Java? ...

.NET DataGridView: Correct way of dealing with parsing errors while handling the CellParsing event?

I am currently developing an application for an angle measurement device (goniometer). A DataGridView component is used for configuring nominal values (and tolerances) for the measured angles. The user shall be able to enter the angles in various ways, such as 2° (for degrees) or 120' (for minutes of arc) or 7200" (for arcseconds). For t...

Read and parse line in C/C++; put tokens in an array or vector or similar structure

Hello everyone, I have to submit code to one of the problems in ACM IPC and, as you may know, the time counts a lot. So, I have to read efficiently an input like this: The first line will contain the sequence of integer values associated and the second line will contain the sequence of integer values associated with another sequence. E...

Find format used to parse date into string

DateTime date = new DateTime(1970, 1, 15); string sdate = date.ToString(value_i_will_forget as string, CultureInfo.InvariantCulture); // some lines later string format_string = MagicParse(sdate, CultureInfo.InvariantCulture); I have an arbitrary date that I write to a string with CulturInfo.InvariantCulture. The .Net format I...

llvm-clang: incremental or online parser?

Is there anyway to use the llvm-clang parser in an incremental/online manner? Say I'm writing an editor and I want to be able to parse the C++ code I have in front of me. I don't want to write my own hacked up parser. I'd like to use something full featured, like llvm-clang. Is there an easy way to hijack the llvm-clang parser? (And ...

How to match a comment unless it's in a quoted string?

So I have some string: //Blah blah blach // sdfkjlasdf "Another //thing" And I'm using java regex to replace all the lines that have double slashes like so: theString = Pattern.compile("//(.*?)\\n", Pattern.DOTALL).matcher(theString).replaceAll(""); And it works for the most part, but the problem is it removes all the occurrences a...

Regarding CSV File Format SPLIT

I am planning to modify the file format so that each field should be enclosed in by double quotes mandatory "A","Field1","Field2","Field3","Fi"el,d","Fi""eld", I want the separator to be combined i.e to be ", (double quotes followed by comma) how do i change the below split command to include two separator ", (double quote and comma) tog...

How can I locally save an XML file on an iPhone for when the device is offline?

My app is accessing data from a remote XML file. I have no issues receiving and parsing the data. However, I'd like to take the most current XML data and store it locally so - in the event that the user's internet service isn't available - the local data from the previous load is used. Is there a simple way to do this? Or am I going to ...

How to create a list of all built-in PHP functions a project makes use of?

Background: PHP allows providers to disable functions (directive "disable_functions"). So in order to get to know if your project is running on a specific server you'll have to check: What built-in (=excluding user-defined) functions is your to-be-deployed project using? Are the functions available on the specific host? (Question (2)...