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 Giorgos Zervas <gi...@perlfect.com> on 2004/02/11 16:27:38 UTC

serializing DTDs and gettting programatically added elements by id

hello list,

i have two questions that i would like to ask.

the first one is regarding DTD serialization. i am using the identity
transformation trick to serialize an xml document that i have parsed
(with validation) into a DOM tree and although everything is written out
correctly the DTD is always missing... is there any way to include the
original DTD in the serialized document? i have tried

transformer.setOutputProperty(OutputKeys.STANDALONE, "yes");

but to no avail. 

the second question is regarding getElementById(). when i use it to
retrieve an element that was in the xml document before this was parsed
into a dom tree it works fine. but, if i programmatically add a new node
(say using appendChild()) then whenever i use getElementById() to
retrieve this node i get back null.

by looking into the source code i found the identifiers map which xerces
seems to create when first parsing a document. there is also the
corresponding putIdentifier() method to insert a new identifier. however
i have two problems with this solution: 1. i am using the parser through
jaxp and i wouldn't like to make use of xerces specific features, 2. it
would only seem logical to me that xerces should call putIdentifier()
for me when i add a new node to the DOM tree.

i have made sure that my identity attributes are defined as such in the
DTD (ID #REQUIRES) and that they contain valid values (start with a
character, no spaces)

any feedback on both these issue will be greatly appreciated.

many thanks,
giorgos 


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