KBD

Keith Devens .com

Friday, January 9, 2009 Flag waving
Cause she's a better fighter than you are, that's why. She's younger, she's stronger, and she'... – "Frankie Dunn" (Million Dollar Baby)

Archive: November 19, 2001

← November 18, 2001November 20, 2001 →

Daily link icon Monday, November 19, 2001

I think I read this article awhile ago (it came out in February of this year). Functional Programming and XML: "As is all too common in the programming world, much of the XML community has identified itself and all its works with object oriented programming (OOP). While I'm a fan of OOP, it's clear to me that even the best OOP-for-XML techniques aren't a panacea, and, moreover, there is an awful lot of ad hoc "objectification" which tends merely to make our lives more difficult and our programs less clear. This short-sightedness has two negative consequences: it tends to limit the techniques and tools we use, and it tends to restrict our understanding."

I wonder if the problem I spent hours solving over the past day or so could have been solved much more elegantly with a functional language... grr... I have no other geeky friends to talk to about this stuff.

Ok, I don't know if this exists for XML. It seems like a very simple and obvious utility. Someone must have written it before, but I don't know why, if it exists, it's not in more common use.

Basically, I want something that'll suck in an XML file and stick it in my programming language of choice's data structures. I want to suck in an XML file into a Perl hash, a Python dict, a PHP array, a REBOL block (or hash), a C++ map, whatever the heck Java has, etc.

Obviously this wouldn't work for every application, but just like in Perl I can say <code>$file = <FILE></code>, in Python I can say <code>file = fp.readlines()</code>, in PHP I can say $file = file("filename.txt"), etc. to read an entire file (as an array of lines) into memory, I'd like to be able to read an XML file into memory. If it doesn't already exist I'm going to write it one of these days.

Oh, and of course... it naturally follows that I'd want something to serialize a data structure out to XML in the first place.

Well, I just got out my Data Munging With Perl book (great book, by the way), and it turns out XML::Parser in "tree" mode will do what I want.

XML.com: Building XML-RPC Clients in C: "'*When It Absolutely Has to Be in C*'" - "XML-RPC is a wire protocol that describes an XML serialization format that clients and servers use to pass remote procedure calls to each other ... In high-level languages like Perl or Python, development can be rapid because the compile-run-edit test cycle is almost as fast as opening one's editor. In C, this isn't the case ... XML-RPC is a high-level protocol, it takes a good number of other C libraries to make the magic happen. Remember, even a simple client needs to be able to talk HTTP and parse XML, both of which are far beyond the built-in facilities of C."

This article is an excellent example of why programming should be done in high level languages when possible.

Dude, such a good episode of Angel tonight.

Ok, well I've finally found my first real gripe with PHP. No pointers!! I've been trying to solve a problem without them for a long time now, with no clear end in sight. When I tried to do something sort of like what I'm trying to do now in PHP in Python it just worked how I expected to. I can make it work how I want in Perl too. This is the first time I've ever wanted to say "PHP Sucks" Smiley

Thanks to Cam, I've been introduced to online radio stations. I don't have all my CD's on mp3, and even if I did, it gets old listening to the same music after a while, so usually I do my computing in silence. I would watch my DVDs more as I work, except they take up a lot of screen space. Anyway, I'm now listening to an 80's radio station, and I'm happy. Thanks Cam!

Of course I knew that online radio stations actually existed, but for some reason I never really looked into them. It's great... Men at Work's "Who Can it Be Now" is on now. I don't have Men at Work on CD! BTW, I'm listening to "Radiostorm.com: 80s", according to the description in Winamp's playlist. I got it from Cam's list that I linked to above.

One thing I just realized... the awesome thing about this is that it always shows what song is playing! You never get that on the radio! I never knew that "Pulling Mussels from a Shell" was by Squeeze. Who knew? And did you know that "Cruel Summer" (from Karate Kid) was by Bananarama? What a great song!

← November 18, 2001November 20, 2001 →
January 2009
SunMonTueWedThuFriSat
 123
45678910
11121314151617
18192021222324
25262728293031



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 3 posts

Recent comments XML

The Elegant Universe

Well I have finally found the crazy​guy that preaches useless nonsence​in A...

Joseph Baxter: Jan 7, 11:07pm

I hate Norton Antivirus


SYMANTEC is very​cunning..
Symantec now have a​redeemable cash back offe...

CAN: Jan 4, 6:25pm

Spider solitaire

Hi everyone!

Glad to have found​this site.  I have enjoyed reading​the c...

flwrchld53: Jan 4, 5:30pm

Generated in about 0.169s.

(Used 7 db queries)

mobile phone