parsing

Parse CDATA content in Ruby on Rails

Hi, I am new to rails. Could you help me with a good tutorial on how to parse CDATA content in ruby on rails. I have learnt to use Feed-zirra to parse the content but I am not able to parse content from the websites which use CDATA. If it is not possible to do it with feed-zirra could you help me with alternatives. Looking forward f...

techniques for parsing interactive input(like a shell)?

I'm working on a program that can be used directly from the command line with options and input files, or entirely interactively like a shell. For the initial execution I'm using GNU's Getopt to parse the command line options. When being used on a file I'm using Flex and Bison. This simplifies the parsing greatly since the grammar is ve...

Parse all stored procedures in a database

Does anyone know of a way to verify the correctness of the queries in all stored procedures in a database? I'm thinking of the scenario where if you modify something in a code file, simply doing a rebuild would show you compilation errors that point you to places where you need to fix things. In a database scenario, say if you modify a t...

EasyWSDL can't read files (from filesystem )

Hi I'm trying to use EasyWSDL but I can't read any file from the filesystem. WSDLReader reader = WSDLFactory.newInstance().newWSDLReader(); Description desc = reader.read(???????); Any ideas? ...

easy way to determine if a string CAN'T be a valid regex

I have a config file that the user can specify sections, and then within those section they can specify regular expressions. I have to parse this config file and separate the regex's into the various sections. Is there an easy way to delimitate a regex from a section header? I was thinking just the standard [section] regex1 regex2 B...

python's mechanize wont properly parse a form

I'm trying to submit a form using python's mechanize but it wont properly parse the form in question. There are 4 other forms, which are parsed correctly except for this one form. The form is properly parsed in perl's www::mechanize though but i'd like to stick with python. Is there anyway of retrieving the html of the page and editing...

Help with parsing / tranversing XML in JavaScript?

Hi. I need a little direction on how to parse this in JavaScript. I want to list the total number of buildings and in each building, the total number of tenants. My XML looks like this: <?xml version="1.0" encoding="UTF-8"?> <AppManager-response uri="/AppManager/xml/ListBuildings"> <result> <response method="ListBuildings...

How to parse a string in Java? Is in Java anything similar to re.finditer() in Python?

Hi, I have an input string with a very simple pattern - capital letter, integer, capital letter, integer, ... and I would like to separate each capital letter and each integer. I have been dealing with it for quite a while and can't figure out what is the best way to do that in Java, I have already tried regexp using Pattern and Match...

iPhone: Parsing large xml files and adding the content to the sqlite db

I'm using libxml2′s DOM parser in my iPhone to parse a XML file with 100'000 lines and put the content into a db! This process takes several minutes to complete! Too much to be user friendly! Im looking now for any hints on how to make this process more efficient! I guess, that the biggest part of the time gets lost writing the data into...

find all occurrences of 'can be interpreted as time'

Is there an efficient way to search a message for substrings which might represent a time? For example, this message: let's meet tomorrow at 14:30 or do you prefer 2:30pm? should return ('14:30', '2:30pm'). Finding hh:mm times can be easily achieved using a simple regex, but I'm wondering if there are existing solutions to find mo...

How should I read in data from a text file using .NET, with a TWIST!

Hi folks, Yes, this might sound like a newbie question but there's a TWIST! (And i've done an SO search already...) I'm trying to read in multiple files, one at a time ... while each file is possibly getting new data APPENDED to the end of it. I always know the last character position i was last at. So when I get to a file, I'm think...

Cast versus parse

I've read a few related questions regarding this topic however none of them are making sense to me. As I understand it, in some cases you can use cast and parse interchangeably and achieve the same result. Are there some general guidelines that can help me decide when to choose one approach over the other? ...

Safe String to BigDecimal conversion

I'm trying to read some BigDecimal values from the string. Let's say I have this String: "1,000,000,000.999999999999999" and I want to get a BigDecimal out of it. What is the way to do it? First of all, I don't like the solutions using string replaces (replacing commas etc.). I think there should be some neat formatter to do that job fo...

How to make the SAX Parser wait for a file to finish downloading before it is parsed?

I am having a problem where my XML files are slow to load and don't finish downloading before they start to be parsed which throws an xml not well formatted exception from my parser showing that the file downloaded incompletely. The complete error from logcat is "ERROR/Error(323): errororg.apache.harmony.xml.ExpatParser$ParseException: ...

Is there a publicly available piece of Coldfusion code that will reliably convert e-mail "source code" into plain text?

I'm modifying the Coldfusion-based interface for a listserv admin application to show snippits of recently-posted messages on a page. The messages are all stored in a SQL Server 2005 database on the listserv's mail server, and in theory it should be easy enough to query the recent ones and display them. However, the "message" column of t...

UIImageView and XML Parsed Data

Hello people that are way smarter than me, I got two xml elements, one is title and the other URL of image. I am trying to show both the UILabel and UIImageView. My problem is the image not showing up. Here is what I have done so far... If I pass _track.consultant_pic into an UILabel I can see the string (http://mysite.com/ted.jpg) in...

Auto Add Google Analytics Code to a HTML page each time the page is rendered

I have a web site hosted on an a Apache web server. Another person uploads static html files to a folder each week via an ftp generated from third party software. I am looking to insert Goggle Analytics code to each page as it is rendered while preserving the URL's, original HTML and process of uploading. I do not know when the files ar...

Parsing Random Web Pages

Hi, I need to parse a bunch of random pages and add them to a DB. I am thinking of using regular expressions but I was wondering if there are any 'special' techniques (other than looking for content between known text/tags). The content is more(not always) like: Some Title Text related to Title I guess I don't need to extract complet...

How to parse larger XML file with limited resources?

Possible Duplicate: Parsing Huge XML Files in PHP I am trying to parse a 70Mb XML file under PHP. After a while the resources are not enough and the script crashes. If there is a larger XML file it ends sooner. I can't change the memory limit of the server and of PHP. What can I do to parse large files? The file size can var...

Removing incomplete P Tags (using REGEX or any other method)

hi, my problems is a bit case specific , first of all, Its only for <p>tags not for any other tag.So you need not worry about any other tag. I am having html document which is a output of one software ,but it has some errors like unclosed <p> tags. eg. I have taken all document in a string my document is like .. <html> .....