Closed GoogleCodeExporter closed 9 years ago
Sorry for the delay.
In case you know the element name (which is true for the majority of use
cases), you can use child() method. Please, describe the particular use case
you have in mind; if it is a relatively common one, I'll add the corresponding
function.
Original comment by arseny.k...@gmail.com
on 19 Aug 2010 at 11:43
* What if you have a XML format that can have one of various document elements
(e.g. <image> or <audio>?) Why force the developer to do multiple searches when
they could simply 1) get the document element and then 2) compare the name?
* What if you use XML as an ad-hoc serialization of some class instance graph
in memory (everybody is doing this nowadays, from Java to C#)? You may have no
idea what the root element name will be---you just want to say, "give me the
root element."
* Getting the root element now is made even more complicated because XML
documents can have several types of notes that are children of the document.
Why should we have to iterate them all and check the type of each one?
The "document element" is formally part of the XML specification. Why not
provide API access to it as such?
http://www.w3.org/TR/xml/
http://www.w3.org/TR/xml-infoset/
Thanks,
Garret
Original comment by garretdw...@gmail.com
on 7 Oct 2010 at 4:28
The xml_document::document_element function was added to the trunk; the next
version, which is released in two weeks, will have it.
Original comment by arseny.k...@gmail.com
on 18 Oct 2010 at 6:28
pugixml-1.0 is out; it has the document_element function.
Original comment by arseny.k...@gmail.com
on 31 Oct 2010 at 6:20
Original issue reported on code.google.com by
garretdw...@gmail.com
on 13 Aug 2010 at 5:49