Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DOM Parser Question

Status
Not open for further replies.

developer155

Programmer
Jan 21, 2004
512
US
I am parsing XML files with DOM parser in my app and it crashes on the following text, even though it is enclosed in CDATA tag. (Internet Explorer parser also crashes)
><![CDATA[Cypress « month FREE rent 4br home, 1&#243; remodeled bath, pool, 2-car garage. Cypress schools. $2800 mo. + dep. Lauren xxx-xxx-xxxx pp]]>

The invalid character is the small << sign after word Cypress. Does anyone know why CDATA does not work here and what would work? Like is there any was to have DOM Parser just ignore invalid characters, not crash?

thanks!!!
 
This is probably due to the encoding you are using. What is it at the moment? You could try changing it to

<?xml version="1.0" encoding="ISO-8859-1"?>

or

<?xml version="1.0" encoding="UTF-16"?>

or change the « to &#171;

Jon

"I don't regret this, but I both rue and lament it.
 
Jonty, I tried using both <?xml version="1.0" encoding="ISO-8859-1"?>

and

<?xml version="1.0" encoding="UTF-16"?> and no luck

As for replacing << with something, will I have to replace all special characters?
 
The main thing is to save the xml in unicode format. As to the encoding part, either leave it out or utf-16 would do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top