XML DomIt converting & to &
Using DomIt to parse a valid XHTML document.
For some reason, Domit is reverting valid & in links to plain &开发者_StackOverflow中文版amp; which breaks the validation.
I would be expecting the other way around if any fix were to be made.
This is the original tag:
<link href="index.php?format=feed&type=atom" rel="alternate" type="application/atom+xml" title="Atom 1.0" />
This is the same tag after parsed:
<link href="index.php?format=feed&type=atom" rel="alternate" type="application/atom+xml" title="Atom 1.0" />
This is the relevant code:
$expansionExceptions = array('br', 'col', 'hr', 'img', 'input', 'link', 'meta', 'param', 'command', 'keygen');
$xml =& new DOMIT_Document();
$xml->expandEmptyElementTags(true, $expansionExceptions);
$xml->parseXML($htmlData);
$xml->toString( false );
Any clue?
All internal fields, import parameters and the testing page gives the same result. It seems to be a bug or bad implementation.
The most recent version is from 2005; I would switch to another parser if possible, or try to fix it using string operations.
精彩评论