parsing

Conditionally parsing XML attributes with PHP

Hi, I am really hoping somebody can help me with this. Basically, I am trying to parse certain XML attributes in an XML tree based on other attributes in that branch. As an example of the type of XML I am working with: - <root> <employees> <team id="1643"> <member id ="153461" jobtype="permament" division="cleaning" rollnumber=...

What are some ways to extract a location from a sentence/query?

I want to recognize and extract a location that's built into a sentence. For example I might have a sentence: "I love the pizza in Boston, Ma." but this same sentence could also be written as "Pizza in Boston, I love it." OR "I love the pizza in Boston." So I have to be able to find it anywhere in the sentence and also if the state i...

Python: Parse stream title with mplayer

I'm writing a simple frontend in Python to play and record internet radio channels (e.g. from shoutcast) using mplayer (in a subprocess). When a user clicks a station the following code is run: url = http://77.111.88.131:8010 # only an example cmd = "mplayer %s" % url p = subprocess.Popen(cmd.split(), shell=False) wait = os.waitpid(p....

PHP Query String Manipulation

Any one have the ultimate PHP function(s) to add/remove parameters from a query string? It needs to handle all possible cases, Ive seen ones that handle some cases, but not all. Some example cases: http://mysite.com?param1=1&amp;param2=2 http://www.mysite.com/?param1[]=1&amp;param1[]=2 ftp://user:[email protected]/files/uploads/?param1=...

How can I extract/parse tabular data from a text file in Perl?

I am looking for something like HTML::TableExtract, just not for HTML input, but for plain text input that contains "tables" formatted with indentation and spacing. Data could look like this: Here is some header text. Column One Column Two Column Three a b a b ...

PDF Fields Parser using PDFBox

Hi, From PDF, i need to read the co-ordinates of the fields such as, ascent descent of the fields, using PDFBox API. The COS dictioanary object contains those information i guess. As of now i can able to retrieve the rect box of the fields which includes x,y,height and width. But i need to get the baseline which in turn depends on ascen...

Parse tree for SQL statements - precisely for "SELECT" statement

hi, I am writing (hand written) recursive descent parser for SQL select statement in c++, i need to know whether the parse tree created by me is correct or not. I want to check but i didn't get a good sources for sql parse trees. My way of approach is - writing a function for each production and in that function the result is adding to ...

Error parsing parameters in ASP.Net

I'm having a problem parsing my parameters in ASP.Net Here's what i'm doing Sub ItemCommand(ByVal Sender as Object, ByVal e as RepeaterCommandEventArgs) If e.CommandName = "EditDetails" Then EditDetails() <---- This is where it's dying Else If e.CommandName = "SubmitDetails" Then SubmitDetails() End If ...

How to do advanced URL parsing with RegEx?

I'm using the following method to parse URLs: Regex.Replace(text, @"((www\.|(http|https|ftp)\://)[.a-z0-9-]+\.[a-z0-9\/_:@=.+?,##%&~-]*[^.|\'|\# |!|\(|?|,| |>|<|;|\)])", "<a href=\"$1\" target=\"&#95;blank\">$1</a>", RegexOptions.IgnoreCase).Replace("href=\"www.", "href=\"http://www."); It works great, but:...

String of arrays parsing

I have a String like this. {"type":"broad","Text":"cat"},{"type":"broad","Text":"dog"} String[] keyString = getParts({"type":"broad","Text":"cat"},{"type":"broad","Text":"dog"}); for(String part : keyString){ some code here which gives like this String text = "cat"; String type = "broad"; } Can some one tell me how can ...

Android Web service problem.

Hi all. i m calling an webservice which is soap based in my android application. it is returning me the XML response. how can i parse it?? i checked the xml parsing its asking for the URL. i m confused which url i need to pass?? Here is the code: SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); request.addProperty("pStrT...

Regex for Reading ini with PHP

Sample ini file is [SAMPLE.jpg] faces=rect64(c18f4c8ef407851e),d4ff0a020be5c3c0;rect64(534a06d429ae627),dff6163dfd9d4e41;rect64(b9c100fae46b3046),e1059dcf6672a2b3;rect64(7b5105daac3a3cf4),4fc7332c107ffafc;rect64(42a036a27062a6c),ef86c3326c143248;rect64(31f4efe3bd68fd8),90158b3d3b65dc9b;rect64(327904e0614d390d),43cbda6e92fcb63e;rect64(42...

Parse a pdf file

Hi ! I got a pdf like this one : 81 11005589 THING MAXIME 4 PC2I TR1 - MERCREDI DE 07H45 A 09H45 4A7 71 11007079 STUFF QUENTIN 1 PC2I TR1 - LUNDI DE 10H00 A 12H00 1B4 74 10506940 HAHA YEZHOU 2 PC2I TR1 - LUNDI DE 13H30 A 15H30 2D5 http://i.imgur.com/hbXg2.png And I need to parse it. What I mean by that is take the 4th column, add the...

Parsing a stream of data for control strings

I feel like this is a pretty common problem but I wasn't really sure what to search for. I have a large file (so I don't want to load it all into memory) that I need to parse control strings out of and then stream that data to another computer. I'm currently reading in the file in 1000 byte chunks. So for example if I have a string tha...

Parse date with possible single-digit month/day/hour using java.text.SimpleDateFormat

On a project with Talend Open Studio (an Open Source code-generating ETL tool), I am getting errors parsing incoming date strings like "3/14/1967 0:00:00" (note the single-digit month). Digging into the code, I can see it is using java.text.SimpleDateFormat. So the date pattern string I expect I need to use is "d-M-yyyy H:mm:ss"... but ...

jQuery URL parser plugin fails on '@' in query string - What URL parsing regex will work?

Background I use the jQuery URL parser plugin by Mark Perkins for extracting query string values from the current URL. The parsing process fails when query string values contain the '@' character, most notably when there is an email address in the query string. This is in reference to the latest version of the plugin, taken from the gi...

C# Parsing Text Within Quotes

I'm developing a simple little search mechanism and I want to allow the user to search for chunks of text with spaces. For example, a user can search for the name of a person: Name: John Smith I then "John Smith".Split(' ') into an array of two elements, {"John","Smith"}. I then return all of the records that match "John" AND "Smith"...

How sort objects parsed from XML..

so I want to parse an xml and display (in a UITableView) the "subjects" in ascending order depending on "lessons" XML: <parfumeo_kkn> <tt_timetable> <id>1015</id> <day>1</day> <class_id>98</class_id> <lesson>9</lesson> <teacher>bt</teacher> <room>V1.2</room> <subject>M</subject> <pr_id>54</pr_id> </tt_ti...

Buildbot parsing Python Unit test results

I have a test suite that outputs test results in the Python Unit Test format: http://docs.python.org/library/unittest.html Is there an existing Buildbot module/plugin that can parse this form? Example: DigitalReadWrite_02 ... ok DigitalReadWrite_03 ... ok...

Parse CFML tags in PHP

Background: I have been running a site on the blogger platform for the past 5 years. I was using the option of hosting the site on my own server, publishing via FTP. My server is running ColdFusion, so I decided to take advantage of that. I created Coldfusion custom tags that provided additional functionality and included those in ma...