You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Christian NENTWICH <c....@cs.ucl.ac.uk> on 2000/10/16 11:08:26 UTC
getIdentifier problem
Dear all,
the documentation of getIdentifier says that the function looks up ids
that have been "pre-registered". Does that mean I have to call
putIdentifier or will it recognize attributes of type ID automatically ?
(please say yes, please :)
Calling getIdentifier("n1") on the document pasted below returns null.
I've got rather huge documents, so going through them manually and
calling putIdentifier on each id attribute will be tedious.
Christian
<?xml version='1.0' standalone="yes"?>
<!DOCTYPE idtest [
<!ELEMENT idtest (node*)>
<!ELEMENT node (#PCDATA)>
<!ATTLIST node
id ID #REQUIRED
child IDREF #REQUIRED
>
]>
<idtest>
<node id="n1" child="n2">node 1</node>
<node id="n2" child="n3">node 2</node>
<node id="n3" child="n4">node 3</node>
<node id="n4" child="n2">node 4</node>
</idtest>
Re: getIdentifier problem
Posted by Christian NENTWICH <c....@cs.ucl.ac.uk>.
> > the documentation of getIdentifier says that the function looks up
> > ids that have been "pre-registered". Does that mean I have to call
> > putIdentifier or will it recognize attributes of type ID
> > automatically ? (please say yes, please :)
>
> Yes... with the requirement that you have a grammar for your
> document and you have validation turned on.
Ah yes, now it all makes sense. Thanks a lot for that... it's so obvious
afterwards... We had already implemented our own ID function :)
This is a good one for the faq :)
Christian
Re: getIdentifier problem
Posted by Andy Clark <an...@apache.org>.
Christian NENTWICH wrote:
> the documentation of getIdentifier says that the function looks up
> ids that have been "pre-registered". Does that mean I have to call
> putIdentifier or will it recognize attributes of type ID
> automatically ? (please say yes, please :)
Yes... with the requirement that you have a grammar for your
document and you have validation turned on.
--
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org