parsing

Parsing XML from an HTTPS URL using NSXMLParser?

I'm trying to parse XML directly from an HTTPS URL, as follows: NSString *const URL = @"https://some/HTTPS/url"; NSURL* url = [NSURL URLWithString:URL]; NSXMLParser* parser = [[NSXMLParser alloc] initWithContentsOfURL:url]; [parser setDelegate:self]; [parser parse]; I have the following delegate method for the parser: - (void) parser...

Simple string parsing in Cocoa / Objective-C: parsing a command line into command and arguments.

Here's a piece of code to take a string (either NSString or NSAttributedString) input that represents a command line and parse it into two strings, the command cmd and the arguments args: NSString* cmd = [[input mutableCopy] autorelease]; NSString* args = [[input mutableCopy] autorelease]; NSScanner* scanner = [NSScanner scannerWithStri...

Parsing datetime in Java

I have dates in the format 2008-12-23T00:00:00Z. This look a lot like a ISO 8601 format with a Zulu (UTC) timezone. I though the following code would parse it (using commons-lang) : String pattern = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern(); Date d = DateUtils.parseDate(dateToParse, new String[] { pattern }); If I tak...

Parsers and Compilers for Dummies. Where to start?

This is a good listing, but what is the best one for a complete newb in this area. One for someone coming from a higher level background (VB6,C#,Java,Python) - not to familiar with C or C++. I'm much more interested in hand-written parsing versus Lex/Yacc at this stage. If I had just majored in Computer Science instead of Psychology I m...

Any reason I couldn't create a language supporting infix, postfix, and prefix functions, and more?

I've been mulling over creating a language that would be extremely well suited to creation of DSLs, by allowing definitions of functions that are infix, postfix, prefix, or even consist of multiple words. For example, you could define an infix multiplication operator as follows (where multiply(X,Y) is already defined): a * b => multipl...

Pure Javascript YAML library that supports both dump and load?

Does such a thing exist for YAML (aka YAML)? If this existed at one time, it must have been obliterated because the latest search turned up nada. It looks like there are plenty of implementations that dump from Javascript to YAML output only, but having trouble finding an implementation that supports both dump and load. Is anyone worki...

What parser generator do you recommend

I'm currently shopping for a FOSS parser generator for a project of mine. It has to support either C or C++. I've looked at bison/flex and at boost::spirit. I went from writing my own to spirit to bison to spirit to bison to spirit, each time hit by some feature I found unpleasant. The thing I hate most about bison/flex is that they a...

What's the best way to parse Excel file in Perl?

What's the simplest way to parse an Excel file in Perl? Converting it to a text file would also work. ...

Parsing a File Format

I'm working with Quickbook's IIF file format and I need to write a parser to read and write IIF files and I'm running into some issues reading the files. The files are simple, they're tab deliminated. Every line is either a table definition or a row. Definitions begin with'!' and the table name, and rows begin with just the table name. ...

What are the disadvantages of the Spirit parser-generator framework from boost.org?

In several questions I've seen recommendations for the Spirit parser-generator framework from boost.org, but then in the comments there is grumbling from people using Spirit who are not happy. Will those people please stand forth and explain to the rest of us what are the drawbacks or downsides to using Spirit? ...

A Class File which parses csv and returns a dataSet as a result ASP.Net

I need a CSVParser class file A Class File which parses csv and returns a dataSet as a result ASP.Net ...

How do I split email address/password string in two in Python?

Lets say we have this string: [18] [email protected]:pwd: [email protected] is the email and pwd is the password. Also, lets say we have this variable with a value f = "[18] [email protected]:pwd:" I would like to know if there is a way to make two other variables named var1 and var2, where the var1 variable will take the exact email info...

Python Split String

Lets Say we have Zaptoit:685158:[email protected] How do you split so it only be left 685158:[email protected] ...

C# equivalent of NaN or IsNumeric

This seems like a fairly simple question, and I'm surprised not to have required it before. What is the most efficient way of testing a string input is a numeric (or conversely Not A Number). I guess I can do a Double.Parse or a regex (see below) public static bool IsNumeric(this string value) { return Regex.IsMatch(value, "^\\d+$...

Extracting Path from OpenFileDialog path/filename

I'm writing a little utility that starts with selecting a file, and then I need to select a folder. I'd like to default the folder to where the selected file was. OpenFileDialog.FileName returns the full path & filename - what I want is to obtain just the path portion (sans filename), so I can use that as the initial selected folder ...

How to convert code from C# to PHP

Hello, I have a business logic classes that are written in pure C# (without any specific things from this language) and I would convert this code into PHP. I can write my own parser, but think if I could someone did it before me. Could you please tell me where can I find this kind of converter? Ps. As I've written I use only plain C#...

Unable to parse a DateTime

I'm trying to parse a date/time string using DateTime.ParseExact. It works everywhere, except on one machine - it just will not parse on that machine. The question is: Why? What could be different on that machine so that it will cause this behaviour? Here are some things that I've already looked at: The CultureInfo is passed to DateTi...

How can I extract external referrers from an Apache access log with Perl?

I need some help getting a regex working to parse all referrers from an apache access log file which come from real links offsite and which are valid referrals from real people rather than bots or spiders. I'm working in Perl. This bit of code almost works already [the access log is opened with the filehandle $fh]: my $totalreferals = ...

Chomsky Hierarchy and LL(*) parsers

Hey out there, I want to parse a programming language. I read a lot about formal languages and the Chomsky hierarchy and ANTLR. But I could not find information on how to relate the languages ANTLR v3 as an LL(*) recursive descent parser accepts to the chomsky hierarchy. How do the Chomsky types mix with LL(*)? Any information (online,...

From XML to object

I would like to define an asp.net page from xml, then parse/render it by calling a command name. Just like they do in Flex. Does someone has an idea how to do that? Like for example, from XML: <button onClick="DoJavascript()" text="Submit"/> <gridview ......./> To parse: <asp:button runat="server" onClick="DoJavascript()" text="Subm...