by John Brinkman
The XMLData ObjectBefore E4X was invented, we had recognized the need to have generic XML processing in Acrobat / Reader. Consequently, we added the XMLData object to the Acrobat object model. However, E4X was introduced shortly afterwards, and we ended up with two XML processing engines in Acrobat/Reader. In case there is any doubt, the right answer is to use E4X. You should no longer use the XMLData object. The XMLData object remains in the product for backward compatibility, but it does not get enhanced, it does not get bug fixes. E4X is faster and uses less memory.
Some Usage NotesThere are several common learning curve issues you might encounter when using E4X:
Oddly, E4X refuses to process the xml processing instruction at the front of an XML fragment. If it’s there, you will get a syntax error: “xml is a reserved identifier”. The workaround is to remove leading processing instructions with a regular expression such as:
sXML = sXML.replace(/^[\s\S]*?(<[^\?!])/, “$1″);