parsing

CSV Parser in one routine/function?

I know there are several libraries of code out there that can parse CSV files according to the standard, but, for various reasons, I need one simple routine (not an entire library) that parses a CSV into a DataTable or array. Does such an animal exist or is it extinct? (Preferably C# but i can translate vb.net too) ...

Anyone having any experience using the Norken Technologies Parser Development Toolkit ?

Anyone having any experience using the Norken Technologies Parser Development Toolkit ? I would like to ask some questions about it but i dont think its used very much at least not many files on google about it. I used it for a Portable Game Notation parser, maybe we could exchange some thoughts about the toolkit. ...

Parsing a string, Grammar file.

How would I separate the below string into its parts. What I need to separate is each < Word > including the angle brackets from the rest of the string. So in the below case I would end up with several strings 1. "I have to break up with you because " 2. "< reason >" (without the spaces) 3. " . But Let's still " 4. "< disclaimer >" 5. " ...

Parsing or Extracting the content of html table.

Can I parse the html tables by giving only column name ? Like only those data should be extracted from the table which matches those column names I give. Like for example I have table of column names like serial no., name, address, phone no,total Rs.. And I want to extract the information about only name, phone no and total Rs.. Then ...

Seek, move front back in a file cut and paste

I need to do the following things for a text file..and insert the seeked words to a excel please give me some tips: Seek the letter sequence anywhere in the file "stg-" take the first two characters from where it is searched ... eg if the sentence has abc-stg-c5-sfdsdf then it should take c5 and this c5 should insert in the first col...

Parse a TSV file

Hi, I need to parse a file in TSV format (tab separated values). I use a regex to break down the file into each line, but I cannot find a satisfying one to parse each line. For now I've come up this: (?<g>("[^"]+")+|[^\t]+) But it does not work if an item in the line has more than 2 consecutive double quotes. Here's how the file is ...

Find a duplicate entry in a large SQL script

Hello I have a very large SQL script and while trying to execute it I get an error from PostgreSQL about a duplicate primary key. It does not give a line number of anything for where the duplicate entry occurs (it is also wrapped in a transaction, so it doesn't know about the duplicate until commit; at the end of the file. Basically, co...

Treetop grammar issues using regular expressions

I have a simple grammar setup like so: grammar Test rule line (adjective / not_adjective)* { def content elements.map{|e| e.content } end } end rule adjective ("good" / "bad" / "excellent") { def content [:adjective, text_value] end } e...

Parsing XML in a java 1.4 environment

I'm developing an application for an old phone which is running java 1.4 and it's not upgradeable. I can't find any library for XML parsign that is compatible with such an old java runtime. Any idea? Thanks! ...

Appropriate uses for yacc/byacc/bison and lex/flex

Most of the posts that I read pertaining to these utilities usually suggest using some other method to obtain the same effect. For example, questions mentioning these tools usual have at least one answer containing some of the following: Use the boost library (insert appropriate boost library here) Don't create a DSL use (insert favor...

Creating subtree from tree which is represented in xml - python

Hi I have an XML (in the form of tree), I require to create sub-tree out of it. For ex: <a> <b> <c>Hello</c> <d> <e>Hi</e> </a> Subtree would be <root> <a> <b> <c>Hello</c> </b> </a> <a> <d> <e>Hi</e> </d> </a> </root> What is the best XML library in python to do it? Any algorithm that already does...

Is there a good, complete tutorial on Erlang parse transforms available?

There are lots of fragments out there detailing bits and pieces of the parse transform process in Erlang, but none I've found offer complete coverage from motivation to execution. Is there a good tutorial I'm missing somewhere and, if so, where can it be found? ...

How to get the content of a Html page in Python

I have downloaded the web page into an html file. I am wondering what's the simplest way to get the content of that page. By content, I mean I need the strings that a browser would display. To be clear: Input: <html><head><title>Page title</title></head> <body><p id="firstpara" align="center">This is paragraph <b>one</b>. ...

How do I use awk to parse a fixed-width (NACHA) file format?

My company has a problem: we suspect that the NACHA files we are receiving from one of our application service providers that we use to draw money from our clients are incorrect. We have all of the ACH agreements and legal mumbo-jumbo in place, so it's not a problem with our use of the ACH network, and we're not receiving word from the...

Parse some strange text format

Hi, I'm trying to parse some data returned by a 3rd party app (a TSV file). I have all the data neatly parsed into each fields (see http://stackoverflow.com/questions/2410788/parse-a-tsv-file), but I don't know how to format some fields. Sometimes the data in a field is encapsulated like this: =T("[FIELD_DATA]") (That's some sort of ...

Is it possible to use Recursive Descent Parser to both verify the grammar AND build the parse tree at the same time?

Is it possible to generate a parse tree at the same time as I use recursive descent parser to check if the data matches grammar? If so, what approach would I use to build a tree as I recursively descent? Thanks, Boda Cydo. Note: I am new to parsing. (Asked several questions on SO already, and I am getting better with it.) ...

XML Parsing: Checking for strings within string C++

I have written a simple C++ shell program to parse large XML files and fix syntax errors. I have so far covered everything I can think of except strings within strings, for example. <ROOT> <NODE attribute="This is a "string within" a string" /> <ROOT> My program loops through the entire xml file character by character(keeping only ...

Parsing XML in C from a DTD and building a linked-list accordingly...

I'm trying to parse an XML file using C. The DTD for this XML file is fairly simple. It's basically a bunch of key-value pairs, with support for arrays as well. I've found XML parsers like Mini-XML and AsmXml, but they don't seem to support building a linked-list of the XML file based on the DTD. Is there an XML parsing library availab...

Log parser/analyzer in Unix

What's the popular tool people use in Unix to parse/analyze log files? Doing counting, find unique, select/copy certain line which have certain patterns. Please advise some tools or some keyword. Since I believe there must be similar questions asked before, but I don't any idea about the keywords. Thanks. ...

Parsing language for both binary and character files

The problem: You have some data and your program needs specified input. For example strings which are numbers. You are searching for a way to transform the original data in a format you need. And the problem is: The source can be anything. It can be XML, property lists, binary which contains the needed data deeply embedded in binary junk...