Michael,
Thanks for your quick response.
I will use a simple internal parser to detect them. If the xml is
wellformed this should not be too complex
Thanks,
Dick Deneer
Op 16 jan 2010, om 23:21 heeft Michael Glavassevich het volgende
geschreven:
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: [email protected]
E-mail: [email protected]
Dick Deneer <[email protected]> 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>[email protected]</email>
> </person>
> </personnel>
>
>
> Regards,
> Dick Deneer
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]