tags:

views:

182

answers:

1

I've been working with the xml.linq classes in .net recently. But may need to use a linux friendly language for an upcoming project.

The things I like the most are

  1. Xdocument, being able to load from a file or parse from a string
  2. XElement, quickly creating a custom structure for page specific data
  3. Traversing Children, Parents, Siblings etc
  4. Xml.Linq in general getting and setting values by Variable.Element("elementName").value() for Variable.Descandants("elementName").value() not to mention attributes adding descendants and all the other goodies that are built in.

So my question is. Is there another language that has these kinds of features built in for xml? I'd like to avoid manual parsing and have the flexibility of on the fly generated xml.

Bonus Question: Do other languages have features that could work similar to Linq to Xml for querying the xDocument/xelement equivalent.

+2  A: 

LINQ example thing in Python

http://themechanicalbride.blogspot.com/2007/03/linq-to-python.html

But this blog sheds light on why this is not needed:

LINQ in PHP

http://phplinq.codeplex.com/

For an interesting perspective on LINQ and things similar

http://mail.python.org/pipermail/python-3000/2006-November/004575.html

Sounds interesting. But in the FOSS scene, there seems to be a bit of resistance to this kind of thing (I could be wrong).

There are tons of XML routines in Python such as XPath, XSLT and others.

http://stackoverflow.com/questions/8692/how-to-use-xpath-in-python

It might be worth working with these standards and moving away from LINQ as, I cant see a stable alternative ... But there are things that are functional, but a different philosophy

Aiden Bell
Looking into everything now, thanks for the links.
Birk
No worries. Not wishing to sound condescending ... but keep an open-mind. Often FOSS centric systems have a different philosophy in design and implementation that could expand your horizons.
Aiden Bell
I'm open to trying new things. The Python links you gave look really interesting and I'd like to try something that doesn't require me to run VM on my Mac. But even with as robust as ElementTree and lxml et al are... I'm doing things with linq that really blow me away and I've not seen another language do it that well yet. I'm going to leave the question open for a few days, to try and get some more opinions... but as of right now this is a pretty solid answer.
Birk
You should be able to install all the Python things native to OSX (Python 2.5.x might be included)
Aiden Bell