parsing

Verifying a C# string as a valid XML Schema anyURI

Is there a better way to verify that a C# string is a valid xs:anyURI than the following? public bool VerifyAnyURI(string anyUriValue) { bool result = false; try { SoapAnyUri anyUri = new SoapAnyUri(anyUriValue); result = true; } catch (Exception) { } return result; } This constructor d...

Getting text values from XML in Python

from xml.dom.minidom import parseString dom = parseString(data) data = dom.getElementsByTagName('data') the 'data' variable returns as an element object but I cant for the life of me see in the documentation to grab the text value of the element. For example: <something><data>I WANT THIS</data></something> Anyone have any ideas? ...

Get Elements By Attributes

Hi people, i will be short. As far as i know watir library provides two methods for getting html elements. Almost for each element (div, button, table, li, etc) watir provides two methods: . One is the 'singular' method which gets only one specific element. For example: watir_instance.div(:id,'my_div_id') watir_instance.link(:href,'m...

iphone sdk - XML parseErrorOccurred: how to get rid of the illegal charaters when parsing in XML?

When pasrsing XML using NSXMLParser, I encountered this problem when the parser received some characters that it couldn't take such as: the auto-correct "..." or "--" in MSWord. My app reads XML which is exported out of my database from a PHP file. I wonder if I should handle this on the server side or on the iPhone SDK and How? any he...

Is adding nowiki-tags to this parser feasible?

Update: for the record, here's the implementation I ended up using. Here's a trimmed down version of a parser I'm working on. There's still some code, but it should be quite easy to grasp the basic concepts of this parser. class Markup def initialize(markup) @markup = markup end def to_html @html ||= @markup.split(/(\r\n...

best C++ command line argument parser

Possible Duplicates: What parameter parser libraries are there for C++? C++ Parse Command Line Arguments What is the best C++ command line argument parser that you can suggest? ...

How to parse/leach/extract a ASP.net website Content using Ruby or PHP or Java?

Hi , I am doing a hobby project to scrape the content of an ASP.net website using Ruby or PHP or Java . For example if the website url " www.myaspnet.com/home.aspx" . i would like to extract the unicode text content from home.aspx and paste it to a notepad . Is there any libraries available in any of the above mentioned languages ...

Parser for query filter expression tree

Hi I am looking for a parser that can operate on a query filter. However, I'm not quite sure of the terminology so it's proving hard work. I hope that someone can help me. I've read about 'Recursive descent parsers' but I wonder if these are for full-blown language parsers rather than the logical expression evaluation that I'm looking f...

Parsing XML using PHP - Which includes ampersands and other characters

Hiya, I'm trying to parse an XML file and one of the fields looks like the following: <link>http://foo.com/this-platform/scripts/click.php?var_a=a&amp;var_b=b&amp;varc=http%3A%2F%2Fwww.foo.com%2Fthis-section-here%2Fperf%2F229408%3Fvalue%3D0222%26some_variable%3Dmeee&lt;/link&gt; This seems to break the parser. i think it might be so...

Parsing through XML returned by web service with jQuery

I'm trying to parse an XML file returned by a webservice with jQuery. Here is the code I have set up, but nothing seems to happen. $.ajax({ type: 'GET', url: 'http://www.sample.com/webservice', dataType: 'xml', success: function(xml){ console.log(xml); $(xml).find('movies').each(function(){ $(this).find('movie').each(function...

Remove Whitespace From XML Nodes

How can I remove whitespace on every instance of a particular node which I specify in C#? For example let's say that I have the following XML document: <XML_Doc> <Record_1> <Name>Bob</Name> <ID_Number>12345</ID_Number> <Sample> </Sample> </Record_1> <Record_2> <Name>John</Name> <ID_Number>54321</ID_...

How to write an ANTLR parser for JSP/ASP/PHP like languages?

I am new to parser generators and I am wondering how the ANTLR grammar for an embedded language like JSP/ASP/PHP might look like, but unfortunately the ANTLR site doesn't provide any such grammar files. More precisely I don't know exactly how to define an AnyText token which matches everything (including keywords which aren't having any...

How can I find the index of the first "element" in my string using Java?

I'm working on writing a simple Prolog interpreter in Java. How can I find the last character index of the first element either the head element or the tail element of a string in "List Syntax"? List Syntax looks like: (X) (p a b) (func (func2 a) (func3 X Y)) (equal eve (mother cain)) The head for each of those strings in...

Excel: Removing duplicates in one column while retaining highest value in the adjacent column.

I have an excel spreadsheet with two columns. The first column is a label the second column is a numeric value. I would like to remove all the duplicate labels in column "A" and remain with the maximun numeric value in column "B". I've tried to illustrate below (the filter would result in "Consolidated Sheet" given "Original Sheet": NOT...

Parsing file in C++

I have some string data in the following format: "Ronit","abc""defgh","abcdef,"fdfd", Can somebody suggest some good code in C++ to return the comma-separated tokens, when the commas are not inside a string? I.e. it should return "Ronit" "abc""defgh" "abcdef,"fdfd" to be more clear Thanks all of you for kind help. Below is my sam...

Why does this jQuery fail to load/parse my HTML string?

jQuery.get(window.location.href, function(data) { alert(data); alert($(data).html()); }); The first popup is all the HTML good and healthy. The second popup is blank. Why? (the HTML is XHTML compliant) ...

Parser/Lexer ignoring incomplete grammar rules

I have a parser and lexer written in ocamlyacc and ocamllex. If the file to parse ends prematurely, as in I forget a semicolon at the end of a line, the application doesn't raise a syntax error. I realize it's because I'm raising and catching EOF and that is making the lexer ignore the unfinished rule, but how should I be doing this to r...

Java math expression parser that can take complex numbers as a variable?

I am writing a program in Processing that transforms complex numbers. However, I want to have a method of taking an input string and calculating the transformation using a complex variable. For example: 1/(z+1) (z^2)/(z/2) where z is a complex number. Now, I've looked at JEP and some examples, but I cannot work out if it would allow y...

Parsing curl response

i'm using curl to retrieve a page which has a table structure as below. ... <tr> <td> <table>table1</table> <table>table2</table> .................... <table>table25</table> </td> </tr> .... i need the data in table table1 to table 25. How to parse it to ...

How to 'subtract' lexer rules in ANTLR?

Let's say I have two rules like the below: printable_characters : '\u0020' .. '\uFFEF' ; newline_characters : '\n' | '\r' ; Now let's say that I want to make a new rule called printable_no_newlines. I would like to do this by subtracting newline_characters from printable_characters like so: printable_no_newlines : printable_charact...