xml library in twisted
![](https://secure.gravatar.com/avatar/34a203a415f4adee47233052652ad4e1.jpg?s=120&d=mm&r=g)
Hi all, I'm dealing with xml files in a twisted application, can any one suggest me the best xml library in twisted? Previously i used twisted.web.microdom and twisted.web.minidom but they don't have much of the functionalities.... Is there any other xml library in twisted which makes it easy with lot of options? I wanted to create a xml file like this... <game> <player1> <stuff> </stuff> </player1> <player2> <stuff> </stuff> </player2> </game> and want to access that player stuff directly..(like a tree structure) Thank you in advance. Now you can chat without downloading messenger. Go to http://in.messenger.yahoo.com/webmessengerpromo.php
![](https://secure.gravatar.com/avatar/48a18ced5d094701f25f2faeb85741e2.jpg?s=120&d=mm&r=g)
Dnia 2008-03-04, o godz. 19:47:17 Raj kumar <k_r_a_j_kumar@yahoo.co.in> napisał(a):
Hi all, I'm dealing with xml files in a twisted application, can any one suggest me the best xml library in twisted? Previously i used twisted.web.microdom and twisted.web.minidom but they don't have much of the functionalities.... Is there any other xml library in twisted which makes it easy with lot of options? I wanted to create a xml file like this...
Are you completly sure you need XML at all? Allow me to cite http://dirtsimple.org/2004/12/python-is-not-java.html : """ XML is not the answer. It is not even the question. To paraphrase Jamie Zawinski on regular expressions, "Some people, when confronted with a problem, think "I know, I'll use XML." Now they have two problems." This is a different situation than in Java, because compared to Java code, XML is agile and flexible. Compared to Python code, XML is a boat anchor, a ball and chain. In Python, XML is something you use for interoperability, not your core functionality, because you simply don't need it for that. In Java, XML can be your savior because it lets you implement domain-specific languages and increase the flexibility of your application "without coding". In Java, avoiding coding is an advantage because coding means recompiling. But in Python, more often than not, code is easier to write than XML. And Python can process code much, much faster than your code can process XML. (Not only that, but you have to write the XML processing code, whereas Python itself is already written for you.) [...] (The only exception to this is if your target audience really really needs XML for some strange reason. Like, they refuse to learn Python and will only pay you if you use XML, or if you plan to give them a nice GUI for editing the XML, and the GUI in question is something that somebody else wrote for editing XML and you get to use it for free. There are also other, very rare, architectural reasons to need XML. Trust me, they don't apply to your app. If in doubt, explain your use case for XML to an experienced Python developer. Or, if you have a thick skin and don't mind being laughed at, try explaining to a Lisp programmer why your application needs XML!) """ -- m
![](https://secure.gravatar.com/avatar/dd1243740a09f0676ef225404105cfc0.jpg?s=120&d=mm&r=g)
On Mar 4, 2008, at 9:17 AM, Raj kumar wrote:
Hi all, I'm dealing with xml files in a twisted application, can any one suggest me the best xml library in twisted? Previously i used twisted.web.microdom and twisted.web.minidom but they don't have much of the functionalities.... Is there any other xml library in twisted which makes it easy with lot of options? I wanted to create a xml file like this... [snip snip snip] and want to access that player stuff directly..(like a tree structure)
Thank you in advance.
Hi Raj, What kind of functionality do you feel is missing from microdom? I've been using that myself with much success, although I didn't have much of a need for speed or XML-specific features (validation, etc). Another thing to consider is whether you really need to parse the XML properly at all. If you're dealing with XML because you're getting some sort of datafile from a third party, and it's as simple as the one you described in your email, you might consider just using regular expressions to get the data you need. That might be heresy among XML fanatics, but it's done the trick for me on quite a few occasions. -phil
participants (3)
-
Michał Pasternak
-
Phil Christensen
-
Raj kumar