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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with SAX2 Parser 2

Status
Not open for further replies.

jamesa74

Programmer
Jan 10, 2001
20
IL
Hi,

The SAX2 parser is supposed to raise the charecters event in the following case: "The reader calls the character method between the startElement and endElement methods." . So far so good, but in my application it raises this event after each time the startElement event occurs even if the element contains only other elements and not any content. It also raises it after each time the endElement event occurs.

Is this the normal beahavior of the SAX2 or am i missing something?
 
People forget that XML likes to be in "one big long string", and not the pretty indented format that all the tools like XMLSpy produce. The characters event gets raised even for the carriage-return, tab and line-feed characters in your file. You need to filter them out.

Something you may want to keep in mind is that SAX2 doesn't always like the UTF-8 encoding. We had some accented characters in our data (like ó, è, and ü), and it would fatalerror on them. You need to set your encoding (both in the XML file and any DTD you might have) to ISO-8859-1 to get around this. Maybe Microsoft will fix this in the next release of their parser :eek:)

Chip H.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top