Hi Paul, Xerces has no support for preserving entity references in attribute values. See previous discussion on this topic here [1] and here [2].
Thanks. [1] http://marc.info/?t=117027061700003&r=1&w=2 [2] http://issues.apache.org/jira/browse/XERCESJ-1225 Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] "Paul van der Maas" <[EMAIL PROTECTED]> wrote on 05/28/2008 03:59:02 AM: > Hi, > > I?m parsing a XSL template into a DOM tree using the DocumentBuilder > and after that I visit every Node in the tree using a NodeIterator. > I also visit every attribute Node and their values. The reason I go > over the tree is because I need to find all entity references and do > something every time I encounter one. > I can find all the entity references that are in the document > itself, but it seems as though the DocumentBuilder doesn?t generate > any nodes for entity references contained in attributes. > For instance, if I have the following XML: > > > <?xml version="1.0" encoding="UTF-8" standalone="yes"?> > <!DOCTYPE a > [ > <!ENTITY foo "foo"> > <!ENTITY bar ?bar?> > ]> > <a attr=?before&foo;after?> > &bar; > </a> > > Parsing this document and then using a NodeIterator to visit the > nodes gives me these nodes: > > Node a (element) > Node attr (attribute) > Node beforeafter (text) > Node bar (entity reference) > > As you see, the entity reference &foo; in between the text before > and after in the attribute attr is nowhere to be found. I can?t > figure out where it went. > I couldn?t find any information about this on Google, that?s why I?m > turning here before I report this as a bug. > Anyone know what is going on? Let me know if you need more > information. Any help is very much appreciated! > > Thanks, > > Paul van der Maas