parsing

Objective-C : pulling value out of NSString

Hey all, I have a bunch of NSStrings like this.... { "score" = 15; "serial" = 8; } What is the best way to extract the values out of this string using "id" and "score"? ...

Best way to parse an invalid HTML in PHP

Is there a better approach to parse an invalid HTML then applying Tidy on it? Side Note : There are some situation when you can't have Tidy available. Regexp is also not recommended I understood for parsing html. ...

standalone grammar and parser for php

i'm looking for a ready-made grammar and parser for php (at least 5.2), ideally an utility/library that can parse php code into a readable AST, e.g. xml. The parser itself doesn't have to be written in php, the source language doesn't matter much. ...

How to convert string type to user defined custom type

I have a string value that needs to be converted into my user defined custom type. how to do this, please help me. public class ItemMaster { public static ItemMaster loadFromReader(string oReader) { return oReader;//here i am unable to convert into ItemMaster type } } ...

Translate Spanish feed to English before storing it in MYSQL database

Hello, I am new to ruby on rails and I have just started watching rails casts tutorials. I have understood on how to parse feeds using feedzirra if the feed is in English but if I have a feed like this which is in spanish then how do i parse this feed? The link is http://estaticos.marca.com/rss/futbol_equipos_almeria.xml how do i co...

How to fetch multiple feeds concurrently

Hello, I am new to ruby on rails and I have just started watching rails casts tutorials. To parse feeds, I have started using feed zirra. To fetch multiple feeds at once, feedzirra has this feature feed_urls = ["http://feeds.feedburner.com/PaulDixExplainsNothing", "http://feeds.feedburner.com/trottercashion"] feeds = Feedzirra::Feed....

Problem parsing this YQL JSON in Java/Android

Here is the JSON result: { "query": { "count": "4", "created": "2010-08-31T05:53:39Z", "lang": "en-US", "results": { "quote": [ { "symbol": "AAPL", "Ask": "244.17", "AverageDailyVolume": "23152200", "Bid": "244.12", "AskRealtime": "244.17", "BidR...

Perl best practices: file parser using regexes and database storage

Hi, I'm writing a log file parser in Perl, using regexes that I've stored in a database. My workflow is basically like this: Looping over the file and searching for patterns matching my regexes and then extract them Do something with these matches Store them accordingly in a database Last time I did this I explicitly wrote each rege...

Simple parsing questions using PEG.js - newbie warning!

I'm a newbie at Stackoverflow as well as PEG (http://en.wikipedia.org/wiki/Parsing_expression_grammar), so please be gentle! [As a newbie, I was only allowed one hyperlink. Sorry!] I'm trying to wrap my head around PEG by entering simple grammars into the PEG.js playground. Example 1: Input: "abcdef1234567ghijklmn8901opqrs" Desired o...

In Scala, how to read a simple CSV file having a header in it's first line?

The task is to look for a specific field (by it's number in line) value by a key field value in a simple CSV file (just commas as separators, no field-enclosing quotes, never a comma inside a field), having a header in it's first line. User uynhjl has given an example (but with a different character as a separator): val src = Source....

Need help parsing strings in Java

Hello everyone, I am reading in a csv file in Java and, depending on the format of the string on a given line, I have to do something different with it. The three different formats contained in the csv file are (using random numbers): 833 "79, 869" "56-57, 568" If it is just a single number (833), I want to add it to my ArrayList. If ...

Which is the best option, SimpleXml or XML Parser in PHP?

I have gone through the Stack Overflow post "Best XML Parser for PHP". For the same question. It is mentioned that, if I need to manipulate XML files then go for DOM XML. My requirements are: I have saved navigation in database. It is an HTML string. I want to remove some pages or say li tags wrapping pages that user don't want to exi...

how to parse images by using Rome RSS Parser

Hello Do you know how to parse images by using rome parser?(java platform) I looked at some samples at rome parser documentation but it's clear. Can you provide me the sample code to parse images by using rome rss parser? Regards Altaico ...

How do I get DOM elements of which tagnames start with a prefix

Using javascript, how do I get all DOM elements that start with a certain prefix like <prefix:suffix> Code example: <div> <foo:bar1>hello</foo:bar1> </div> <foo:bar2>world</foo:bar2> But, without looping through ALL elements (for performance reasons)? Thanks, Ran ...

how to set id of an element using PHP dom ?

Hi, I want to set id of an element. I'm using php dom. I could not understand how following will work. DOMElement::setIdAttribute ( string $name , bool $isId ) The only description I found for this in manual is - Declares the attribute name to be of type ID. How can I do this ? ...

Parse a CSS file with PHP

I want to parse (in a special way) a CSS file with PHP. Example: cssfile.css: #stuff { background-color: red; } #content.postclass-subcontent { background-color: red; } #content2.postclass-subcontent2 { background-color: red; } And I want that PHP returns me each class name that have the postclass in its name. The res...

How to properly parse CSV file to 2d Array?

I'm trying to parse a csv file into a 2d array, where each row is a data entry and each column is a field in that entry. Doing this all at once simplifies and separates my processing code from my parsing code. I tried to write a simple parser that used String.Split to separate file by commas. This is a horrible approach as I have disc...

Parsing an .htaccess File With PHP

I am using the Zend Framework, and I use the .htaccess for some settings. I am now writing command line scripts for scheduling (e.g. cron). Command line scripts don't look at the .htaccess file because they're not served up by Apache. I would like to parse the .htaccess with my script to retrieve some settings. Here are the lines I'm...

How to download all posts of phpBB3 forum if I am not admin?

I am used to post my ideas on one forum and started to worry that I will loose them if it gets closed. Do you know a good way to download entire (ideas of other guys are also nice!) phpBB3 forum to a database? Is there software already available, or I have to write it myself? UPDATE1: Well, I can write it myself - this is not that hard...

Scala: Parsing transformation question

I am using Scala's combinator parser as follows: def a = b ~ c ^^ { case x ~ y => A(x,y) } def b = ... { B() } def c = ... { C() } now I have a feature change that change within the parsing of the reference of previously parsed B to be a val in C. So C's constructor is something like: C(ref:B) I can imagine, the only way to achieve...