parsing

Best way to parse Java in Java

As the title says, I want to parse some Java source code in Java. I'm pretty sure there are other java libraries that already perform this, but I couldn't find any. ...

How can I use php to parse a date string?

the date stringe is Apr 30, 2010 I want to parse the string into 2010-04-30 using php, how can I achieve this? Thanks!! ...

Best practices retrieving XML/stream from HTTP in Android

Hello everyone, what are the best practices parsing XML from an HTTP resource in Android? I've been using HttpURLConnection to retrieve an InputStream, wrapping it with a BufferedInputStream, and then using SAX to parse the buffered stream. For the most part it works, though I do receive error reports of SocketTimeoutException: The opera...

How do I get 3 lines of text from a paragraph

I'm trying to create an "snippet" from a paragraph. I have a long paragraph of text with a word hilighted in the middle. I want to get the line containing the word before that line and the line after that line. I have the following piece of information: The text (in a string) The lines are deliminated by a NEWLINE character \n I have ...

Markdown implementation in PHP parses text within <a> tags — how does one disable this behavior?

I'm using the Markdown library for PHP by Michel Fortin. I started noticing that it formats the text in tags with markdown rules, like so: http://foo.com/My_Url_With_Underscores essentially becomes: <a href="...">http://foo.com/My&lt;em&gt;Url&lt;/em&gt;With_Underscores&lt;/a&gt; How do I disable that behavior or otherwise prevent...

Parse both symbols . and , as decimal digits delimiter in ASP.NET

I'm writing a banking system and my customer wants support both Russian and American numeric standards in decimal digits delimiter. Respectively . and ,. Now only , works properly. Perhaps because of web server's OS format (Russian is set). String like 2000.00 throws a FormatException: Input string was not in a correct format. H...

Parse string as if it were a querystring in Ruby on Rails

I have a string like this: "foo=bar&bar=foo&hello=hi" Does Ruby on Rails provide methods to parse this as if it is a querystring, so I get a hash like this: { :foo => "bar", :bar => "foo", :hello => "hi" } Or must I write it myself? EDIT Please note that the string above is not a real querystring from a URL, but rathe...

Flash caroussel xml parse html link

Hello I am trying to modify a carousel script I have in flash. Its normal function is making some icons rotate and when clicked they zoom in, fade all others and display a little text. On that text I would like to have a link like a "read more". If I use CDATA it wont display a thing, if I use alt char like &#60;a href=&#34;www.googl...

How to transform huge xml files in java?

As the title says it, I have a huge xml file (GBs) <root> <keep> <stuff> ... </stuff> <morestuff> ... </morestuff> </keep> <discard> <stuff> ... </stuff> <morestuff> ... </morestuff> </discard> </root> and I'd like to transform it into a much smaller one which retains only a few of the elements. My ...

How is parsing phase in a compiler different from a rule engine ?

Hi, I have a rough understanding of how the compilers work (I mean languages, grammars, lexical analysis, parsing etc). The rule engines have various rules and associated action, just like you have rules in the grammars and you can associate actions with them in parser-generator tools like ANTLR. So I am a bit confused on how to diffe...

I need a small parser (jquery) that knows if an input is URL:PORT format

You have a user input string from a textbox for example var strInput = $("#txtBox").val(); strInput has some string now. I need to now if it is of this format: IP:PORT Basically a user can input something like this: http://192.168.300.22:20000 1) Frist part (protocol): http:// always needs to be replaced by: https:// 2) Second part (e...

Partially parse C++ for a domain-specific language

I would like to create a domain specific language as an augmented-C++ language. I will need mostly two types of contructs: Top-level constructs for specialized types or declarations In-code constructs, i.e. to add primitives to make functions calls or idiom easier The language will be used for scientific computing purposes, and will ...

Is there a way to optimise finding text items on a page (not regex)

After seeing several threads rubbishing the regexp method of finding a term to match within an HTML document, I've used the Simple HTML DOM PHP parser (http://simplehtmldom.sourceforge.net/) to get the bits of text I'm after, but I want to know if my code is optimal. It feels like I'm looping too many times. Is there a way to optimise th...

Removing unwanted characters from a string in Python

Hi, I have some strings that I want to delete some unwanted characters from them. For example: Adam'sApple ----> AdamsApple.(case insensitive) Can someone help me, I need the fastest way to do it, cause I have a couple of millions of records that have to be polished. Thanks ...

Translating PHP language file

Hello. I have a language file like this: <?php $lng_imagepath = "images/"; $lng_imageext = "gif"; $lng_characset = "iso-8859-1"; $lng_prefix = "en_"; $lng_tabhome = "Home"; $lng_tabmyavenue = "My Profile"; $lng_tabregister = "Register"; $lng_tabhelp = "Help"; $lng_tabbuybids = "Buy Bids"; ?> ...

Python: Is there a built in package to parse html into dom

I found HTMLParser for sax and xml.minidom for xml. I have a pretty well formed html so I don't need a too strong parser - any suggestions? ...

Parsing large delimited files with dynamic number of columns

Hi, What would be the best approach to parse a delimited file when the columns are unknown before parsing the file? The file format is Rightmove v3 (.blm), the structure looks like this: #HEADER# Version : 3 EOF : '^' EOR : '~' #DEFINITION# AGENT_REF^ADDRESS_1^POSTCODE1^MEDIA_IMAGE_00~ // can be any number of columns #DATA# agent1^the...

Get username from URL in PHP

Hi, i want something like this: http://www.someniceandreliableurl.com/username and catch the username. I want to make something like twitters/facebook/etc quick urls... twitter.com/username How can i make something like this with php? =) thank you in advance. ...

What is the best file format to parse?

Scenario: I'm working on a rails app that will take data entry in the form of uploaded text-based files. I need to parse these files before importing the data. I can choose the file type uploaded to the app; the software (Microsoft Access) used by those uploading has several export options regarding file type. While it may be insignific...

Parsing Serialized JSON DataSet using Jquery

Hello all, and thanks for reading. I wrote a web service which is called through jsonp, and returns a .Net 3.5 DataSet which I then want to parse using jquery. It appears that the getJson() method is working fine as far as parsing the json goes. The following request - $.getJSON("http://localhost:80/ws.asmx/Example?format=...