Re: [xml] getElementsByName is available?




kalyanasundaram wrote:
So which would be better? XPath or linear traversing?
I dont know much about XPath implementation. (Do they not traverse
atleast once?) The file size is about 500 KB. :)
That sounds rather small. Just parse it in and walk through it, that's what
I'd do.

Really! I thought 500 Kb is bigger. How much it would be able to handle?
At what size I should go for XPath ? 

The question is not "at what size". The question is: "what's the overhead
involved in both cases in terms of speed and programming".

If the XPath API is easy to use for you, go with it. But a custom tree walker
can still be faster if you need it (and have the time to implement and
optimise it). In lxml (the best Python bindings for libxml2/libxslt :), we use
a pretty fast tree walker macro. See the end of

http://codespeak.net/svn/lxml/trunk/src/lxml/etree_defs.h

(BSD-licensed, BTW)

Stefan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]