php domdocument xml在<>&in items中遇到麻烦

I am trying to parse this XML:

<data>
<item field="abcdef '<>&" row="another text" />
</data>

I should get abcdef '<>& for getAttribute('field') and another text for getAttribute('row'). But if my data contains <>& etc XML is not parsed correctly. How can I parse it correctly?

It's malformed XML. You need to encode '<>& as &apos;&lt;&gt;&amp;. This is what well formed XML looks like:

<data>
<item field="abcdef &apos;&lt;&gt;&amp;" row="another text" />
</data>

You need to tidy the XML before you can parse it with an XML parser.