Hi Keven,

I tried your xml in my tool which also used DOM3
I parse, normalize and serialize and guess what I get? :))

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE personnel SYSTEM "personal.dtd" [<!ENTITY name 'Big'>
<!ENTITY one '1'>
]>
<personnel>
    <person id="Big.Boss" salary="1">
        <name>
            <family>Boss</family>
            <given>&name;</given>
        </name>
        <email>[EMAIL PROTECTED]</email>
    </person>
</personnel>


I am using config.setParameter(
                                
"http://apache.org/xml/features/dom/create-entity-ref-nodes";,
                                Boolean.TRUE);
to retain the entitynodes in the DOM.

So maybe the combination gives the goor result?

Regards
Dick

Op 31-jan-2007, om 20:07 heeft Kevin Froese het volgende geschreven:

Hello.

I'm experiencing some unexpected (at least to me) behavior with entity
references in attributes. After parsing, entity references in attributes appear to be dropped, leaving only the value of the entity. For example,
starting with the DOM3 class from the samples in the Xerces 2.9.0
distribution, I added the line

 config.setParameter("entities", Boolean.TRUE);

just before the call to parseURI(). Then if I run with the modified
personal.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE personnel SYSTEM "personal.dtd" [
<!ENTITY name "Big">
<!ENTITY one "1">
]>

<personnel>

 <person id="Big.Boss" salary="&one;">
   <name><family>Boss</family> <given>&name;</given></name>
   <email>[EMAIL PROTECTED]</email>
 </person>
</personnel>

The results I get are:

Parsing data/personal.xml...
Normalizing document...
Serializing document...
<!DOCTYPE personnel SYSTEM "personal.dtd" [<!ENTITY name 'Big'>
<!ENTITY one '1'>
]>
<personnel>

 <person id="Big.Boss" salary="1">
   <name><family>Boss</family> <given>&name;</given></name>
   <email>[EMAIL PROTECTED]</email>
 </person>

</personnel>

While the "name" entity reference remains, the "one" entity reference has been lost, replaced by the value of the entity. Is this behavior expected?
A bug? Configurable?

Any insight is greatly appreciated.


--
Kevin Froese



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Reply via email to