parsing

Parsing NSString to get data out

Hey all, I have this code... NSData* myData = producedData; NSLog(@"Contents of myData: %@", myData); The log prints { "id" = ""; "level" = "level_1"; "handle" = test; } How do I get the values for id and level and handle out of this? The original data is a NSString*. Thanks! ...

sscanf to read custom simple log format?

I wrote a simple log file for my website that is in the following format: TIME: "..." IP: "..." HOST: "..." UA: "..." And wanted to parse through it with sscanf as part of an exercise. My code was roughly like this, which was run on each line of the log: list($time, $ip, $host, $ua) = sscanf("TIME: %s IP: %s HOST: %s UA: %s", $line)...

Using a Python GEDCOM parser: Receiving bad output (gedcom.Element instance at 0x00...)

I'm new to Python, and I can say off the bat my programming experience is nominal compared to many of you. Brace yourselves :) I have 2 files. A GEDCOM parser written in Python that I found from a user on this site (gedcom.py - http://ilab.cs.byu.edu/cs460/2006w/assignments/program1.html) and a simple GEDCOM file that I pulled from hei...

Parser vs. lexer and XML

I'm reading about compilers and parsers architecture now and I wonder about one thing... When you have XML, XHTML, HTML or any SGML-based language, what would be the role of a lexer here and what would be the tokens? I've read that tokens are like words prepared for parsing by the lexer. Although I don't have problem with finding tokens...

Parsing a faxed form

Looking at a scenario where a form (consisting of, for simplicity sake, checkboxes only) is faxed to a fax server capable of OCR. Now, with typographic text, I've see various OCR implementations doing a decent job, but I'm not sure how it would handle checkboxes, especially handwritten "x" or checks, not to mention the coordinates. Bac...

How can I use Ruby to parse through XML easily to query and find certain tag values?

I am working with an API and want to know how I can easily search and display/format the output based on the tags. For example, here is the page with the API and examples of the XML OUtput: http://developer.linkedin.com/docs/DOC-1191 I want to be able to treat each record as an object, such as User.first-name User.last-name so that I ...

[Android] Layout Parsing Xml

hi.. i'm make example parsing xml from http://www.androidpeople.com/android-xml-parsing-tutorial-using-saxparser/ in this example, layout using an array textview.. I tried to change the layout into a ListView, but is not working.. I get error in adapter.. can anyone help me? ...

Want top frequent words in english

Hi, I want most frequent words in english. Basically, I am processing wikipedia text and am stuck with lot of words even after removing stop words. I tried googling for frequent words, but got the below link. http://en.wiktionary.org/wiki/Wiktionary:Frequency_lists#English I have to manually scrape the data from these link. Is there a...

Parsing document with python minidom

I have the following XML document that I have to parse using python's minidom: <?xml version="1.0" encoding="UTF-8"?> <root> <bash-function activated="True"> <name>lsal</name> <description>List directory content (-al)</description> <code>ls -al</code> </bash-function> <bash-function activated="True"...

PHP Parse HTML code

Possible Duplicate: Best methods to parse HTML Hello! How can I parse HTML code held in a PHP variable if it something like: <h1>T1</h1>Lorem ipsum.<h1>T2</h1>The quick red fox...<h1>T3</h1>... jumps over the lazy brown FROG! I want to only get the text that's between the headings and I understand that it's not a good idea...

How to parse a string URL into MVC Route Values (area, controller, action, querystring)?

Is there a method to extract the area, controller, action, and querystring from a URL in ASP.NET MVC? Don't want to reinvent the wheel implementing my own if there's already a way to do it. Thanks! ...

Parsing an XML with Xpath in PHP

Consider the following code : $dom = new DOMDocument(); $dom->loadXML($file); $xmlPath = new DOMXPath($dom); $arrNodes = $xmlPath->query('*/item'); foreach($arrNodes as $item){ //missing code } The $file is an xml and each item has a title and a description. How can I display them (title and description)? $file = "<item> <title>t...

Parsing / Splitting Keywords from Spatial / Location in Search

I'm trying to figure out a decent way to parse keywords from location words within a single string before or after geocoding the string or part of the string. For example: "iphone battery accessories toronto, on", or "2010 volvo 90210", or "circus texas", etc. It turns out I can pass the entire string to most geocoders and get a valid l...

Is HL7 (HL7.org) message format expressable as BNF with LALR(1) Compatability????

Title says it all. Reposted this as a new messsage (orgiginally I asked for the BNF grammar of HL7). Whilst it may be possible to express all of HL7 as BNF I need my BNF to be LALR(1) complaint (completely deterministic). Devon Cooks Gold Parser is the toolset. Just figured I 'd ask before I started creating BNF myself....... ...

Parsing using awk or sed in Unix

Hi, I have multiple files with hundreds of thousands of records in following format: 2010/08/10 10:07:52|TrainZoom|1393|38797|MyCustomerAPI->,mask = ZPTA,TransId = 1281460071578,testing :-> , capture -> : , IMDB = 9113290830, equipmentName = GMT, technologyName = RMS,,,)| There are fields separated by pipes and inside...

Parsing my flat-file on Iphone is a pain in the ***, Plz Help me out

Hey guys, stack overflow has already helped me a lot during my programming work so at first: Thanks a lot for all the asked questions and the excellent answers. Nevertheless I have a problem right now, for which I just couldn't find the right answer here. I am programming a Iphone App which is supposed to parse a flat-file from the we...

python parsing xml

hi i have xml file whitch i want to parse, it looks something like this <?xml version="1.0" encoding="utf-8"?> <SHOP xmlns="http://www.w3.org/1999/xhtml" xmlns:php="http://php.net/xsl"&gt; <SHOPITEM> <ID>2332</ID> ... </SHOPITEM> <SHOPITEM> <ID>4433</ID> ... </SHOPITEM> </SHOP> my parsin...

PHP add show-hide functionality for text dynamically

Hello! I have html text that's fetched from a database. The structure of the text is always like this: <div>Short text</div>Long text And repetitive: (unpredictible number of times) <div>Short text</div>Long text <div>Short text</div>Long text <div>Short text</div>Long text <div>Short text</div>Long text What I want to do is check...

Lucene.net Query Parser Syntax Problem

Hey All, I'm having a problem building a complicated lucene query using the QueryParser. This is basically what I need to search for one of the fields (allowed): This Field Basically stores some series of keywords that specify some access. It could look like: -PPartners:ALL -PLevel:ALL -PRegion:ASIA, EUROPE, AMERICAS -PAffiliate:GOOGL...

How to find a particular value from a string, PHP

I have a string (not xml ) <headername>X-Mailer-Recptid</headername> <headervalue>15772348</headervalue> </header> from this, i need to get the value 15772348, that is the value of headervalue. How is possible? ...