You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Malia Zaheer <mz...@technicacorp.com> on 2003/05/02 18:08:15 UTC

xerces not parsing elements correctly

I am using xerces to parse an xml file containing the element:
<ldap.username>uid=admin,ou=Administrators,ou=TopologyManagement,o=NetscapeR
oot</ldap.username>

 

But, the parser is deleting some characters while parsing the string and I
get this:

 

uid=admin,ou=Administrators,ou=ologyManagement,o=NetscapeRoot

 

Notice the Top in TopologyManagement is missing and I get ologyManagement.
This has happened with another element in the same file.

 

<ldap.organization>uid=UShasta,ou=People,o=technicacorp.com</ldap.organizati
on>

 

In that case, the parser omitted "uid=UShasta,"  from the element and I got

 

<ldap.organization>ou=People,o=technicacorp.com</ldap.organization>

 

I figured this problem and just moved that element above another element and
things started working.  Now I am getting similar error and I don't want to
kluge the system by finding a workaround.  I think this is a bug with
Xerces.  I don't know what could be causing this because this error happens
only sometimes, not always.  The last time it happened, it consistently gave
me that error until I move the element around, but after that, it didn't
happened for about 3 weeks.  I am using Xerces 2.0.0.

 

Thanks,

Malia

 


Re: xerces not parsing elements correctly

Posted by Joseph Kesselman <ke...@us.ibm.com>.



This sounds like the standard SAX mistake of forgetting that text may be
delivered as multiple calls to characters() rather than just one, due to
parser buffering issues. It's the SAX application's responsibility to deal
with that in some appropriate way, most often by reassembling the data in a
Stringbuffer and only processing it when the next non-characters() event
occurs.

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"may'ron DaroQbe'chugh vaj bIrIQbej"  ("Put down the squeezebox and nobody
gets hurt.")


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org