Re: Some questions about xml:id
>Q1) In section 4, "The xml:id processor performs ID assignment on all >xml:id attributes, even those that do not satisfy the enumerated >constraints." Consider: > > <?xml version="1.0"?> > <root xml:id="This isn't an ID!!!!!"/> > >Does this mean that even though there is an Error, the element root >should still have the ID "This isn't an ID!!!!!" associated with it? Yes. This is already true for DTD-declared IDs: they have type ID even if they are not valid. Also, in plain XML, for a given element name, all attributes with the same name have the same type. Some APIs don't have a way to return different types for a given attribute depending on its value. >Will technologies such as XPath and DOM be expected to work with IDs >such as these? I expect they will continue to do what they do now with invalid DTD-declared IDs. >Q2) Also in section 4, "Many validation technologies impose the >constraint that an XML element can have at most one attribute of type >ID. That constraint is not imposed by xml:id processing." >So this should not raise an error: > > <?xml version="1.0"?> > <!DOCTYPE root [ > <!ELEMENT root EMPTY> > <!ATTLIST root > id ID #IMPLIED> > ]> > <root id="ID1" xml:id="ID2"/> Not an xml:id error. It will of course give you a validity error if you validate it. >I feel like this is somehow flawed. I am also left wondering how the >XPath id() function will work-- could you theoretically refer to the ><root> element using either ID1 or ID2? Again, this problem already exists. If a DTD declares that an element has two ID attributes, they both have type ID even though the document is invalid. >Q3) In section 7.2, "In addition, the following properties might be >present in the output infoset: > > * [attribute type] properties on Attribute Information Items." > >Might it also be possible to have [type definition] properties in the >output infoset as a result of ID Assignment as is specified in section >5? Does that need to be compatible here? You're right. My guess is that the only reason it's not mentioned is that the editor was only thinking about conformance to the basic infoset when he wrote section 7. -- Richard
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