parsing

Reading from XML file using XmlHandler class from Forum Nokia - Symbian C++

Hi! I'm trying to use XmlHandler class ( link to Forum Nokia with code of XmlHandler Class ) on Symbian S60 3rd FP2 edition to read xml files. I have in my function this code: CXmlHandler *iXmlHandler; TFileName fileName; iXmlHandler = CXmlHandler::NewL(); fileName.Append( KConfigFile ); iXmlHandler->StartParsingWithAoL( fileName ); ...

how to write a Python debugger/editor

Sorry for the kind of general question. More details about what I want: I want the user to be able to write some Python code and execute it. Once there is an exception which is not handled, I want the debugger to pause the execution, show information about the current state/environment/stack/exception and make it possible to edit the co...

How to read or parse MHTML (.mht) files in java

Hi All I need to mine the content of most of known document files like: pdf html doc/docx etc. For most of these file formats I am planning to use: http://tika.apache.org/ But as of now Tika does not support MHTML (*.mht) files.. ( http://en.wikipedia.org/wiki/MHTML ) There are few examples in C# ( http://www.codeproject.com/KB/fi...

Better way to parse this string.

Hi, I have an NSString somewhat like this: <some lines (unknown amount)> Key1:thingIWantToKnow Key2:otherThing <more lines (also not known how much)> All lines end with a newline (\n) character. Sometimes the string behind the Key#: is empty (@"") but I would still like to have it. I was thinking of something like getting the start ...

Parse file containing XML Fragments in Java

I inherited an "XML" license file containing no root element, but rather two XML fragments (<XmlCreated> and <Product>) so when I try to parse the file, I (expectantly) get an error about a document that is not-well-formed. I need to get both the XmlCreated and Product tags. Sample XML file: <?xml version="1.0"?> <XmlCreated>May 11 2...

How to get href from anchor tag with particular class

If I have an HTML document, what is the best way to go through the document and gather the href values from all anchor tags with a particular class using PHP? ...

Parsing a decimal number

Guys, I have a string that contains a decimal number. The problem is, sometimes it is negative and it is stored in accounting format (positive number surrounded by parenthesis). In other words, I got a string like this: string s = "(35.00)"; What I'm doing currently is: decimal TheValue = decimal.Parse(s); This value of TheValue sh...

Filtering out namespace errors when parsing partial XML via libxml2 in C++

Hi guys, I have the need to parse partial XML fragments (which are presented as std::string), such as this one: <FOO:node>val</FOO:node> as xmlDoc objects in libxml2, and because these are fragments, I keep getting the namespace error : Namespace prefix FOO on node is not defined errors spit out into STDERR. What I am looking for is ...

How to regex in python?

I am trying to parse the keywords from google suggest, this is the url: http://google.com/complete/search?output=toolbar&amp;q=test I've done it with php using: '|<CompleteSuggestion><suggestion data="(.*?)"/><num_queries int="(.*?)"/></CompleteSuggestion>|is' But that wont work with python re.match(pattern, string), I tried a few b...

PDF Parser API in Java

Hi.. I want to convert the pdf data into our own file specifications. So pls help me out to choose the correct API for PDF parsing using java or .net. The parsing should extract each and every component(element) from the PDF pages. ...

PHP code to convert PHP to JS

I need some PHP code to convert some PHP into JS. functionality - I'm using common PHP functions from php.js syntax - ??? The issue is converting the syntax. I don't need full PHP syntax, mind you; no need for supporting class definitions/declarations. Here's a small checklist of what needs conversion: "." should be "+" (string con...

Interpreting various date formats automatically

I've got a bunch of old spreadsheet data with date fields. Sometimes I'm lucky enough to get the standard Excel date format, but other times a range of dates was entered, with little consistency in the format: some are 07/2-5/95, others 07/02/1995-07/05/1995, still others 7-2 & 5-95. Short of writing regular expressions and parse rules f...

Comparison of XML parsing APIs on the Java SE platform

Hello, I am currently developing an RSS feed reader, and I am wondering which XML parsing API would be the best fit for that. (Please note that I am not looking for a Feed parser library - it is merely the starting point for that research about XML APIs) I am looking for a rundown of the various XML parsing APIs on the Java platform, ...

Wrong value with double.Parse(string)

Hi, I'm trying to convert a string to a double value in .Net 3.5. Quite easy so far with double.Parse(value); My problem is that values with exponential tags are not right converted. Example: double value = double.Parse("8.493151E-2"); The value should be = 0.0893151 right? But it isn't! The value is = 84931.51!!! How can that be...

c++ what is the advantage of lex and bison to a selfmade tokenizer / parser

Hi, I would like to do some parsing and tokenizing in c++ for learning purposes. Now I often times came across bison/yacc and lex when reading about this subject online. Would there be any mayor benefit of using those over for instance a tokenizer/parser written using STL or boost::regex or maybe even just C? ...

Should jQuery's parseJSON/getJSON methods be used?

I noticed that the jQuery parseJSON basically does a simple regex "check": parseJSON: function( data ) { if ( typeof data !== "string" || !data ) { return null; } // Make sure leading/trailing whitespace is removed (IE can't handle it) data = jQuery.trim( data ); // Make sure the incoming data is actual JSO...

ExtJS Grid displays date column but not the other

Hello All, I've been having some trouble finding the problem in my code, so thought I'd try to find a second pair of eyes. Code: var logStore = new Ext.data.JsonStore({ autoLoad: true, url: 'inc/interface/config.php?list=messages', root: 'logs', id: 'ID', fields: ['ReceivedAt', 'Message'] }); var logGrid = new Ex...

Using an XSL for-each on identical XML children

In brief, my problem is that I want to loop through the contents of one child among identical children, but when I try to do so, it loops through the contents of all the children, giving me as many duplicates of the data as there are children. Example code: Input.xml <?xml version="1.0"?> <base> <item name="item1"> <foo> ...

Converting NSString to int

Possible Duplicate: NSString is integer? I've been searching around for the last half hour trying to find an easy way to convert an instance of NSString into an integer, and to be able to tell if the string was validly formatted. So far, I haven't been able to find anything. There's the intValue and integerValue methods in N...

Incremental Stream Parsing in C++

Hi, I am reading data from a (serial) port using a non-blocking read() function (in C/C++). This means the data comes-in in chunks of undetermined (but reported) sizes (incl. 0) each time I "poll" the port. I then need to parse this "stream" for certain patterns (not XML). My naive implementation concatenates the new string to the pre...