|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Problem with getElementById()
9/24/2002 11:49:01 AM, "li, gang" <li_gang@e...> wrote: >I want to get an element by its unique id. I set the attribute "id" to the >element. But when I called Document.getElementById(), it returns null. I'm >using Apache Batik DOM implementation. Does anybody ever used it? Or how to >use it in other packages like Xerces? I looked at Xerces API, but didn't >find any useful information. In HTML, the attribute "id" is defined as having the ID type (in principle by the DTD, but essentially "by magic" as far as browsers are concerned). Since SVG does have an ID attribute called "id" on every element, I dont' know why Batik's DOM doesn't work for you. Perhaps you have to explicitly tell it what DTD you're using? Or you're not using SVG data? In XML generally, one needs a DTD or schema to tell the parser to tell the DOM implementation that a particular attribute has the ID type (and the name of the attribute does NOT have to be "id"). The DOM Level 2 spec doesn't provide a way to set the "id-ness" of an attribute, it has to come from the DTD/Schema at parse time.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








