in reply to Re^2: XML::LibXML::Reader giving wrong matched element
in thread XML::LibXML::Reader giving wrong matched element
It seems to me that consistency would make parsing easier... and might even help explain why the OP (you?) is seeing unexpected numbers of elements.
I'm quite curious, because a simpleminded search on "XML close tag" produced a selection of inconsistent assertions.
On the first paw, your explanation doesn't seem consistent with beginner tuts like that at http://www.w3schools.com/xml/xml_syntax.asp nor with http://www.w3schools.com/xml/xml_dtd.asp nor http://www.xmlfiles.com/xml/xml_syntax.asp -- none of which are authoratative (but I'm too full of turkey to chase it down -- and while you may suspect a turkey byproduct, that's another discussion). All of those agree that the only or chief exception to a "must have a closing tag" rule is the <empty-element />
But on the hind paw, the XML validator at http://www.w3schools.com/xml/xml_validator.asp passes, as "well formed," the OP's code, when that is modified with a leading <?xml version...> header, and has the elipsis replaced with arbitary sample data.
Thus, while I'm still uncertain "why" and "how" your take on the matter can be true, I won't dispute it (at least for the moment).
I will, however, quibble with your assertions about html. They're good examples of the point you're making... but they're NOT entirely correct. The standards for 4.01 transitional and 4.01 strict differ on what's required, where. Your link example is correct ("valid") in both; the shortcut close on image is NOT required by 4.01 transitional (aka "loose"). And html5 is a fish with different feathers.
In any case,, if you posted the OP as an AM and are now expanding on that post, please provide the sample output requested above... and, whether you are the OP or not, thank you for taking the time and effort to reply.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: XML::LibXML::Reader giving wrong matched element
by ikegami (Patriarch) on Nov 25, 2011 at 02:11 UTC | |
by ww (Archbishop) on Nov 25, 2011 at 04:04 UTC | |
by ikegami (Patriarch) on Nov 25, 2011 at 04:18 UTC |