Re: [Twisted-web] xml library in twisted
Hi michal, Thank you for the valuable reply. I need a clarification regarding this xml from you. from your reply i got to know is, the file which i wanted is not at all any xml. Is it? Then let me tell you my problem.... My (server-client)application will get players information fromdifferent clients and the server will save this plyers information in a*.xml file. And my server will send this file to clients when ever they need it. can you suggest me how to handle this situation? Do i need an xml? what you call the following format of my file other than xml? <game> <player1> <stuff> </stuff> </player1> </game> Please suggest me what kind of xml stuff i'm using now? and any better options for me? Thank you. ----- Original Message ---- From: Michał Pasternak <michal.dtz@gmail.com> To: twisted-web@twistedmatrix.com Sent: Tuesday, 4 March, 2008 8:49:05 PM Subject: Re: [Twisted-web] xml library in twisted 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 _______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web Bollywood, fun, friendship, sports and more. You name it, we have it on http://in.promos.yahoo.com/groups
On Tue, Mar 4, 2008 at 9:26 PM, Raj kumar <k_r_a_j_kumar@yahoo.co.in> wrote:
Hi michal, Thank you for the valuable reply. I need a clarification regarding this xml from you. from your reply i got to know is, the file which i wanted is not at all any xml. Is it? Then let me tell you my problem.... My (server-client)application will get players information from different clients and the server will save this plyers information in a *.xml file. And my server will send this file to clients when ever they need it. can you suggest me how to handle this situation? Do i need an xml? what you call the following format of my file other than xml?
You posted to twisted-web, so is your client a web-browser? If so, and you are writing a game in a web-browser, then I'll just assume that you are using javascript, in that case your data format could most conveniently be JSON, see: http://svn.red-bean.com/bob/simplejson/tags/simplejson-1.7/docs/index.html or if in your game you control both clients and servers, then you should definitely look at Perspective Broker: http://twistedmatrix.com/projects/core/documentation/howto/pb-intro.html in both of the above case, you data format could be as simple as python dicts, ie: game = {"player1":["some", "stuff"], "player2": ["other", "stuff"]} simplejson converts python dicts to javascript objects and perspective broker lets you pass around native python objects (like python dicts). Hope this helps, -Alex
<game> <player1> <stuff> </stuff> </player1> </game>
Please suggest me what kind of xml stuff i'm using now? and any better options for me?
Thank you.
----- Original Message ---- From: Michał Pasternak <michal.dtz@gmail.com> To: twisted-web@twistedmatrix.com Sent: Tuesday, 4 March, 2008 8:49:05 PM Subject: Re: [Twisted-web] xml library in twisted
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
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
------------------------------ Save all your chat conversations. Find them online.<http://in.rd.yahoo.com/tagline_webmessenger_3/*http://in.messenger.yahoo.com/webmessengerpromo.php>
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
participants (2)
-
alex clemesha
-
Raj kumar