parsing

Parsing commandline output progression containing carriage returns in real time with python

I am able to transform carriage returns into new lines. The problem however is to get it running in nearly 'real time'. It will be quite stupid looking if progres bar only values are 0 and 100 :-) This code returns output at once: import subprocess p = subprocess.Popen(['mplayer', '/home/user/sample.mkv'], stdout=subprocess.PIPE).comm...

Grab PDF file from website?

I maintain a website showing my university group's publications. I have written a quick and dirty Ruby script to parse a CSV file containing this data (which I grab manually from ISI Web of Science website), and present it in a nice format in HTML. There is no direct link to a PDF file in the CSV file. Instead, there is information whi...

How convert an String to an specific DateTime format in c#?

Hi, How to convert the string "28/09/2009" to DateTime in an specific format? Ex: I want to convert "2009-09-28 17:30:40" to DateTime. I want to convert "28/09/2009 17:30:40" to DateTime. I want to convert "20090928 17:30:40" to DateTime. There is multiples possible formats. I try this: string[] formats = new string[] {"yyyymmdd","y...

Programmatically creating an XML Document using an XSD

Hi I need to create XML documents using built-in java org.w3c.dom or jdom packages conforming to a set of XSD files. The XSD files are similar but not the same. In essence, I need to create the XML file as per the XSD given to me dynamically. What is the best way to do it. I have checked the Validator package, it does not have any fea...

Trouble parsing remote RSS feed using ColdFusion

I'm having a vexing time displaying a remote RSS feed on an intranet site. I'm using the MM_ XSLTransform.cfc version 0.6.2 to pull in the feed and a basic xsl to output. The feed url is www.fedsources.com/FedsourcesNet/RssFeeds/RSS_MarketFlash.aspx. If you open it in a browser, you'll see it appears to be an ordinary RSS feed. But when ...

Looking for a Java User Agent String Parser

Does anyone know of a great library in java for parsing user agent strings? We have written a custom one, but this seems like a common problem for many people. I would guess there is a good library available somewhere. For example, the user agent string... "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.0 (KHTML, like...

Good strategies for REST -> XML -> Core Data -> UITableView?

What are good practices for asynchronously pulling large amounts of XML from a RESTful service into a Core Data store, and from this store, populating a UITableView on the fly? I'm thinking of using libxml2's xmlParseChunk() function to parse chunks of incoming XML and translate a node and its children into the relevant managed objects...

Java + XML Question

Hi everibody. I'm kinda new to this of XML parsing. So I'll appreciate if you can help me with this. I need to extract some data that's inside an XML document whose structure is: <DWDocument DW5BasketFileName="DOCU0001.001"> <FileInfos> <ImageInfos> <ImageInfo id="0,0,0" nPages="0"> <FileInfo fileName="PATH_1" dwFi...

asn.1 parser in C/Python

I am looking for a solution to parse asn.1 spec files and generate a decoder from those. Ideally I would like to work with Python modules, but if nothing is available I would use C/C++ libraries and interface them with Python with the plethora of solutions out there. In the past I have been using pyasn1 and building everything by hand ...

Issue Parsing XML Document using SaxParser - 2047 character limit?

I have created a class that extends the SaxParser DefaultHandler class. My intent is to store the XML input in a series of objects while preserving the data integrity of the original XML data. During testing, I notice that some of the node data was being truncated arbitrarily on input. For example: Input: <temperature>-125</temperatu...

Mozilla Parser for screen scraping

I'm writing an app that takes in HTML code of a page and extracts certain elements (such as tables) of the page and returns the html code for those elements. I'm attempting to do this in java using the Mozilla parser to simplify the navigation through the page, but I'm having trouble extracting the html code needed. Maybe my whole appr...

Parsing numbers from strings in lisp

Here's the brief problem: Input: a list of strings, each containing numbers (" 3.4 5.4 1.2 6.4" "7.8 5.6 4.3" "1.2 3.2 5.4") Output: a list of numbers (3.4 5.4 1.2 6.4 7.8 5.6 4.3 1.2 3.2 5.4) Here's my attempt at coding this: (defun parse-string-to-float (line &optional (start 0)) "Parses a list of floats out of a given string" ...

Is there any python library for parsing dates and times from a natural language?

What I'm looking for is something that can translate 'tomorrow at 6am' or 'next moday at noon' to the appropriate datetime objects. ...

How can I see parse tree, intermediate code, optimization code and assembly code during COMPILATION ?

I am studying Compilers course, compilation of program follows below steps Lexical analysis Syntax analysis Semantic analysis Intermediate code generation Code optimization Target code generation. How can I see output of each step e.g I want to see parse tree after syntax analysis. I am compiling program on Linux machine with GCC co...

Is there a way to parse out HTML Comments on the Server side (PHP or MySQL)

We need a way to remove HTML comments when displayed to the user but not to the developer. I'm wondering what the best way to do this is. ...

How can I parse a HTML string in Java?

Given the string "<table><tr><td>Hello World!</td></tr></table>", what is the (easiest) way to get a DOM Element representing it? ...

Need help for parsing HTML in C#

Hi, For personal use i am trying to parse a little html page that show in a simple grid the result of the french soccer championship. var Url = "http://www.lfp.fr/mobile/ligue1/resultat.asp?code_jr_tr=J01"; WebResponse result = null; WebRequest req = WebRequest.Create(Url); result = req.GetResponse(); Stream ReceiveStream = result.GetR...

Figure out method name from line number in Java?

Given a line number, the code file, as well as the compiled class file if necessary, what is the most elegant way to get the signature of the surrounding method (if the line number is even in a method)? Things to keep in mind: the line might not even be in a method the line might be in a method of an inner or anonymous class While...

Building an XML tree from an Array of "strings/that/are/paths" (in Ruby)

What is the best way to build an XML tree in Ruby if you have an Array of string paths? paths = [ "nodeA1", "nodeA1/nodeB1/nodeC1", "nodeA1/nodeB1/nodeC1/nodeD1/nodeE1", "nodeA1/nodeB1/nodeC2", "nodeA1/nodeB2/nodeC2", "nodeA3/nodeB2/nodeC3" ] xml = <nodeA1> <nodeB1> <nodeC1> <nodeD1> <nodeE1/> <...

Parsing out data using BeautifulSoup in Python

I am attempting to use BeautifulSoup to parse through a DOM tree and extract the names of authors. Below is a snippet of HTML to show the structure of the code I'm going to scrape. <html> <body> <div class="list-authors"> <span class="descriptor">Authors:</span> <a href="/find/astro-ph/1/au:+Lin_D/0/1/0/all/0/1">Dacheng Lin</a>, <a h...