parsing

C# regex to replace a delimiter by another one

I'm working on pl/sql code where i want to replace ';' which is commented with '~'. e.g. If i have a code as: --comment 1 with; select id from t_id; --comment 2 with ; select name from t_id; /*comment 3 with ;*/ Then i want my result text as: --comment 1 with~ select id from t_id; --comment 2 with ~ select name from t_id; /*com...

HTML Parsing Libraries for .NET

I'm looking for libraries to parse HTML to extract links, forms, tags etc. http://www.majestic12.co.uk/projects/html_parser.php http://www.netomatix.com/Products/DocumentManagement/HtmlParserNet.aspx http://www.developer.com/net/csharp/article.php/2230091 LGPL or any other commercial development friendly licenses are preferable. Hav...

CSS Parser in ColdFusion or Java?

I'm building something that requires a simple HTML frontend for editing some properties in CSS. However, I need to get the value specified by a CSS file. The only parser I can find is CSS Parser Project , and it is in Java. It implements both Document Object Model Level 2 Style & SAC: The Simple API for CSS API. It should work, but w...

Parsing buffer in C++ using OOP and STL

I want to use OOP and STL etc to parse a buffer. My Buffer contains ABCDXXXX333$$$$YYYY I need to separate ABCD XXXX 333 $$$$ YYY and move them to struct. I have their offset defined in one of the rule table and how many elements are in the buffer. A few of the fields are delimited also. Any suggestions what STL features I can use...

How to parse days/hours/minutes/seconds in ruby?

Is there a gem or something to parse strings like "4h 30m" "1d 4h" -- sort of like the estimates in JIRA or task planners, maybe, with internationalization? ...

What programs are there for parser generation?

I recently took a class at school where we had to learn Scheme to build a parser for a simple made up scheme-like language. As the semester went on, we added to our parser to make it more and more interesting. Since then, on my own time, I've started writing my own parser that's quite a bit neater than what I did in class, but it parses...

Parsing expressions with an undefined number of arguments

I'm trying to parse a string in a self-made language into a sort of tree, e.g.: # a * b1 b2 -> c * d1 d2 -> e # f1 f2 * g should result in: # a * b1 b2 -> c * d1 d2 -> e # f1 f2 * g #, * and -> are symbols. a, b1, etc. are texts. Since the moment I know only rpn method to evaluate expressions, and my current solution...

Design pattern for parsing a markup tree into an object model

Hi, I'm stumped, I have a task where I have to take some markup (json format, not that it really matters) and parse it into an object model. We already have a domain model, its just a matter of running through the markup and creating the relevant objects. It's not really suitable for the composite pattern as the objects being created a...

JavaME-suitable grammar compiler recommendations?

I want to parse some data, and I have a BNF grammar to parse it with. Can anyone recommend any grammar compilers capable of generating code that can be used on a mobile device? Since this is for JavaME, the generated code must be: Hopefully pretty small Low dependencies on exotic Java libraries Not dependant on any runtime jar files. ...

Do you know any ruby lexers I could use in an application?

I would need lexers for as many programming languages I could get, and I would need them to be written in ruby. Do you know any? ...

Get url parameters from a string in .NET

Okay, this is probably a simple one... I've got a string in .NET which is actually a url. I want an easy way to get the value from a particular parameter. Normally, I'd just use Request.Params["theThingIWant"], but this string isn't from the request. I can create a new Uri item like so: Uri myUri = new Uri(TheStringUrlIWantMyValue...

SQL parser library for Java

Is there a good open-source Java library for parsing SQL statements? If possible, it should be customizable or flexible enough to also be able to parse (or at least ignore) vendor-specific syntax (such as Oracle tablespace definitions or MySQL's LIMIT clause). If not, strict adherence to the SQL standard is also fine. Update: I need t...

How to set "org.w3c.css.sac.parser" system property?

In this ParserFactory.java String className = System.getProperty("org.w3c.css.sac.parser"); if (className == null) { throw new NullPointerException("No value for sac.parser property"); //line 35 } else { return (Parser)(Class.forName(className).newInstance()); } When I run this DemoSAC.java file as Java Application in Eclipse...

Querying html using Yahoo YQL

While trying to parse html using Yahoo Query Language and xpath functionality provided by YQL, I ran into problems of not being able to extract “text()” or attribute values. For e.g. perma link select * from html where url="http://stackoverflow.com" and xpath='//div/h3/a' gives a list of anchors as xml <results> <a class="qu...

Regex to find all methods in a piece of code

Hi, I am trying to write a regex to match all the javascript method definitions in a constructor string. //These two should match this.myMethod_1 = function(test){ return "foo" }; //Standard this.myMethod_2 = function(test, test2){ return "foo" }; //Spaces before //All of therse should not //this.myMethod_3 = function(test){ return "f...

Is there a parser/way available to parser Wikipedia dump files using Python?

I have a project where in I collect all the wikipedia articles belonging to a particular category, pull out the dump from the wikipedia, and put it into our db. So I should be parsing wikipedia dump file to get the stuff done. Do we have an efficient parser to do this job. I am a python developer. So I prefer any parser in python. If not...

The string '3/18/09 10:16 PM' is not a valid AllXsd value.

Obviously the reader doesn't like this format incoming from the response XML. Wondering if I can reformat this. Trying to convert to DateTime using the following code with my XmlReader: reader.ReadContentAsDateTime(); ...

Theory, examples of reversible parsers?

Does anyone out there know about examples and the theory behind parsers that will take (maybe) an abstract syntax tree and produce code, instead of vice-versa. Mathematically, at least intuitively, I believe the function of code->AST is reversible, but I'm trying to find work/examples of this... besides the usual resources like the Drago...

How can I parse XML to get multiple text blocks with SimpleXML?

I want to parse some XML that looks like this: <node> This is <child> blah </child> some <child> foo </child> text </node> How do I get access to the text node children in Simple XML? Can I access them in the correct order of text and element children? Do I need some other package for this? ...

Parsing an HTML table using Hpricot (Ruby)

I am trying to parse an HTML table using Hpricot but am stuck, not able to select a table element from the page which has a specified id. Here is my ruby code:- require 'rubygems' require 'mechanize' require 'hpricot' agent = WWW::Mechanize.new page = agent.get('http://www.indiapost.gov.in/pin/pinsearch.aspx') form = page.forms.find...