You are not logged in.

#1 2009-07-21 05:03:58

tcoffeep
Member
From: Timmins, Ontario
Registered: 2008-11-26
Posts: 99

Advice on a Project I'm Working On

Because you guys are probably the most helpful folk I've met in regards to programming, I have a question.

I am considering undertaking a project in which I take XML from a client program and translate it into proper XML format for another, better-quality client. I'm not sure what's the better language to both parse and translate the XML in. Perl or Python were the only suggestions given by my friends, and I've been tinkering with both but cannot figure out how to implement it properly.

Any ideas?

[ edit ] : I have no qualms in programming in any scripting language, as someone also suggested using Lua, and another suggested Ruby. So pretty much, I have to pick from among the scripting langauges ( and I have no skill with languages like c++ or scheme, so those are out ). I am doing this both as a gift to a community of great people, and as a way to teach myself new things. I hope to hear from you all. smile

Last edited by tcoffeep (2009-07-21 05:05:43)


=============== Read An Essay ===============
   Distro : Funtoo Linux || Kernel : ckernel-2.6.30-gentoo-r5
Processor : Athlon 64 X2 4400+ || RAM : 2GB || HD : 300GB
========================================

Offline

#2 2009-07-21 06:24:32

XFire
Member
From: UK
Registered: 2008-05-11
Posts: 192

Re: Advice on a Project I'm Working On

Well, I am bias towards Lua, so I would recommend that you go with that. I have no experience doing XMLly stuff with Lua, so I can only give my opinionated advice smile. In any case, good luck.


There is a difference between bleeding [edge] and haemorrhaging. - Allan

Offline

#3 2009-07-21 07:01:58

tcoffeep
Member
From: Timmins, Ontario
Registered: 2008-11-26
Posts: 99

Re: Advice on a Project I'm Working On

http://sites.google.com/site/dexodro/

Here's the kind of translation I need to do. A suggestion was just translate it via parsing into array, using regex to catch the <>'s and using variables to track nested ifs and the like. But I'm not sure how to work all this out. This, I think, is going to be a rather intense learning experience big_smile

@Xfire : I use lua with Mudlet and Mushclient for the game I play.


=============== Read An Essay ===============
   Distro : Funtoo Linux || Kernel : ckernel-2.6.30-gentoo-r5
Processor : Athlon 64 X2 4400+ || RAM : 2GB || HD : 300GB
========================================

Offline

#4 2009-07-21 08:46:47

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: Advice on a Project I'm Working On

It's a personal preference thing really I guess, so I'd say Perl. Python is urgh.*

* IMHO.

Last edited by fukawi2 (2009-07-21 08:47:06)

Offline

#5 2009-07-21 09:04:06

wuischke
Member
From: Suisse Romande
Registered: 2007-01-06
Posts: 630

Re: Advice on a Project I'm Working On

Well, what about XSLT? In contrast to XSD it's halfway usable and it should be the least work.

But looking at your example, it seems people don't respect XML very much and make life harder than it already is...

My humble advice would be to use an existing XML parser and do transformations based on the generated tree (a tree is in this case preferable over an array). I found Python very easy to learn and there's a package called pyXML (never used it, I try to avoid XML if possible). Perl on the other hand seems more powerful to me and there's Perl-XML.

Disclaimer: I'm no expert in either language. I'm writing a network protocol implementation in Python and it's almost effordless and I wrote a couple of smallish parsing scripts in Perl. The latter were easy in Perl and to date I'm not able to write them in a similar conscise and easy-to-read way in another language.

Last edited by wuischke (2009-07-21 09:04:34)

Offline

#6 2009-07-21 12:29:07

Trent
Member
From: Baltimore, MD (US)
Registered: 2009-04-16
Posts: 990

Re: Advice on a Project I'm Working On

I would stick with either Perl or Python if I were you.  Personally I'd start with Python and see how it goes, but that's up to you.  As others have mentioned, there are XML parsers that have already been written for you to utilize.  This is a good thing.  Honestly, don't try to parse XML yourself.

Apart from that... man, that is one monster of an XML document.

Offline

#7 2009-07-21 18:57:39

Lexion
Member
Registered: 2008-03-23
Posts: 510

Re: Advice on a Project I'm Working On

I would use haskell, you might use haskell or embed an already written C/C++ program (for speed )into a python/perl program for the abstraction and portability.  (+1 Trent) Don't part xml yourself.  Any (ex)openbox user should know this.  Ask anyone of them.


urxvtc / wmii / zsh / configs / onebluecat.net
Arch will not hold your hand

Offline

Board footer

Powered by FluxBB