How to differ
<bar />
and
<bar></bar>
with php DOMDocument like:
<php
$xml = new DOMDocument("1.0", "UTF-8");
$xml->loadXML('<?xml version="1.0" encoding="UTF-8"?><foo><bar /><bar></bar></foo>');
Is it possible somewhat? Thank you
How to differ
<bar />
and
<bar></bar>
with php DOMDocument like:
<php
$xml = new DOMDocument("1.0", "UTF-8");
$xml->loadXML('<?xml version="1.0" encoding="UTF-8"?><foo><bar /><bar></bar></foo>');
Is it possible somewhat? Thank you
<bar/>
and
<bar></bar>
are equivalent in XML. XML processors will handle them identically, and your software should too.
As XML, they are equivalent. As text, they are different. Treat them as text, not XML, if you wish to control this difference that makes no difference to XML. Be aware, though, that you're going against the grain. This difference is insignificant at the XML level.