scalable xml

H

hyperboreean

Hi, I am writing the application server for a three-tier architecture
and sending the client's response in xml. My question is: is there a way
to build the xml dom in a more scalable way and faster way than just
creating every textNode and element for it? I have tons of data to
transmit and it drives me crazy having to build that dom manually.

I am not sure if this is a stupid question as I don't know other
alternatives ... maybe just provide a template xml which I can fill with
data but that can introduce some pretty ugly bugs in the application.


Thanks.
 
D

Diez B. Roggisch

hyperboreean said:
Hi, I am writing the application server for a three-tier architecture
and sending the client's response in xml. My question is: is there a way
to build the xml dom in a more scalable way and faster way than just
creating every textNode and element for it? I have tons of data to
transmit and it drives me crazy having to build that dom manually.

I am not sure if this is a stupid question as I don't know other
alternatives ... maybe just provide a template xml which I can fill with
data but that can introduce some pretty ugly bugs in the application.

You should have a look at the ElementTree-package (which also comes
api-compatible as lxml). These allow for a much more pythonic way of
creating XML-trees.

However you might consider using a much more concise format such as json for
transport (if you have control over the client). It reduces the data-amount
to about a tenth or so (of course depending on your xml-dialect), with
considerable gains in processing time.

And then there in fact are some template languages such as KID and genshi
that might suit you because they enforce proper XML.

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top