XML help needed
Duncan Smith
buzzard at urubu.freeserve.co.uk
Sun Nov 25 23:15:23 EST 2001
"Martin von Loewis" <loewis at informatik.hu-berlin.de> wrote in message
news:j4bshrnh29.fsf at informatik.hu-berlin.de...
> "Duncan Smith" <buzzard at urubu.freeserve.co.uk> writes:
>
> > I have a lot of code written for a particular application I'm
> > working on and I've got to the point where I need to access data
> > from XML files. I will also need to save to XML files. There's
> > almost too much information available and I'd appreciate any advice.
> > SAX? DOM?
>
> You don't specify what you mean by "accessing", most likely, you will
> need a tree representation of the document, i.e. the DOM. The only
> reason *not* to use the DOM would be if the document is too large to
> fit into memory.
>
Thanks for the reply. Basically I have an XML file containing data that I
need as various Python objects (strings, lists, arrays etc.). I don't need
to make changes to XML files, although I might want to write data to new XML
files of the same type (same DTD). What I can't really figure out is my
best strategy. (I don't really want to have to learn about XSL, XSLT,
X-path, SAX, DOM, Pyxie etc. unless I know it's going to be useful.)
Learning all that lot would be a lot of effort to achieve what I need. So
if you (or anyone) could give me advice along the lines of "DOM would be
appropriate but you'll have to know... as well", then I'd be grateful. And
if anyone could point me to a decent (simple) example involving Python
objects rather than HTML, that would help me a lot.
Martin, you were bang on with the 'invalid XML' thing. Cheers.
Duncan
More information about the Python-list
mailing list