Namespaces and unique IDs

D

Dizzy Haze

This is probably a really dumb question, but I'm trying to get my head
around what's going on here.

I have this in my document:

<div xml:id="Area_0">
<svg xmlns="http://www.w3.org/2000/svg">
<rect svg:id="Area_0" x="49" y="116" width="64" height="64"/>
<rect svg:id="Area_1" x="250" y="272" width="128" height="130"/>
</svg>
</div>

This will not validate because there are two attribute of the type
xs:ID with the same value (Area_0) in the document.

Is this correct? I'm wondering if the different namespaces, xml:id and
svg:id, should cause the IDs to be considered independently of one
another. Or does an ID type apply everywhere, regardless of namespace?

Thanks.
 
M

Martin Honnen

Dizzy Haze wrote:

I have this in my document:

<div xml:id="Area_0">
<svg xmlns="http://www.w3.org/2000/svg">
<rect svg:id="Area_0" x="49" y="116" width="64" height="64"/>
<rect svg:id="Area_1" x="250" y="272" width="128" height="130"/>
</svg>
</div>

This will not validate because there are two attribute of the type
xs:ID with the same value (Area_0) in the document.

The prefix svg for those svg:id attributes is not even bound to a
namespace URI so I doubt you get to validation at all, that is not
well-formed.


And what schema do you try to validate against?
 
D

Dizzy Haze

The example is just a snippet. The actual document is well-formed.

Basically, what I'm wanting to know is if the xs:ID type applies across
all namespace IDs. That's it.
 
M

Martin Honnen

H

Harrie

Martin Honnen said the following on 2005-09-27 20:44 +0200:
The prefix svg for those svg:id attributes is not even bound to a
namespace URI so I doubt you get to validation at all, that is not
well-formed.

Can you elaborate? It looks well formed to me. What am I missing? I agree that svg:id is not bound to a namespace, but that's an attribute (of the rect element) and I thought well formedness has to do with elements.

Would it validate if "svg:id" was replaced by simply "id" since the default namespace (taken there is one somewhere in the document) is overriden by the namespace in the svg element?
 
H

Henry S. Thompson

xml:id [1], which is new, identifies its value as an ID. A conformant
processor adds that to the things known to be IDs as a result of
whatever other schema language it supports, e.g. DTD or W3C XML
Schema, to detect conflicts. Assuming your document has a declaration
which in some way makes svg:id of type ID, then yes, that document is
not valid per xml:id.

ht

[1] http://www.w3.org/TR/xml-id/
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: (e-mail address removed)
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,001
Messages
2,570,254
Members
46,849
Latest member
Fira

Latest Threads

Top