parsing

EDI newbie needs advice on selecting a translator

I am trying to import EDI 210 feeds into my web application. The application is installed on Ubuntu linux, so whatever my solution, it can't be some hokey Windoze-only solution. Since my data is flowing in just one direction, I'm looking for a simple translator that will handle the translation of the EDI file into an XML file that I ...

How to parse a YAML file in Ruby

I would like to know how to parse a YAML file with the following contents: --- javascripts: - fo_global: - lazyload-min - holla-min Currently I am trying to parse it this way: @custom_asset_packages_yml = (File.exists?("#{RAILS_ROOT}/config/asset_packages.yml") ? YAML.load_file("#{RAILS_ROOT}/config/asset_packages.yml") : nil) ...

How to convert Illustrator or Inkscape SVG drawings into Raphael.js objects?

I am trying to figure out the best most reliable way to convert my SVG drawings from Illustrator or Inkscape into Raphael.js object code. I suppose I am looking for some type of parser but do not know of any. None are suggested on the Raphael.js site. Any suggestions? ...

parsing the Json Data

Hi Team! Here I am posting my Json Response below: {"ResultSet": {"Result":[ {"Phone":"(650) 473-9999", "Distance":"2.59", "MapUrl":"http://maps.yahoo.com/maps_result?q1=441+Emerson+St+Palo+Alto+CAgid1=28734629", "Categories": {"Category":[ {"content":"Salad Restaurant...

Are there any multipart/form-data parser in C# - (NO ASP)

Hi everybody, I am just trying to write a multipart parser but things getting complicated and want to ask if anyone knows of a ready parser in C#! Just to make clear, I am writing my own "tiny" http server and need to pars multipart form-data too! Thanks in advance, Gohlool ...

reading two integers in one line using C#

i know how to make a console read two integers but each integer by it self like this int a = int.Parse(Console.ReadLine()); int b = int.Parse(Console.ReadLine()); if i entered two numbers, i.e (1 2), the value (1 2), cant be parse to integers what i want is if i entered 1 2 then it will take it as two integers ...

Parse dict of dicts to string

I have a dictionary with following structure : {1: {'message': u'test', 'user': u'user1'}, 2: {'message': u'test2', 'user': u'user2'}} I'd like to create a string containing values from the inner dictionary in this form : string = "<span>test1</span><span>user1</span><br /> <span>test2</span>..." I've tried everything fro...

Can You Use a Single Regular Expression to Parse Function Parameters?

Problem There is a program file that contains the following code snippet at some point in the file. ... food($apples$ , $oranges$ , $pears$ , $tomato$){ ... } ... This function may contain any number of parameters but they must be strings separated by commas. All the parameter strings are lowercase words. I want to be able to pa...

ANTLR match to end of input

I'm trying to match my grammar to an entire string, and have it error out if it cannot consume the entire input. Basically, this pseudo regex: \whitespace* [a-zA-Z]+ [-]? [a-zA-Z]+ \whitespace* $ According to this, EOF should work. So, consider this grammar: start : CHARS EOF ; CHARS : ('a'..'z')+ ; If I set input t...

Splitting strings in a "Google" style way

I am trying to create a function that will split a string into search terms. Using this code will work fine: string TestString = "This is a test"; string[] Terms; Terms = TestString.Split(" "); This will split my string into 4 strings: "This", "is", "a", "test". However I want words that are enclosed in quotes to be treated as one wor...

Using C#, how can I manually validate a html tag?

Hi, I have for example this image tag: <img src="http://... .jpg" al="myImage" hhh="aaa" /> and I mantain, for example, for a generally image tag the list of all valid attributes L1=(alt, src, width, height, align, border, hspace, longdesc, vpace) I am parsing the img tag and I am getting the used attributes like this: L2=(src, a...

How can I parse incomplete XML fragments with Perl's XML::Twig?

I'm trying to extract data from log files in XML format. As these are huge, I am using XML::Twig to extract the relevant data from a buffer instead of the whole file(s) As these are concatenaded data from STDIN, the XML is far from well formed. So frequently the parser stops with an error. How can I get the XML parser to ignore the erro...

parse an rss feed and update/insert/delete rows

Hi all I'm trying to parse multiple RSS feeds and If they change, thus update my records in my MySQL table. Currently, I have a script that inserts items of RSS Feeds (just post in the url in a form and submit). This inserts the following into my table: title, rss_url, description, price, discount, total This all works perfectly well....

Is it possible to use HttpBrowserCapabilities from a c# console application?

I need to parse UserAgent strings from a console app and this seems like a simple way to do it, but I obviously don't have an HttpRequest object and can't seem to make a fake one with a User-Agent header (I get platform not supported exception). Is there any way to do this, or should I start exploring other alternatives to user agent par...

Making a readable xml file for NSXMLParser

Hi, I'm new to xml parsing and am trying to make a file for NSXMLParser to parse. I'd be editing it by hand and have several nested groups, so was looking for advice on how best to approach this. I found that I couldn't just use newlines to cleanly separate my groupings because the newline would find its way into the parsed data. So, ...

Why can't SimpleParse parse this EBNF on Windows

Using SimpleParse on Windows and following the examples at http://simpleparse.sourceforge.net/scanning_with_simpleparse.html, the following error happens: ValueError: Unable to complete parsing of the EBNF SimpleParse has not problem doing the same on Ubuntu Linux. ...

Parsing HTML with Hpricot & Ruby - getting the innermost html?

I'm looking to parse some old html that has plenty of extraneous tags that could be done with CSS now - <b>, <font>, etc. I'm using Hpricot to parse it, but I want to get the innermost "inner_html" - how does one do that with Hpricot? For example lets say I user Hpricot to grab all the <table> elements which I loop through to get the r...

Parsing JSON, not sure on how and when to use iterators (Android Platform)

Hi all, I have this JSON to parse {"files_informations": { "row":{"value":"artist1"}, "row":{"value":"artist2"} } } I would like to know how can I get the first value artist1 and then the second one artist2 This is what I am doing : JSONObject myObject = jObje...

Get URL param/segments conditionally (JS/jQuery)

I'm using an external jQuery url parsing library http://github.com/allmarkedup/jQuery-URL-Parser to grab url segments for GET. The URL's i'm working with include one of two formats: http://example.com/#name or http://example.com/?name=name Depending on the url im getting fed back, I want to use the url parsing library to construct a ...

JSTL - parse not working for elements with namespace

I am trying to parse the following XML using JSTL. I can easily retrieve all the elements in the XML apart from the tags with the "t" prefix, how do I do this? XML looks like (feed.xml) <rss version="2.0" xmlns:t="http://www.xxx.co.uk/xxx"&gt; <channel> <title></title> <link></link> <description></description> <languag...