parsing

Url parsing and simplification in PHP

I'm parsing the links found on webpages, and I'm looking for a way to convert URLs like this: http://www.site.com/./eng/.././disclaimer/index.htm to the equivalent and more correct http://www.site.com/disclaimer/index.htm mainly for avoiding duplicates. Thank you. ...

How do you get PL/SQL to parse XML attributes instead of XML elements in Oracle?

Please see PL/SQL snippets below: create table t23 ( field01 number, field02 number, field03 char(1) ); Example Snippet #1 declare x varchar2(2000) := ' <ArrayOfRecords> <Record> <Field01>130</Field01> <Field02>1700</Field02> <Field03>C</Field03> </Record> <Record> <Field01>131</Field01> <Field02>1701</Field02> <...

Building a "Semi-Natural Language" DSL in Ruby

I'm interested in building a DSL in Ruby for use in parsing microblog updates. Specifically, I thought that I could translate text into a Ruby string in the same way as the Rails gem allows "4.days.ago". I already have regex code that will translate the text @USER_A: give X points to @USER_B for accomplishing some task @USER_B: take Y p...

Regular expression token antlrV3

Can I write a rule where the initial token is partly fixed and partly generic? rule: ID '=' NUMBER ; ID: (A.. Z | a.. Z) + NUMBER: (0 .. 9) + But only if the token ID is in the form var* (var is fixed) Thanks ...

How to implement characters method using SAXParser on Android

I am parsing xml using the SAXParser and want to know if this is the right way to implement the characters method. Assume there's a class-level String variable named elementValue and it is initialized to "" in the startElement method. Here is the characters method: @Override public void characters(char[] ch, int start, int length) { ...

C++ Parse XML Using STD

I'm aware there are several XML libaries out there, but unfortunately, I am unable to use them for a school project I am working on. I have a program that created this XML file. <theKey> <theValue>23432</theValue> </theKey> What I am trying to do is parse out "23432" between the tags. However, there are random tags in the file so ...

iPhone SDK: verify XML before processing it?

Is there a way to verify / validate a remote XML (or download it first and store it locally) before processing it and store the info into CoreData or DB with iPhone SDK 3? ...

What's a good library for parsing mathematical expressions in java?

I'm an Android Developer and as part of my next app I will need to evaluate a large variety of user created mathematical expressions and equations. I am looking for a good java library that is lightweight and can evaluate mathematical expressions using user defined variables and constants, trig and exponential functions, etc. I've look...

JQuery - Fetching a URL that returns 404 on first few fetches, then returns 200

Fetch a URL - mywebiste.com/blah.php --> returns 404 Fetch a URL - mywebsite.com/blah.php --> returns 404 Fetch a URL - mywebsite.com/blah.php --> returns 404 Fetch a URL - mywebsite.com/blah.php --> returns 200 // how do I loop until this the URL returns 200? Previously phrased: So I have a URL (foo) that I need to download after m...

Parsing in Emacs Lisp

Hi, I'm writing a parser in Emacs Lisp. It's a parser for text files looking like this: rule: int: 1, 2, 3, ... string: and, or, then, when text: ---------- Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Pellentesque in tellus. In pharetra consequat augue. In congue. Curabitur pellentesque iaculis eros. Proin m...

Parsing of data structure in a plain text file

How would you parse in Java a structure, similar to this \\Header (name)\\\ 1JohnRide 2MarySwanson 1 password1 2 password2 \\\1 block of data name\\\ 1.ABCD 2.FEGH 3.ZEY \\\2-nd block of data name\\\ 1. 123232aDDF dkfjd ksksd 2. dfdfsf dkfjd .... etc Suppose, it comes from a text buffer (plain file). Each line of text is "...

iPhone SOAP Web Services - Sample code on how to use the parsed code from wsdl2objc?

Hello, Is there any other documentation available at wsdl2objc besides the Usage Instructions?. The documentation is very limited, it may be because I have never used a wsdl parser before, in that case does anyone have any recommending reading for this?. If someone could please provide some sample code or link to a tutorial, on how to ...

Equal (not a token) in an ANTLR grammar. What does this mean?

What does the construct basename = in the following rule? tabname: (ID'.')? basename = ID ; There is this single occurrence of basename in the grammar. Thanks ...

Parse DateTime in c# from strange format

Hi, if i have a datetime string in a weird format, such as YYYY##MM##DD HH**M**SS, how can i create a new datetime object base on that? i have read something about the datetimeformatinfoclass but not sure how to get it working.. ...

Build a natural language model that fixes misspellings.

What are books about how to build a natural language parsing program like this: input: I got to TALL you output: I got to TELL you input: Big RAT box output: Big RED box in: hoo un thum zend three out: one thousand three It must have the language model that allows to predict what words are misspelled ! What are the best books on ...

How to get the POST values from serializeArray in PHP?

Hi, I am trying this new method I've seen serializeArray(). //with ajax var data = $("#form :input").serializeArray(); post_var = {'action': 'process', 'data': data }; $.ajax({.....etc So I get these key value pairs, but how do I access them with PHP? I thought I needed to do this, but it won't work: // in PHP script $data = json_d...

Python-based document metadata parser?

Hi. Does anyone know a good parser for document metadata in python for unix like systems. In Java, apache tika is great. No com ... please :) Thanks ...

Efficiency of stack-based expression evaluation for math parsing

Hello everybody. I have to write, for academic purposes, an application that plots user-input expressions like: f(x) = 1 - exp(3^(5*ln(cosx)) + x) The approach I've chosen to write the parser is to convert the expression in RPN with the Shunting-Yard algorithm, treating primitive functions like "cos" as unary operators. This means the f...

android Sax parsing exception for "»" character

hi friends i'm using Sax parser for parsing my xml file which i recieve from the internet... The problem is that the normal xml is parsed fine except the xml files which have "»" symbol in the attributes... everytime i try parsing the file i get the following error 02-11 16:57:35.547: INFO/System.out(754): org.apache.harmony.xml.Expat...

How to remove all parameters' values from query

I have a number of query strings looks like View.aspx?type=a&boo=bar&i=1 How to remove all parameters' values so it would become View.aspx?type=&boo=&i= For each string set of parameters there is it's own combination of parameters, 2-3 in number. Edit: How to remove all parameters except specific set? ...