parsing

How do you actually parse values in YAML in Java?

I have a YAML file that I'm using as sort of a config file. It ooks like this, tests: - category: some_category test: - name: hello key1: value1 key2: value2 - name: hithere key1: value1 key2: value2 I want to do something like this: for all tests as test:...

Best method for converting only the integer portion of a string.

In .NET the Integer Parse methods are useful for converting a string to an int, but the string must be a valid integer without any extra characters. Is there a function that will convert the integer portion of a string to an int and ignore everything else in the input string? I'm looking for something like this: int x = ConvertFunction...

XML Parse with selected row data in table view

Hi, I have a problem about xml parsing. I parsed an xml that holds gas stations information. Each station has city, county, name and location informations. First, I add city names array in my table view. Question 1= When user selects a city name, How can I get county's in that city from my xml. (I don't want to get more than one co...

Content is not allowed in prolog.

i'm trying to convert xml to html using xslt. Am using java.xml.transform to do this in java. it was working fine until i bumped into some xml. it said the following error. [Fatal Error] :1:1: Content is not allowed in prolog. javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerConfigurationException: ...

Sql Parser in C# for syntax check Oracle statements

I want to parse the SQL code of a file .sql using C#. I want determinate Syntax Check of a file sql, specifically Insert, Update and Delete statements. Specifically is there any parser freely available which can parse the SQL code in C# .NET ? better is freeware, source code included, and easy use. I use Oracle ...

Parsing Text Between Two Empty XML Elements in Objective C

I already know how to parse XML Elements that contain content (<this> Content </this> in Objective C but I am currently using a web service that returns the content I need in between two closed elements (<begin-paragraph/> The content I need <end-paragraph/>) I have been looking online for any examples of anyone else doing this, but I c...

How to find the HTTP links in HTML mail using regular expressions in JavaScript

Hi I am working on mail client application. I want to show all HTTP links as clickable hyper links. I have noticed that some clients are sending HTTP links without enclosing them inside the anchor tags. In this case I am failing to show those links as clickable links. My requirement is to find all HTTP links in a HTML mail and need...

How to extract and save/read XML email attachment from stdin pipe?

I have an email address piped to a php script which can catch the inbound data. The thing I need out of the email is the XML that is attached. I need to extract the XML attachment into a variable so I can parse it and do stuff with it. I have the parsing routine down without an issue since I use it now fopen'ing data that I get using ...

Best way to parse a large floating point file stored in ascii?

What would be the fastest way to do it? I remember someone telling me using ifstream was bad because it worked on a small number of bytes, and it would be better to just read the file into memory first. Can anyone confirm this? Thanks Edit: I am running on windows, and the file format is for a point cloud that is stored in rows like ...

When is it practical to use a parser generator?

I'm writing a simple text-template language for a web application I'm writing (think google's ctemplate). When finished, it'll feature only a small number of possible actions, simple stuff like "evaluate and execute", "evaluate and print", "evaluate and escape html", "comment". I was thinking of hand writing the whole parser from scratch...

Rails XML parsing...

Can anybody tell me how to parse this on rails. <?xml version="1.0" encoding="utf-8"?> <message> <param> <name>messageType</name> <value>SMS</value> </param> <param> <name>id</name> <value>xxxxxxxxxxxxxx</value> </param> <param> <name>source</name> <value>xxxxxxxxxxx</value> </param> <param> <na...

Xml document to DOM object using DocumentBuilderFactory

Hi, I am currently modifying a piece of code and I am wondering if the way the XML is formatted (tabs and spacing) will affect the way in which it is parsed into the DocumentBuilderFactory class. In essence the question is...can I pass a big long string with no spacing into the DocumentBuilderFactory or does it need to be formatted in ...

Date/Time parsing in C++ (Any format string to Epoch)

I am writing a C++ app that has to parse a date/time string and give out epoch time. But the format of the date/time string can be more than one (actually say 25 formats) like "EEE, dd MMM yyyy HH:mm:ss '('ZZZ')'", "EEE, dd MMM yyyy HH:mm:ss '\"'ZZZ'\"'", "EEE, dd MMM yyyy hh:mm:ss z", "EEE, dd MMM yyyy HH:mm Z", "E...

Simplify PHP DOM XML parsing - how?

Hi coders! I've spent whole days with PHP's DOM functions but i can't understand how it works yet. :( I have a simple XML file that looks okay but i cannot use it how i think when i've created it's structure. Sample XML fragment: -pages //root element -page id="1" //we can have any number of pages -product id="364826" //we...

Parsing, Handling and Using very large XML files

Hello, I'd like to create a program that generates content from very large XML files, upwards of 500mb in size. I'll need to get data from the files at various times, but the user is willing to wait for a bit, and it's all done on the local machine. I was womdering if anyone had any advice regarding: Implementation languages Whether x...

Hex dump parsing in perl

I have a hex dump of a message in a file which i want to get it in an array so i can perform the decoding logic on it. I was wondering if that was a easier way to parse a message which looks like this. 37 39 30 35 32 34 35 34 3B 32 31 36 39 33 34 35 3B 32 31 36 39 33 34 36 00 00 01 08 40 00 00 15 6C 71 34 34 73 69 6D 31 5F 33 30 ...

how to parse this text in c#

abc = tamaz feeo maa roo key gaera porla Xyz = gippaza eka jaguar ammaz te sanna. i want to make a struct public struct word { public string Word; public string Definition; } how i can parse them and make a list of <word> in c#. how i can parse it in c# thanks for help but it is a text and it is not sure that a line or more so...

Any parsers for RFC documents?

RFCs (http://www.ietf.org/rfc.html) are usually published as text files. Are there any other formats, which would make parsing the RFC content easier? Are there any parsers for the widely used RFC text documents? ...

Date/Time parsing in C++

While doing the data/time parsing in c++ (converting a string in any format to a date), i found the following useful methods 1) strptime() - here the %d, %m etc can have either 1 or 2 characters. The function will take care of that. As a result of this it will enforce that we use a separator between two conversion specifiers. Ex: Its n...

Can I reliably use the value os.version to determine the Linux distro?

I'm parsing customer logs, I need to want to figure out which distro they are running. I can't run commands on their systems, all I have is the logs. The property os.name always returns, Linux, but the os.version returns what appears to be the kernel version? For instance, 2.6.9-42.0.3.ELsmp or 2.6.5-7.283-smp. After some google is app...