parsing

Parse negative numbers from string in perl

How do I parse a negative number from a string in perl? I have this piece of code: print 3 - int("-2"); It gives me 5, but I need to have 3. How do I do it? ...

Looking for unix style 'getopt' command line parsing in a windows/dos batch file

Can anyone help me find something to parse command line args in a dos batch file like one would do in a unix shell script using getopt/getopts? It doesn't have to be all posix-y; just something that I can specify what switches I expect, which of them require/allow an argument. They don't need to be "long" switches; single characters wi...

Parsing latex-like language in Java

I'm trying to write a parser in Java for a simple language similar to Latex, i.e. it contains lots of unstructured text with a couple of \commands[with]{some}{parameters} in between. Escape sequences like \\ also have to be taken into account. I've tried to generate a parser for that with JavaCC, but it looks as if compiler-compilers li...

GPX Parser for Java?

Hi are there some Java API for parsing GPX files? I need to parse many GPX files into our own data structure (our own database). Thx 4 help Buju ...

How do I match a word with OMetaJS?

Hi, I've been trying to learn OMeta using OMeta/JS and I seem to be getting stuck on something that should be really straightforward. If I have a grammar ometa L <: Parser { l letter:l -> l } L.match('h', 'l') It produces the expected output h I can also use ometa W1 <: Parser { ls letter*:ls -> ls } W1.matchAll('hi', 'ls') ...

Parsing information from Dentrix desktop application.

Hello guys, My company wants me to parse information stored in Dentrix software and import it into our database. I want to extract appointments information (which I believe reside in APPT.DAT file) through java application, but I am having troubles doing this operation. If anyone has any useful hints on that matter please help me. Reg...

PHP Reading Large Text Files

I'm reading a flie with essentially upwards of ~500,000 lines separated out by | for the columns which I am parsing and trying to insert into the database through the CLI.. Is there a better way to read it in so I can use it? Currently I'm inserting it as : $fd = fopen ($txtFileName, "r"); while (!feof ($fd)) { $buffer = f...

Need help parsing some data in PHP

I need to be able to parse this sort of data in PHP: Acct: 1 email : [email protected] status : online -------------------------------------------------- Acct: 2 email : [email protected] status : banned -------------------------------------------------- Acct: 3 signedupname : SomeUsername ...

Parse exported bookmarks file with ColdFusion

I need to parse a list of bookmarks exported from a browser like Chrome, Firefox and IE. Maybe even google etc. I played around and did something like this reMatchNoCase("(<h3)(.*?)(</dl>)",myfile1) loop. Then I use reMatchNoCase("(<dt[>])(.*?)(</a>)",i) within the h3/dl tags, and then a lot of cleanup, but its really not reliable. The...

Once I have identified the beginning and end parts of a section of an html document using lxml, how do I get everything between them

I am working with some html files. I am trying to figure out a way to consistently get to some text that exists in the documents. I know that the section I want begins with some bolded words and I know that the section ends with other bolded words. bolded_item=atree.cssselect('b') myKeys=[item for item in bolded_items if item.text if...

Should I use regex when trying to write a tokenizer?

I've written a small and simple tokenizer but without use of regular expressions. I starts at first index and iterates through every character until end and creates the required tokens. I showed it to a colleague that said it would've been much simpler to do /that/ with regex without going into any depths. So should I rewrite and e...

Python: parsing XML document while preserving entities

I wanted to ask what known existing Python 2.x libraries there are for parsing an XML document with built-in DTD without automatically expanding the entities. (File in question for those curious: JMdict.) It seems lxml has some option for not parsing the entities, but last I tried, the entities just ended up being converted to blanks. ...

is there a generic Parse() function that will convert a string to any type using parse?

well i want to convert a string to a generic type like int or date or long based on the generic return type basically a function like Parse(String) that returns an item of type T. for example if a int was passed the function should do int.parse internally thanks ...

best way to parse a language that's ALMOST Python?

I'm working on a domain-specific language implemented on top of Python. The grammar is so close to Python's that until now we've just been making a few trivial string transformations and then feeding it into ast. For example, indentation is replaced by #endfor/#endwhile/#endif statements, so we normalize the indentation while it's still ...

Most elegant isNumeric() solution for java

I'm porting a small snippet of PHP code to java right now, and I was relying on the function is_numeric($x) to determine if $x is a number or not. There doesn't seem to be an equivalent function in java, and I'm not satisfied with the current solutions I've found so far. I'm leaning toward the regular expression solution found here: ht...

Java XML Parsing and original byte offsets.

I'd like to parse some well-formed XML into a DOM, but I'd like know the offset of each node's tag in the original media. For example, if I had an XML document with the content something like: <html> <body> <div>text</div> </body> </html> I'd like to know that the node starts at offset 13 in the original media, and (more importantly...

parse json in jquery

$.ajax({ url: 'contact', type: 'post', asynch: 'false', dataType: 'json' , data: "recaptcha_challenge_field=" + $("#recaptcha_challenge_field").val() + "&recaptcha_response_field=" + $("#recaptcha_response_field").val() , success: function(data) { alert(dat...

How to do conditional parsing with fscanf?

Hi there, I have some lines I want to parse from a text file. Some lines start with x and continue with several y:z and others are composed completely of several y:zs, where x,y,z are numbers. I tried following code, but it does not work. The first line also reads in the y in y:z. ... if (fscanf(stream,"%d ",&x)) if else (fscanf(strea...

XML, TypeError: Error #1088: The markup in...

Hey all, Can anyone see whats wrong with either the code to grab the XML or the XML file itself? It looks well formed to me and I don't see the cause of the error: A TypeError has occured: TypeError: Error #1088: The markup in the document following the root element must be well-formed. var file:String = 'config.xml'; var...

jQuery script not working in IE

I have having a problem with a jquery script showing up in every other browser except IE. Below is a very very very simplified version of the script and this wont even show up. Please help Ive been working on this problem for about 2 weeks now <script type="application/javascript"> $.getTime = function(zone, success) ...