[
Lists Home |
Date Index |
Thread Index
]
Dare Obasanjo wrote:
> The fact that namespaces in XML requires you to parse all attributes before you can report the name of the start tag even in streaming implementations adds a significant perf cost. I'm not even sure what the heck you mean by "complexity of allowing streaming attributes" considering that whatever API does this is already streaming everything else which makes not streaming attributes an inconsistency anyway.
>
All it means is that it's simpler for the client programmer to get the
complete collection of attributes for an element as one bundle along
with the start-tag, than to receive them one at a time. It's the same
reason it's easier for the programmer to get a nice tree representation
of the entire document (not a DOM, a *nice* tree representation) than it
is to use something like SAX or XmlReader.
The difference between the two cases is that documents do get so large
that there are significant performance hits to presenting the entire
document at once, especially with respect to memory usage. This doesn't
happen for all documents or all use cases, but it happens often enough
that we need more complicated streaming APIs in addition to simpler
tree-based APIs. (Again, I don't mean DOM when I write "simpler
tree-based APIs".)
However, I have never seen a single element in a real-world XML document
which had so many attributes that streaming the attributes one at a time
would have been practical help worth the additional complexity that
would be imparted to the API by such a solution. You're trying to solve
a problem that doesn't exist in practice; or if it does exist, is so
rare as to not be worth solving.
--
Elliotte Rusty Harold elharo@metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim
|