Ignoring spaces, tabs and line in XML DOM parsing

S

Sandeep

Hi,
I am parsing an XML file using xerces DOM parser. The problem is, the
DOM gets created with spaces, newlines and tabs as a TEXT section.

Hence if XML is,

<Address><Name></Name></Address>
first child of "Address" is "Name"

if XML is
<Address>
<Name></Name>
</Address>

first child of "Address" is "\n".

Is there a way i can configure the parser to ignore all white
spaces,tabs and newline characters ?

Thanks
Sandeep
 
R

Raymond DeCampo

Sandeep said:
Hi,
I am parsing an XML file using xerces DOM parser. The problem is, the
DOM gets created with spaces, newlines and tabs as a TEXT section.

Hence if XML is,

<Address><Name></Name></Address>
first child of "Address" is "Name"

if XML is
<Address>
<Name></Name>
</Address>

first child of "Address" is "\n".

Is there a way i can configure the parser to ignore all white
spaces,tabs and newline characters ?

Yes, there is a way but the exact method escapes me at the moment.
Start digging in the parser API, perhaps look at the properties
recognized by your parser.

HTH,
Ray
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top