parsing

Parsing Dates and Times from Strings using python

I'm using python, and want to parsing a string like "01-Jan-1995" to datetime type of python. who can tell me how to do it? thanks. ...

Prolog parse postfix math expressions

I solved this my self. I'll post the solution when were past due date for my homework. Okay, I'm going to build a parser or an evaluator. The de facto standard when parsing with prefix notation is to just use a stack. Add to the stack if input is a number, if it is an operator you can pop twice apply operator and put the result back on...

Need Help With Java Code...HTML Parser Cannot Be a Resolved Type

Hi, I have this java source code which one of my friend gave me and unfortunately he is away from the country to fix my issue.This code,scrapes the data from the websites and fills the database it self. But previously due to some layout changes in the website,it is not functioning properly.So i am giving a try to recompile it using ecl...

Why does my XSD file fail to parse with XML::LibXML?

I am trying to validate an XML against schema using LibXML::Schema Validator CPAN module. In that same script am using XML::DOM CPAN module to parse the XML. I want my script to take XML file validate it against XSD and parse it. When I try to run the script, after validating against xsd it exits and does not parse XML. I want it parse...

Best approach to parse text files that contain multiple types of delimiters?

I need to parse some text files that have different types of delimiters (tildes, spaces, commas, pipes, caret characters). There is also a different order of elements depending on what the delimiter is, e.g: comma: A, B, C, D, E caret: B, C, A, E, D tilde: C, A, B, D, E The delimiter is the same within the file but different from one...

Parsing people's first and last name in Python...

Thanks so much everyone who helped! So basically I need to parse a name and find the following info: First Name First Initial (if employee has initials for a first name like D.J., use both initials) Last Name (include if employee has a suffix such as Jr. or III.) So here's the interface I'm working with: Input: names = ["D.J. Ri...

Help required on Inner XML parsing using W3C DOM

I want to parse an XML alongwith the inner XML. I will explain the same with an example: <convert from="deg C" to="DegF"> <function name="add"> <function name="multiply"> <function name="divide"> <param value="9"/> <param value="5"/> </function> <input id="deg C"/> </function> ...

JavaCC Problem - Generated code doesn't find all parse errors

Just started with JavaCC. But I have a strange behaviour with it. I want to verify input int the form of tokens (letters and numbers) wich are concatenated with signs (+, -, /) and wich can contain parenthesis. I hope that was understandable :) In the main method is a string, which should produce an error, because it has one opening but...

How can I parse XML using Java?

<?xml version="1.0" ?> <input> <sys> <protocol>TL1</protocol> <ipAddress>10.05.2.3</ipAddress> <port>2001</port> <prompt>agent</prompt> <TL1Command> <type>get</type> <command_code>...........</command_code> <staging_block> <tid>...........<...

Tolerating malformed statements with ANTLR (e.g., for code-completion)

I have an ANTLR grammar for a simple DSL, and everything works swimmingly when there are no syntax errors. Now, however, I need to support an auto-completion mechanism, where I need to get possible completions from my tree grammars that perform basic type-checking on attributes, functions, etc. The problem is, ANTLR isn't reporting syn...

Search for base64 encoded content in StreamReader?

I need to parse a NDR file from an SMTP badmail folder from IIS. Attached to the NDR is the content which is base64 encoded. That is what I need to get to. I was hoping that, using a StreamReader, it would be all one line, but they are separate lines when a perforam a .ReadLine. Here is a sample of an NDR: From: postmaster To: hidden...

Parsing a date in Java?

I have dates in text format of the form dd-mmm-yy or d-mmm-y, where months are abbreviations in letters (for example, 4-Nov-09 or 12-Dec-05, etc...) I would like to parse it to produce a java.util.Date object. Could this be achieved by leveraging the java.text.DateFormat class? Or is there another easy way of doing this? ...

XML parsing with java dom parser converts xml declaration into elements

Here is the xml file that I need to process as part of my assignment. <?xml-stylesheet type="text/xsl" href="people.xsl"?> <People> <Person> `...` </Person> `...` </People> I am using the "javax.xml.parsers.DocumentBuilderFactory" to create a dom parser. After parsing, the resultant document does not have People at t...

Ruby parser in Java

The project I'm doing is written in Java and parsers source code files. (Java src up to now). Now I'd like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses Ruby source code. The only thing I have been able to find up to now are Ruby parsers in Ruby (ParseTree and RubyParser...). I could maybe ...

regarding xml parser....

what is an xml parser? how many types of parsers are there? which is the best xml parser to parse an xml document? how does an xml parser will work? can any one tell it briefly? ...

XML DOM parsing br tag

Hi, I need to parse a xml string to obtain the xml DOM, the problem I'm facing is with the self closing html tag like <br /> giving me the error of Tag mismatch expected </br>. I'm aware this can be overcome by using <br></br> instead of <br /> in the string, but is there a way this can be done without making the above change. please ...

Using Scala, how does one differentiate XML elements having elements as children, or having text?

I'm parsing some xml, and given a particular node, I'm trying to figure out which one of these it is: An element with nested elements <theElement><nestedElement>foobar</nestedElement></theElement> An element with text/data in it <theElement>foobar</theElement> I've tried checking the length of Node.text, but Node.text returns "foob...

How to get instance from string in C#?

Is it possible to get the property of a class from string and then set a value? Example: string s = "label1.text"; string value = "new value"; label1.text = value; <--and some code that makes this How to do this? ...

Is it possible to get the size of a Flash video [YouTube] using JavaScript?

I would like to know the size of the movie I am watching on any video site [ if not possible on all video sites, then at least on YouTube ]. So is it possible, say I will specify the complete path like: 'http://www.youtube.com/watch?v=7xyuX7u-Xts' , to calculate the size of the Flash video (.flv) using JavaScript? Note *By saying size I...

shift/reduce conflicts yacc

see the following code for yacc. if i remove the production factor : '!' expr, the parsing conflict disappears. what is happening here? %{ #include <stdio.h> #include <ctype.h> %} %token TRUE %token FALSE %% line : line expr '\n' { printf("%d\n", $2); } | line '\n' | ; expr : expr "or" term { printf("expr : expr or term\n...