parsing

.NET: Why is TryParseExact failing on Hmm and Hmmss?

I'm trying out the DateTime.TryParseExact method, and I have come over a case that I just don't get. I have some formats and some subjects to parse that each should match one of the formats perfectly: var formats = new[] { "%H", "HH", "Hmm", "HHmm", "Hmmss", "HHmmss", }; v...

Is XslCompiledTransform to blame for slow XML transformation for a large file?

I am very new to XSLT, and the first thing that i need to do is parse a 300MB file (and that's on the small end). The XSLT is not that complex for the moment, it's just removing some nodes that match a certain criteria. I have two problems: It's too slow. It takes 50 seconds to process 500,000 records and that's not fast enough. It c...

Remove text from within a database text field

I recently tried to import a bunch of blog posts from an old blog (SharePoint) to my current blog (WordPress). When the import completed, a lot of nasty <div> tags and other HTML made it in to the content of the post, which screwed up the way my site was rendering. I'm able to view the offending rows in the MySQL database and want to k...

bindings not resolving with AST processing in eclipse

Hi everyone, I'm using the eclipse JDT AST parser to process some Java code and am trying to extract the type bindings for fields and method declarations. The logic for doing that is inside my Visitor class (see below). Unfortunately, I'm not having any luck and none of the bindings are resolving (they are consistently null). The intere...

how to parse xml file with attributes?

I want to parse this file in Cocoa Application.but no parser for xml work well.Please help for parsing this file or other xml files like this. Thanks... My Xml File is as Under: Hiren <property id=\"license\"> <object> <property id=\"color\"> <string>red</string> </property> <property id=\"expiresOn\"> ...

Extract data from website via PHP

   I am trying to create a simple alert app for some friends.    Basically i want to be able to extract data "price" and "stock availability" from a webpage like the folowing two: http://www.sparkfun.com/commerce/product_info.php?products_id=5 http://www.sparkfun.com/commerce/product_info.php?products_id=9279     I have made the alert ...

how to remove tags with JavaScript regular expressions

I have a JavaScript string containing HTML like this: <div> <div class="a"> content1 </div> content 2 <div class="a"> <b>content 3</b> </div> </div> and I want to remove the div's of class="a" but leave their content. In Python I would use something like: re.compile('<div class="a">(.*?)</div>', re.DOTALL).sub(r'\1', html) ...

Cannot prettify scraped html in BeautifulSoup

I have a small script that use urllib2 to get the contents of a site, find all the link tags, appends a small piece of HTML in on the top and bottom, and then I try to prettify it. It keeps returning TypeError: sequence item 1: expected string, Tag found. I have looked around, can't really find the issue. As always, any help, much apprec...

xmlElement parser need in c#

I need to simple xml parser like below. xmlNode root=xmlDoc.DocumentElement; root.appendChild(xmlElement.Parse("<book name='ff'>sample </book>"); is there any parser library or extension method like this .Parse("<book name='ff'>sample </book>") ...

Resources for extending and enhancing Eclipse CDT C++ Support

Where are good and current resources for anyone hacking on the CDT (C/C++ development toolkit) for Eclipse? In particular, I would like to know more about the internal architecture and structure of the C++ parser, and how the AST, DOM, PDOM, Models, and UI interrelate and interact. My interest is in adding support for extensions to C++ t...

VB6: alternative to the HTML Object Library (for parsing HTML)

hi all, i've been using the html object library for a while for parsing html. the library itself works perfectly, the only problem is that loading/initializing html using createDocumentFromUrl (even if it's a small file) takes much too long. does anyone know an alternative component? thx ...

Parsing text with Javascript

I'm trying to use Javascript to parse text that has been entered in a text box - which would combine a variety of user-generated variables to create random activities. This might make more sense looking at the example. Some example input might be: Activity @Home @Out @Home Read @book for @time Clean up @room for @time @Out Eat at at...

SSIS parsing of an irregular flat file?

I'm pretty familiar with SSIS parsing of regular delimited text data files, however, I'm looking for some advice on an approach to tackle a file that looks like this test file: ISA*00* *00* *01*220220220 *ZZ*RL CODE 01*060327*1212*U*00300*000008859*0*P*:~ GS*RA*CPA-BPT*LOCALUTILITY*060319*1212*970819003*X*003030~ ST*820*000000001~ BPR*C...

Could somebody tell me why json2.js cannot parse this string?

I am trying to convert a pretty complicated JSON string with json2.js from json.org and I keep receiving a parse error. Unfortunately I can't figure out which character it is complaining about or if I missed an escape somewhere. At this point it would be great if I could get a second pair of eyes on it. Thanks to all who help! var js...

Parsing dirty HTML on iPhone

Hi! I already searched a long time for a good solution, but I can't find anything that fits my needs... I want to parse an HTML file and display its content in a table. Everything is almost like writing yet another RSS feed reader. Doing that by parsing valid XML files is simple and straight forward using NSXMLParser or TouchXML or lib...

How can I write a quick and dirty interpreter?

I have an interview where one of the areas I was told I might brush up on is "dynamic programming languages". So I figured I might spend this weekend writing one to bring as sample code. :-) Of course, given the time constraints, I plan on writing something very basic and preferably using a language and/or toolset that will make it ex...

Parsing Json Feeds with google Gson

I would like to know how to parse a json feed by items, eg. url / title / description for each item. I have had a look to the doc / api but, it didn't help me. This is what I got so far import com.google.gson.Gson; import com.google.gson.JsonObject; public class ImportSources extends Job { public void doJob() throws IOException { ...

Tips on how to parse custom file format

Hello, Sorry about the vague title, but I really don't know how to describe this problem concisely. I've created a (more or less) simple domain-specific language that I will to use to specify what validation rules to apply to different entities (generally forms submitted from a web page). I've included a sample at the bottom of this po...

xml parsing problem in iPhone

Hello, I have this xml feed in Chinese, which NSXLParsers is unable to parse. It gives error 31 while parsing. error 31 occur due to Document encoding is unknown. I tried UTF-8 and ascii encodings to convert string rendered via [NSString stringwithContentsOfURL:@"http://news.baidu.com/n?cmd=4&amp;class=finannews&amp;tn=rss"] to ...

Parse bignum into list of 16-bit integers

Hello, I have to implement some bignum arithmetics. The number has to be split into a list of 16 bit integers. That is not the problem. The problem is to parse a string into this notation. If it would be a single integer, i would go through the string backwards, get the number out of the char and would add <number>*10^stringposition. (...