parsing

trouble parsing daylife json with jquery

Does anyone know how I would be able to access the "name", "url", "headline", "timestamp", and "excerpt" from the array "article" using the $.getJSON? http://freeapi.daylife.com/jsonrest/publicapi/4.8/topic_getRelatedArticles?topic_id=&name=business&start_time=2010-06-26&end_time=2010-07-03&sort=date&offset=&lim...

Split string with quotes, reusing method that parses arguments to main

Hi there, in small program I'm writing, I have to parse a line of user input. Basically what needs to be done is to split the line into an array of strings in the same way as is done with the arguments to main(), ie I'm looking for something like this: String[] splitArgs(String cmdLine); I just wonder, if the main methods' arguments ...

Exception while querying HTML for ID using HTML Agility Pack

I'm using the HTML Agility pack to parse an ASPX file inside Visual Studio. I'm searching for an element with a specified ID attribute. The code I'm using is: var html = new HtmlAgilityPack.HtmlDocument(); html.LoadHtml(docText); if (html.DocumentNode != null) { try { var tagsWithId = html.DocumentNode.SelectNodes(...

Using optparse to read in a list from command line options

I am calling a python script with the following command line: myscript.py --myopt="[(5.,5.),(-5.,-5.)]" The question is -- how to convert myopt to a list variable. My solution was to use optparse, treating myopt as a string, and using (options, args) = parser.parse_args() myopt = eval(options.myopt) Now, because I used eval()...

C++ FSM design and ownership

Hi, I would like to implement a FSM/"pushdown automaton" parser for this syntax: http://stackoverflow.com/questions/3025293/c-general-parser-with-scopes-and-conditionals which has already been "lexed" into http://stackoverflow.com/questions/3085070/finite-state-machine-parser I have the following: class State { public: virtual Sta...

Is there a good Javascript based HTML parsing library available?

My goal is to take HTML entered by an end user, remove certain unsafe tags like <script>, and add it to the document. Does anybody know of a good Javascript library to sanitize html? I searched around and found a few online, including John Resig's HTML parser, Erik Arvidsson's simple html parser, and Google's Caja Sanitizer, but I haven...

strip HTML Tags with perl

Whats the easiest way to strip the HTML tags in perl. I am using a regular expression to parse HTML from a URL which works great but how can I strip the HTML tags off? Here is how I am pulling my HTML #!/usr/bin/perl -w use strict; use warnings; use LWP::Simple; my $now_string = localtime; my $html = get("http://www.spc.noaa.gov/clim...

How to traverse through the long string and replace certain block with certain text?

I need to replace <slot> slot_name </slot> with a <?php !include_slot('slot_name')?> in the text that I read from file <table class="layout-table" id="layout1"> <tr> <td class="slot" id="slot1" colspan="2"> <slot> slot_name </slot> </td> </tr> <tr> <td class="sl...

TrueType Font Parsing in C

Hi, I want to read a ttf and draw a text with that font on a buffer. Even though there are libraries such as freetype, gd to do this task, I want to write my own code. Can you advice me on how to accomplish this task? ...

Formula Parser with Brackets

Hi folks, I need to implement a simple formula parser. What I am doing is first create a postfix notation and then evaluating the postfix string. Unfortunately, this algorithm doesn't allow brackets i.e. (2+3)*a. Anyone knows how to extend the algorithm to allow brackets? Thanks in advance, Frank ...

Microsoft Powerpoint Python Parser

I am looking for a python based microsoft office parser - specifically powerpoint. I want to be able to parse PPT in python and extract things like text and images from the powerpoint file. Is there a library available? ...

Visual Studio add-in for C#-development

Hi there. I want to write my first Visual Studio 2010 add-in. My aim is to create an add-in that helps to automatically generate code for things like: implement superclass constructors create delegation methods for composed object etc. Of course, in order to know what to generate, my add-in must have a knowledge of the code-file the...

iphone xml parses text but no images or paragraph spacing

i am trying to parse an xml blog found here: http://www.feed43.com/1515171705611023.xml it has pictures within the text. I am able to parse the headers, the content and the link of the individual posts. I, however, cannot get it to parse the paragraph spacing links within the text or images. all three of these are EXTREMELY important....

Parsing mathml document using JScience

I was trying to parse mathml document using JScience but was not succeed. Following is my piece of code. import JSci.io.*; import JSci.mathml.*; . . public class ParsingMathML(){ try { .... //inputFile is an xml file containing mathml code InputSource file = new InputSource(new FileReader(inputFile)); MathMLPars...

Looking for java html parser like simple html dom in PHP

Hi, I am Looking for java html parser like (I know java well vs my bad php - in this way i want understand how html parser works) simple html dom in PHP. thanks ...

regex to match <Key>....<Value> pattern

I have the following data sent by an external system which needs to be parsed for a particular Key <ContextDetails> <Context><Key>ID</Key><Value>100</Value></Context> <Context><Key>Name</Key><Value>MyName</Value></Context> </ContextDetails> I tried parsing this with the regex to fetch the value for the KEY : Name <Context><Key>Name<...

Complex-ish regex problem

I need to parse out writeln("test"); from a string. I was using (?<type>writeln)\((?<args>[^\)]*)\); as the regex, but this isn't perfect, if you try and parse writeln("heloo :)"); or something similar, the regex won't parse it (because of the ')' in the quotes). Is there a way to register that since the ')' is in the quote marks, the r...

how to implemnt JSON simple parser in c++ ( can't use external libs )

Hi one of my clients want to implement JSON parser and reader in c++ he doesn't want to adopt third party lib. so i like to know where i can find simple implementation of JSON parser so i could adjust it or implement it in c++ Thanks ...

Parsing email messages

I want to extract the body of some email messages. Trouble is the body sometimes contains quoted text which seems to come in different formats. Am I right to think there is no standard when it comes to quoting text in emails? Anyway, any tips on extracting just the message without other things like quoted text, the original sender, the ...

Alternatives to my slow method of using BeautifulSoup and Python to parse Amazon API XML?

As the title says, I'm using the BS module in Python to parse XML pages that I access from the Amazon API (i create the signed url, load it with liburl2, and then parse with BS). It takes about 4 seconds to do two pages, but there has to be a faster way Would PHP be faster? What's making it slow, the BS parsing or the liburl loading? ...