[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-p-dev
Subject:    Question on using ENTITY's in attribute values when creating DOM elements
From:       "Paul Harper" <paulh () ncube ! com>
Date:       2004-11-30 23:11:35
Message-ID: 489AF575469F56438310BBAC733F688A3EEE6F () iris ! ncube ! com
[Download RAW message or body]


I'm using Xercesp 2.3.0-1 and am creating a DOMDocument with the following
code (similar to some of the sample code in the distribution):

    $impl = XML::Xerces::DOMImplementationRegistry::getDOMImplementation('LS');
    $dt   = $impl->createDocumentType($PrimaryTagName, '', $DTDURL);
    $doc  = $impl->createDocument('', $PrimaryTagName, $dt);

This has been working well, but when I added an ENTITY to my DTD that I wanted to
use in an attribute value created with code, I hit a snag.  The ENTITY is:

<!ENTITY ver "1.0">

and I wanted to be able to set an attribute as:

    $v = $doc->createElement("VersionElem");
    $v->setAttribute('version' , '&ver;');

What this produced when serialized was:

  <VersionElem version="&amp;ver;"/>

Not what I had hoped for.

I believe that I found the root of the problem in the documentation on the \
createDocumentType method:

    'Entity declarations and notations are not made available. Entity reference
    expansions and default attribute additions do not occur. It is expected 
    that a future version of the DOM will provide a way for populating a 
    DOMDocumentType.'

The documentation for Xerces 2.6 reads the same way.

So, is there another way to insert ENTITY references in attribute values or am I \
stuck until XercesC is updated?

Thanks in advance,

Paul Harper
paulh@ncube.com

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-p-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-p-dev-help@xml.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic