XML doc generation

Paul Prescod paulp at ActiveState.com
Mon Jan 22 22:16:30 EST 2001


Jonathan Pennington wrote:
> 
>...
> 
> Well, I trust your judgement there. As a reformed perl and PHP
> programmer, I can write text into a file in my sleep :-) However, one
> last question. If I wanted to download this coordinate info, then
> manipulate it as a DOM, would that still be easier. In other words, as
> stated above, I would download data from the receiver directly into an
> XML file, then parse the XML file into memory, display/manipulate it,
> then rewrite it to the file when saved. 

Even in the case where the data came from XML, it may or may not be
easiest to manipulate it *as* XML. If you are doing lots of complicated
manipulations, it might be easier to do it in some other data structure. 

Imagine if I had a matrix encoded as an XML "table". Doing a transform
to rotate the table would be a lot more work than doing the equivalent
with simple Python lists or with NumPy arrays.

On the other hand, if you were just running around the tree adding a few
attributes or something then it would be easier to keep it as a DOM for
the whole program.

> Do I understand correctly. It
> does sound easy enough, I just want to make sure that I'm not missing
> something or making things difficult with all that file I/O. Thanks.

A lot of people are nervous that writing out tags is an inappropriate
way to generate XML. That's natural. But it tends to be simpler than the
alternatives and about as robust.

 Paul Prescod




More information about the Python-list mailing list