Even if Xerces internally tracked entity boundaries within attribute values there would be no way to report this information to you through SAX [1]. Only the normalized value [2] of an attribute is exposed. In other words, the entity references will have been replaced before your ContentHandler receives the attribute values.
[1] http://xerces.apache.org/xerces2-j/javadocs/api/org/xml/sax/ext/LexicalHandler.html#startEntity (java.lang.String) [2] http://www.w3.org/TR/REC-xml/#AVNormalize Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org Dick Deneer <d.den...@chello.nl> wrote on 01/16/2010 04:29:25 PM: > When I parse xml with an entity refererence in an attribute to a DOM > tree, I am not able to serialize the xml back to the original content. > The question of retaining this references has been asked before in > this forum and I am aware that this is not supported by xerces. > But it is possble to check by myself for the existence of such > entities? In other words : When I use a contenthandler, how could I > check for entities that are declared within attributes? > > Example xml where the salary attribute has the entity &one which I > want to detect in the parsing. > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE personnel SYSTEM "personal.dtd" [ > <!ENTITY name "Big"> > <!ENTITY one "1"> > ]> > <person id="Big.Boss" salary="&one;"> > <name><family>Boss</family> <given>&name;</given></name> > <email>ch...@foo.com</email> > </person> > </personnel> > > > Regards, > Dick Deneer > > --------------------------------------------------------------------- > To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org > For additional commands, e-mail: j-users-h...@xerces.apache.org