getElementById

M

Marc Dzaebel

Hi,

using JDK1.6, is there a way to tell a Document (DOM Level 3) that a certain
Attribute (usually "id") is always of type ID without defining a grammar
file? Currently I have to traverse the full DOM tree and
setIdAttribute("id", true). Otherwise getElementById returns null. If I need
a schema, is it possible to create it programmatically.

Thanks, Marc
 
M

Martin Honnen

Marc Dzaebel wrote:

using JDK1.6, is there a way to tell a Document (DOM Level 3) that a certain
Attribute (usually "id") is always of type ID without defining a grammar
file? Currently I have to traverse the full DOM tree and
setIdAttribute("id", true). Otherwise getElementById returns null.

I don't know whether the parser you use supports that but xml:id could
help, see
<http://www.w3.org/TR/xml-id/>
That way you do not need a DTD or schema (but you need to use the
attribute name xml:id).
 
M

Marc Dzaebel

Martin Honnen said:
I don't know whether the parser you use supports that but xml:id could
help, see
<http://www.w3.org/TR/xml-id/>
That way you do not need a DTD or schema (but you need to use the
attribute name xml:id).

Hi Martin,

I already tried this but obviously the use of attribute name xml:id does not
work, even if the parser (Xerces) is set to be namespace aware. May be
Xerces does not implement this newer recommendation yet?

Thanks, Marc
 
J

Joe Kesselman

Marc said:
May be Xerces does not implement this newer recommendation yet?

Sounds likely. Xerces has its own mailing list; ask there? (Or check
their website; they *should* list the specifications they support
somewhere, though that may not have been updated recently.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top