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 Frank Steimke <f-...@berger-und-steimke.de> on 2009/12/23 11:08:52 UTC

How to retain Entity References in Attribute Nodes while parsing ?

Hi, 

We are working with highly modularized Documents bases on DocBook 4.1.2 DTD.
They contain lots of external Entities. I`d like to migrate them to a new
structure (based on DocBook 5), where external Entites shall be replaced by
xinclude. Everything else has to be retained exactly "as is".

We also make use of internal Entities, and one way we use them is like this:
Declare Entity revision as "2009-12-23 (draft)" and use them in attributes:
<section revision='&revision' . />

 

I`m am using Xerces-J 2.9.1 for parsing. Validation is turned on, Feature
'http://apache.org/xml/features/dom/create-entity-ref-nodes' is set to true.
External general Entities generate an EntityReferenceNode as expected.
Internal Entities within Element-Nodes are shown as EntityReferencNodes as
expected.  Attributes, however, do not have EntityReferencNodes as Child.
They contain Text Nodes as the only child, its value is the Value of the
corresponding Entity Definiton. The Example given above turns into section
revision=' 2009-12-23 (draft)'. />

 

Is there a way for us to retain the Information that the value of this
attribute is defined as an Entity?  I found a hint somewhere, that this
feature is or will be available in Xerces2-J, while it is not, and will not
be, in Xerces-C.

 

Thanks in advance,

Frank Steimke

 

 


AW: How to retain Entity References in Attribute Nodes while parsing ?

Posted by Frank Steimke <f-...@berger-und-steimke.de>.
Michael,

 

thank you for this clear explanation. Now i`m sure I haven't overlooked
something. And I can live without this feature. After all, it's a very
special use case.

Frank

 

Von: Michael Glavassevich [mailto:mrglavas@ca.ibm.com] 
Gesendet: Montag, 11. Januar 2010 23:14
An: j-users@xerces.apache.org
Betreff: Re: How to retain Entity References in Attribute Nodes while
parsing ?

 

This feature has no effect for attributes. Xerces-J always expands entity
references in attribute values.

Since XNI doesn't report entity boundaries in attribute values it's unlikely
to ever be supported. The infrastructure isn't there. This was a conscious
decision [1].

Thanks.

[1]
http://mail-archives.apache.org/mod_mbox/xerces-j-dev/200109.mbox/%3C3B9C591
5.E05D28AC@apache.org%3E

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

keshlam@us.ibm.com wrote on 12/23/2009 12:27:25 PM:

> Xerces-J has an option to control whether EntityReference notes are 
> generated in the DOM output. See 
>         http://xerces.apache.org/xerces-j/features.html 
> ... specifically, the create-entity-ref-nodes feature. 
> 
> I haven't checked whether Xerces-C offers the same choice, but I 
> would be a bit surprised if it doesn't. 
> 
> ______________________________________
> "... Three things see no end: A loop with exit code done wrong,
> A semaphore untested, And the change that comes along. ..."
>  -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (http://
> www.ovff.org/pegasus/songs/threes-rev-11.html) 


Re: How to retain Entity References in Attribute Nodes while parsing ?

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
This feature has no effect for attributes. Xerces-J always expands entity
references in attribute values.

Since XNI doesn't report entity boundaries in attribute values it's
unlikely to ever be supported. The infrastructure isn't there. This was a
conscious decision [1].

Thanks.

[1]
http://mail-archives.apache.org/mod_mbox/xerces-j-dev/200109.mbox/%3C3B9C5915.E05D28AC@apache.org%3E

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

keshlam@us.ibm.com wrote on 12/23/2009 12:27:25 PM:

> Xerces-J has an option to control whether EntityReference notes are
> generated in the DOM output. See
>         http://xerces.apache.org/xerces-j/features.html
> ... specifically, the create-entity-ref-nodes feature.
>
> I haven't checked whether Xerces-C offers the same choice, but I
> would be a bit surprised if it doesn't.
>
> ______________________________________
> "... Three things see no end: A loop with exit code done wrong,
> A semaphore untested, And the change that comes along. ..."
>  -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (http://
> www.ovff.org/pegasus/songs/threes-rev-11.html)

Re: How to retain Entity References in Attribute Nodes while parsing ?

Posted by ke...@us.ibm.com.
Xerces-J has an option to control whether EntityReference notes are 
generated in the DOM output. See
        http://xerces.apache.org/xerces-j/features.html
... specifically, the create-entity-ref-nodes feature.

I haven't checked whether Xerces-C offers the same choice, but I would be 
a bit surprised if it doesn't. 

______________________________________
"... Three things see no end: A loop with exit code done wrong,
A semaphore untested, And the change that comes along. ..."
  -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (
http://www.ovff.org/pegasus/songs/threes-rev-11.html)