parsing

PHP-based LaTeX parser -- where to begin?

The project: I want to build a LaTeX-to-MathML translator in PHP. Why? Because I'm a mathematician, and I want to publish math on my Drupal site. It doesn't have to translate all of LaTeX, since the basic document-level stuff is ably handled by the CMS and wouldn't be written in LaTeX to begin with; it just has to translate math writt...

parse delegate to string query c#.net

Hi! I want to implement simple LINQ-to-SQL-like functionality in my .net application. For example i have the following code: userAccounts.Where(ua=>ua.Name=="User1"); and i want delegate in Where method to create a string like this "name = 'User1'". How it can be done? Thanks. ...

Why does XElement fall over when parsing an xml file with an xmlns?

So I'm trying to parse an xml file: <?xml version="1.0" encoding="utf-8" ?> <Root> <att1 name="bob" age="unspecified" xmlns="http://foo.co.uk/nan"&gt; </att1> </Root> Using the following code: XElement xDoc= XElement.Load(filename); var query = from c in xDoc.Descendants("att1").Attributes() select c; foreach (XAttr...

eclipse.ini variables

does eclipse.ini or eclipse command line does variable parsing? such as $PATH or ${java.home} ? ...

Match Anything Except a Sub-pattern

I'd like to accomplish what this (invalid I believe) regular expression tries to do: <p><a>([^(<\/a>)]+?)<\/a></p>uniquestring Essentially match anything except a closing anchor tag. Simple non-greedy doesn't help here because `uniquestring' may very well be after another distant closing anchor tag: <p><a>text I don't <tag>want</tag>...

Using boost::spirit, how do I require part of a record to be on its own line?

I have a record parser that throws one of several exceptions to indicate which rule failed. Front matter: #include <iostream> #include <sstream> #include <stdexcept> #include <string> #include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/phoenix.hpp> #include <boost/spirit/include/classic_position_iterator.hpp> using ...

HTML Parser to Get Content between Elements

Hi guys, I'm looking to parse data out of about 100 pages, all of which have this string of HTML in it: <span class="cell CellFullWidth"><span class="SectionHeader">EVENT</span><br/><div class="Center">Event Name</div></span> I'm not very familiar with parsers, so I'm wondering what I should use to extract the "Event Name" from each ...

getting 502 proxy error while parsing

Iam parsing a page and im getting response from that but after some time i.e. after some of the parsing gets done i get this error from the server - Proxy Error The proxy server received an invalid response from an upstream server. The proxy server could not handle the request GET /file.php. Reason: Error reading from remote server ...

Difference in DocumentBuilder.parse when using JRE 1.5 and JDK 1.6

Recently at last we have switched our projects to Java 1.6. When executing the tests I found out that using 1.6 a SAXParseException is not thrown which has been thrown using 1.5. Below is my test code to demonstrate the problem. import java.io.StringReader; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBui...

How to deal with unknown entity references?

I'm parsing (a lot of) XML files that contain entity references which i dont know in advance (can't change that fact). For example: xml = "<tag>I'm content with &funny; &entity; &references;.</tag>" when i try to parse this using the following code: final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); final Docu...

Calculation Expression Parser with Nesting and Variables in ActionScript

Hi There, I'm trying to enable dynamic fields in the configuration file for my mapping app, but I can't figure out how to parse the "equation" passed in by the user, at least not without writing a whole parser from scratch! I'm sure there is some easier way to do this, and so I'm asking for ideas! Basic idea: public var testString:Stri...

Best way to implement a Parsing/Editable Richtextbox in WPF

I'm trying to implement (as a prototype initially), a richtextbox control which can be parsed in real time to apply certain formatting options to it. This is being done in WPF so I thought the best way to go about it would be to extend the existing rich text box control. I've run into the issue where it isn't documented well and the exa...

Simple regex question?

In the streams I am parsing I need to parse something in this pattern: <b>PaintTitle</b></td><td class=detail valign="top" align=left><div align=left><font size=small><b>The new great album by Pet Shop Boys</b> How would I get the string "The new great album by Pet Shop Boys" where <b>PaintTitle</b> is guaranteed to be once per album?...

How do Scala parser combinators compare to Haskell's Parsec?

I have read that Haskell parser combinators (in Parsec) can parse context sensitive grammars. Is this also true for Scala parser combinators? If so, is this what the "into" (aka ">>") function is for? What are some strengths/weaknesses of Scala's implementation of parser combinators, vs Haskell's? Do they accept the same class of gra...

How to parse RSS Feed and display it as Links in Blackberry Application?

Hi Everybody I wanted to parse the xml feed and display as links in my Blackberry application. After googling it, i found out that i have to use SAX parser. I have not found any good example. For example if i want to parse the news rss feed from bbc.co.uk. How to do it. How to extract images from rss feed. Please Help, Advise, and ...

Parsing/Tokenizing a String Containing a SQL Command

Are there any open source libraries (any language, python/PHP preferred) that will tokenize/parse an ANSI SQL string into its various components? That is, if I had the following string SELECT a.foo, b.baz, a.bar FROM TABLE_A a LEFT JOIN TABLE_B b ON a.id = b.id WHERE baz = 'snafu'; I'd get back a data structure/object somethin...

LALR(1) or GLR on Windows - Alternatives to Bison++ / Flex++ that are current?

I have been using the same version of bison++ (1.21-8) and flex++ (2.3.8-7) since 2002. I'm not looking for an alternative to LALR(1) or GLR at this time, just looking for the most current options. Is anyone aware of any later ports of these than the original that aren't Cygwin dependent? What are other folks using in Windows environme...

xml validity with xsd with xsi:nillable element

My XML file <tns:SampleInfoResponse xsi:schemaLocation="sampleNS test.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="sampleNS"> <tns:SampleInfo> <tns:firstName>String</tns:firstName> <tns:lastName>String</tns:lastName> <tns:lbn>String</tns:lbn> <tns:LSampleDetails> <tns:SampleState>String</tns:Sam...

Can any body help to split php source code

hi, can any body help me on separating this example of data that i need to parse and seperate text just like PHPDoc. It is PHP source code. The example string : function one_to_tree() { //bla bla bla return FALSE; } function two_to_tree() { //bla bla bla return FALSE; } function three_to_tree() { ...

What is a re-entrant parser?

Can someone explain this to me? In particular the difference between: http://github.com/whymirror/greg and http://piumarta.com/software/peg/ The former being a re-entrant version of the later. ...