473,382 Members | 1,247 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Namespaces and unique IDs

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.

Sep 27 '05 #1
6 1282


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?
--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 27 '05 #2
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.

Sep 27 '05 #3


Dizzy Haze wrote:

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


xs:ID is the same as the ID type in DTDs, it applies for the whole
document so within an document any ID value needs to be unique:
<http://www.w3.org/TR/xmlschema-0/#schemaConstraintsVsXML1>
If you want to have some restricted scope for a uniqueness constraint
then use the xsd:unique construct:
<http://www.w3.org/TR/xmlschema-0/#specifyingUniqueness>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 28 '05 #4

Martin Honnen wrote:

xs:ID is the same as the ID type in DTDs, it applies for the whole
document so within an document any ID value needs to be unique:
<http://www.w3.org/TR/xmlschema-0/#schemaConstraintsVsXML1>
If you want to have some restricted scope for a uniqueness constraint
then use the xsd:unique construct:
<http://www.w3.org/TR/xmlschema-0/#specifyingUniqueness>


Thanks Martin.

Sep 28 '05 #5
Martin Honnen said the following on 2005-09-27 20:44 +0200:
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.


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?

--
Regards
Harrie
Sep 29 '05 #6
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: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
Sep 30 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Joshua Beall | last post by:
Hi All, I read in a forum somewhere that namespaces, though once supposed to be a part of PHP5, have been removed. Is this true? Can anyone show me the official statement by Zend that they...
15
by: Stuart | last post by:
I work in a small company with developers who do not like to use "new" features when they find the old ones sufficient. e.g. given a choice between a class and a namespace, they'll pick class. ...
6
by: inerte | last post by:
Hello all! I need to build an XML file structure so a client can import data to one of our systems. Totally new to XML, I learned about Namespaces and DTD, and built a nice spec using them. Now...
11
by: David Thielen | last post by:
Hi; Once I have loaded an xml file into a DOM, is there any way to then get any namespace declarations that were in the xml file? Or are those just discarded as the DOM is populated? And if...
3
by: Jon Davis | last post by:
I would like to parse RSS 1.0 (not RSS 2.0) files. But I don't know how to work with these XML namespaces! And when namespaces are improperly used in RSS 2.0 files, I don't know how to deal with...
17
by: clintonG | last post by:
Using 2.0 with Master Pages and a GlobalBaseClass for the content pages. I understand the easy part -- the hierarchical structure of a namespace naming convention -- but the 2.0 IDE does not...
1
by: Vincent V | last post by:
Hey i am just starting a new project and from the start i want to make sure my app is as Object Orientated as possible I have a couple of questions in relation to this Question 1: Should i...
2
by: tshad | last post by:
If I create multiple .dll files with the same namespace, but different classes. Is this the same thing as creating one file with one Namespace and all the classes in that namespace? If so, is...
8
by: Doogie | last post by:
You know they say there is no such thing as a dumb question? This might be the exception...I'm not sure. :) In VS.NET 2003, if you create a web service it is namespaced like so: namespace...
6
by: er | last post by:
hi, here's why i'm trying to do: header1.hpp namespace{ struct A{};} struct B1{ A a; }; header2.hpp namespace{ struct A{};}
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.