I get this error when parsing XML in PHP using the '&'
Xml parsing error: not well-formed (invalid token) (error code 4)
Is there a way to parse this character or remove it? It looks like the only option is to remove it.
Parsing Error and XML
Started by dirkfirst, Jan 19 2007 07:57 AM
1 reply to this topic
#1
Posted 19 January 2007 - 07:57 AM
|
|
|
#2
Posted 19 January 2007 - 12:05 PM
I don't know anything about parsing XML nor XML for that matter, but to replace characters in strings you could use str_replace() to replace "&" with a " ". You could also use preg_replace() but that uses regular expressions which give me a headache.
You may also want to read this Extensible Markup Language (XML) 1.0 (Fourth Edition)
You may also want to read this Extensible Markup Language (XML) 1.0 (Fourth Edition)
Quote
Definition: Entity and character references may both be used to escape the left angle bracket, ampersand, and other delimiters. A set of general entities (amp, lt, gt, apos, quot) is specified for this purpose. Numeric character references may also be used; they are expanded immediately when recognized and MUST be treated as character data, so the numeric character references "<" and "&" may be used to escape < and & when they occur in character data.


Sign In
Create Account


Back to top









