parsing

Reading / parsing email / mail with Java directly from a filesystem in standard RFC mail format

Hello , I want to parse email messages directly from the filesystem using java (1.6) the email messages will be in a filesystem folder like abc-12345.msg qwe-23456.msg and will be in a standard format: for example: MIME-Version: 1.0 Sender: [email protected] Received: by 10.239.173.80 with HTTP; Thu, 12 Aug 2010 11:30:50 -0700 (P...

How to strip HTML from a text property of a Qt4 widget?

What's the easiest way in terms of coding effort, to change a text property of a Qt4 widget, e.g. QLabel.text, so all HTML tags are removed? The HTML is simple, typically just one to three tags like or and their closing partners. ...

Convert XML elements to an array

I have some simple XML which I would like to parse into an array in PHP so that I can build some dynamic SQL inserts. Sample XML: <Data> <Key>1</Key> <Column>Value 1</Column> <Column2>Value 2</Column> </Data> Data will be passed to PHP via http POST. What's the easiest way to do this? There should always be one instance ...

Is there something like Ruby's Treetop for PHP?

Hi, as I wrote a small PHP framework with a DSL parser, and I'm not satisfied with the result, is there any tool like Treetop for PHP? It would lead to far better (and nicer) results. ...

rebol parse problem

simple parse example: ab: charset "ab" parse "aaa" [some ab] ; == true if i wanted one-liner (define ab in place), how do i do it? parse "aaa" [some [charset "ab"]] ; ** Script Error: Invalid argument: ?function? parse "aaa" [some (charset "ab")] ; (INTERPRETER HANGS UP) i use REBOL 2.7.7.4.2 UPDATE in rebol 3: parse "aaa" [s...

Scala: Using StandardTokenParser for parsing hexadecimal numbers

I am using Scala combinatorial parser by extending scala.util.parsing.combinator.syntactical.StandardTokenParser. This class provides following methods def ident : Parser[String] for parsing identifiers and def numericLit : Parser[String] for parsing a number (decimal I suppose) I am using scala.util.parsing.combinator.lexical.Scanner...

How can I find only 'interesting' words from a corpus?

I am parsing sentences. I want to know the relevant content of each sentence, defined loosely as "semi-unique words" in relation to the rest of the corpus. Something similar to Amazon's "statistically improbable phrases", which seem to (often) convey the character of a book through oddball strings of words. My first pass was to start ma...

Parsing and converting 4Test to Perl

I want to convert 4Test scripts to Perl. I have been using the Parse::RecDescent in Perl, but am still overwhelmed at the task. Here is an example. An example of 4Test is something like: ParseSMSPlans (STRING sDir) { STRING sFile; STRING sDirSMSPlan = sDir + "sms_plans\"; STRING sDirPlan = sDir + "plan\"; STRING sDirDeal = sDir + "deal...

How to parse a yaml file into ruby hashs and/or arrays?

I need to load a yaml file into Hash, What should I do? ...

Semicolon as URL query separator

Although it is strongly recommended (W3C source, via Wikipedia) for web servers to support semicolon as a separator of URL query items (in addition to ampersand), it does not seem to be generally followed. For example, compare         http://www.google.com/search?q=nemo&amp;oe=utf-8         http://www.google.com/search?q=nemo;oe=utf...

__decorated__ for python decorators

As of 2.4 (2.6 for classes), python allows you to decorate a function with another function: def d(func): return func @d def test(first): pass It's a convenient syntactic sugar. You can do all sorts of neat stuff with decorators without making a mess. However, if you want to find out the original function that got decorated you hav...

How can I parse a namespace using the SAX parser?

Hello, Using a twitter search URL ie. http://search.twitter.com/search.rss?q=android returns CSS that has an item that looks like: <item> <title>@UberTwiter still waiting for @ubertwitter android app!!!</title> <link>http://twitter.com/meals69/statuses/21158076391&lt;/link&gt; <description>still waiting for an app!...

Parse error: parse error, expecting PHP For Loop

. function is_valid_isbn($isbn) { $isbn_length = strlen($isbn); $isbn_sum = 0; echo "this is the length :"; echo $isbn_length; for($i=0; $i < $isbn_length; $i++) { $total += (substr($isbn, $i, 1) * (11-($i+1))); } return true; } When i run this function i am getting following error can some one help me where is the e...

Can rebol parse function be able to create rules for parsing css2 / css3 fully ?

Are there limitation to rebol parse function power ? Would it be capable of parsing the whole css2 / css 3 spec or will it encounter theorical impossibility to form some rules ? Update after HostileFork answer: I mean in regexp I think it would be rather impossible, is parse much more powerfull ? If yes does it mean it would be possibl...

Can anyone suggest a good PHP parsing class?

I need a class, preferably written in PHP, C#, or Python, that can parse PHP and return a token tree. Can anyone suggest a good, accurate one? ...

java string parsing

Hi All, I am trying to parse the client request and based on strucure trying to form a jTree.Sample request is below- ^class^="Voucher" MSISDN="566773" TopupValue="500" Tax="56" MyOrder={ ^class^="Order" OrderID="221" OrderAddress="Bangalore/KA" OrderDetails="100 boxes" Company_Info={ ^idx^=1 ^class...

Parsing through XML Nodes - Creating an XML Based Scripting Engine

I'm trying to create a 'scripting' engine for my program. As the scripting needs to be cross-platform compatible (it is in VB for now and needs to ported to XNA later). I have sample data posted below. Anyway, within a script you can add graphical objects, play sounds, or perform other actions. Graphical objects have a time, duration,...

Are regular expressions used to build parsers?

This is just a question out of curiosity since I have been needing to get more and more into parsing and using regex lately.. it seems, for questions I come across in my searches regarding parsing of some sort, someone always ends up saying, when asked something relating to regex, "regex isn't good for that, use such and such parser inst...

Objective-C Library for RSS feed parsing?

I'm looking for an Objective-C library for an iOS app that will parse and display articles form an RSS feed. Specifically,m I'm looking to make an app for a news website. The framework should be able to work with various RSS XML structures if possible. (Well, two different news sites. One uses Wordpress-generated RSS and one does not.) ...

parsing the value in between two XML tags

I know this one has been asked before, however I can't seem to find a suitable solution, so I 'll state the problem: I have a string of characters that is similar to an XML file. It's not an XML string, but it has opening and closing tags. All the information resides in one single line, for example: <user>username</username>random data...