parsing

I'm trying to figure how to flatten a parenthesized boolean expression into a set of ordered expressions that are logically the same.

So let's say I've got an expression like this: ((((e1) or (e2)) and (e3 or (e5 and e6)) and (e7)) or (e8)) I need to end up with a list of expressions (e1, e2, e3 etc) followed by and/or operators so that evaluating the list from left to right yields the same logical boolean answer. ie e1 or e2 and e5 and e6 or e3 and e7 or e8. But th...

Is there anyway to reset webclient?

Im experiencing problem with webclient to parse some very sensitive webpage. Somehow, webclient failed to do some task, and i dont even know why, no exception, no error, just simple not working (this is not the problem from the site) I run webclient in a loop, however, only the first request was success, all the next requests are failed...

Simple Iphone XML Example

Hi, I a bit overwhelmed with all of the sample code I've seen on the apple dev site. I'm looking for a simple example to show me how to load an xml file from a server into iphone. I would like to read url's from this xml file and load an image. ...

Parse a dhcpd.lease File with Bash

Hi, I Try to parse my dhcpd.lease File with Basel. A typical entry looks like this: lease 192.168.20.4 { starts 6 2009/06/27 00:40:00; ends 6 2009/06/27 12:40:00; hardware ethernet 00:00:00:00:00:00; uid 00:00:00:00:00:00; client-hostname "examle-workstation1"; } All information i get is the MAC and what i want is...

Tips for writing a file parser in Java?

EDIT: I'm mostly parsing "comma-seperated values", fuzzy brought that term to my attention. Interpreting the blocks of CSV are the main question here. I know how to read the file into something like a String[] and some of the basic features of String, but I don't think using methods like contains() and analyzing everything character by...

Selecting an abstract of n words including HTML tags with XSLT

I want to select an abstract, along with HTML format elements using XSLT. Here is an example the XML: <PUBLDES>The <IT>European Journal of Cancer (including EJC Supplements),</IT> is an international comprehensive oncology journal that publishes original research, editorial comments, review articles and news on experimental oncology, ...

Help parsing a page with python

Hi, I would like to parse a webpage to can get the url of the video download. I use python and firebug but I cant get the url link. Example: The url where I have to get the video link is: hxxp://www.rtve.es/mediateca/videos/20100125/saber-comer---salsa-verde-judiones-25-01-10/676590.shtml" The video is hxxp://www.rtve.es/resources/TE...

How to parse an HTML with PHP/ASP.NET?

Hi, The question is not really about parsing the HTML, but rather parsing the HTML and adding elements to the DOM according to the HTML tags. For example - I want to be able to take an HTML page, add attribute to the HTML tags - such as "class='replace'", put some PHP/ASPNET code in the page (make an ASPX page with ASPNET or put some inc...

Workout the string format used for DateTime formatting.

I have a string which represents a DataTime value, and I want to workout what string format was used to create the string. For example - Given "Wednesday 27 Jan 2010" I expect "dddd dd MMM yyyy" - Given "2010 01 27" I expect "yyyy MM dd" Assume that the date is close to DateTime.Now and relates to the CurrentCulture. So given that we h...

ANTLR how to detect rubbish data at end of input

When using grammars written in ANTLR, the parser correctly recognizes data from an input stream, but if I have some rubbish text at the end of the input (which is not supposed to be parsed by the grammar) the parser does not complain. I guess this behavior is all right (I mean the parser did its job and parsed whatever I said it should ...

what is the most elegant way in ruby to remove a parameter from url?

I would like to take out a parameter from url by it's name without knowing if it is the first, middle or last parameter and reassemble url again. I guess it is not that hard to write something on my own using CGI or URI, but I imagine such functionality exists already. Any suggestions? in: http://example.com/path?param1=one&amp;param2=...

Regex DATE format validation on Java

Hello! I'm just wondering if there is a way (maybe with REGEX) to validate that an input on a java desktop app is exactly an string formated as: "YYYY-MM-DD". I've search but with no success. Thank you ...

Parsing All Mail from Mailbox File in Python

Maybe I'm going about this the wrong way, but I want to parse a single "catch all" email inbox via Python. I see the email module and I can make it parse an individual email, but what I want to do is open (for example) /var/spool/mail/catchall and parse all of the individual messages inside it. Opening that file and running the parser ov...

Disable decoding of xml text content

Is it possible to disable decoding xml text content when parsing an xml file using Java? For example so &quot; is returned as is instead of being converted to a quote Effectively want the text content treated as if it was wrapped in a CDATA block ...

PHP Regex: Get info between groups of HTML tags?

I have been programming a word-unscrambler. I need to parse the information between a group of tags and another, and put all matches into an array. The beginning tag is: <tr> <td></td><td><li> and the ending tag is: </li></td> </tr> I know some regular expressions, but I am unfamiliar with PHP. ...

Determining what a word "is" - categorizing a token

Note: Edited for clarification. Clarification: I'm writing a "bridge" between the user and a search engine, not a search engine. Part of my value add will be inferring the intent of a query. The intent of a tracking number, stock symbol, or address is fairly obvious. If I can categorise a query, then I can decide if the user even ne...

How do I get kXML to work?

I'm trying to implement an existing XML parser: kXML. I ran into the following error: java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPullParserException at com.sun.midp.midlet.MIDletState.createMIDlet(+29) at com.sun.midp.midlet.Scheduler.schedule(+52) at com.sun.midp.main.Main.runLocalClass(+28) at com.sun.midp.main.Main.main(...

How to solve this error when using kXML for Midlet (java)

I downloaded kXML and included this in my Build Path (Eclipse). Now I'm running a simple Midlet and I get an error: java.lang.NoClassDefFoundError: org/kxml2/io/KXmlParser at clientlibrary.googlecalendar.TestParser.startApp(+8) at javax.microedition.midlet.MIDletProxy.startApp(+7) at com.sun.midp.midlet.Scheduler.schedule(+270) at ...

Parsing a range of integers in a list

Hey guys! I've just began learning Python and I've ran into a small problem. I need to parse a text file, more specifically an HTML file (but it's syntax is so weird - divs after divs after divs, the result of a Google's 'View as HTML' for a certain PDF i can't seem to extract the text because it has a messy table done in m$ word). Any...

Any Method to remove comment characters from JSON response in XCode?

I am new to JSON. Are there any methods in JSON parser to remove the comment characters from a response. Eg. //{"response":"success"....... its SBJson for iPhone. from http://code.google.com/p/json-framework ...