Multiple xs:ID's in one schema?

This should cover W3C XML Schema, Relax NG and DTD related problems.
Vosper
Posts: 4
Joined: Thu Aug 12, 2004 3:59 pm

Multiple xs:ID's in one schema?

Post by Vosper » Thu Feb 10, 2005 1:05 am

I am writing some software to help me navigate my mp3 collection. I have designed a Schema for it, which is basically like this:

Code: Select all

<artist id="">
<album id="">
<song id="">Blah blah</song>
</album>
</artist>
Can I use multiple ID's like this? The schema validates in Oxygen but when I use getElementByID it returns null, even though the ID's match.

Vosper
Posts: 4
Joined: Thu Aug 12, 2004 3:59 pm

Post by Vosper » Thu Feb 10, 2005 1:32 am

Duh. When creating the new XML Document I had forget to the make the DocumentBuilderFactory aware of the Schema - so it was returning null because it didn't know which elements were of type "xs:ID"

I'm downloading J2SE 5 now because it seems to have better Schema integration :)

Post Reply