W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2003

URN ID syntax and XML Schema

From: Nikola <nikola.stojanovic@acm.org>
Date: Thu, 23 Jan 2003 18:35:25 -0500
Message-ID: <00e001c2c338$1acfb500$76ad5f18@kubura>
To: <www-xml-schema-comments@w3.org>

I have a question related to ID syntax and how XML Schema constraints it
usage in XML instance documents. I have searched archives, but couldn't find
any explanation (examples, ...) that justify this constrant in XML Schema.
Here is a simple schema and an instance document that uses
"urn:uuid:f3373a7b-4958-4e55-8820-d03a191fb76a" as an example of an ID.

<?xml version = "1.0" encoding = "UTF-8"?>
<schema xmlns = "http://www.w3.org/2001/XMLSchema"
  targetNamespace = "urn:metaspaces:0.1"
  xmlns:tns = "urn:metaspaces:0.1">

 <complexType name = "ObjectType">
  <attribute name = "id" type = "ID"/>
 <element name = "Object" type = "tns:ObjectType"/>

<?xml version = "1.0" encoding = "UTF-8"?>
<tns:Object xmlns:tns = "urn:metaspaces:0.1" xmlns:xsi =
"http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation =
"urn:metaspaces:0.1 file:///C:/tmp/idtest.xsd" id =

XSV returns an error complaining about ":" character in an attribute.

C:\tmp>xsv idtest.xml
<?xml version='1.0'?>
<xsv xmlns='http://www.w3.org/2000/05/xsv'
     instanceAssessed="true" instanceErrors="1"
     rootType="{urn:metaspaces:0.1}:ObjectType" schemaErrors="0"
     schemaLocs="urn:metaspaces:0.1 -> file:///C:/tmp/idtest.xsd"
     target="file:///C:/tmp/idtest.xml" validation="strict"
     version="XSV 2.2-4 of 2003/01/21 23:23:04">
  <schemaDocAttempt URI="file:///C:/tmp/idtest.xsd"
                    namespace="urn:metaspaces:0.1" outcome="success"
  <invalid char="43" code="cvc-attribute.1.2" line="1"
           resource="file:///C:/tmp/idtest.xml">attribute type check failed
for {None}:id: urn:uuid:f3373a7b-4958-4e55-8
820-d03a191fb76a does not match pattern [^:]*</invalid>

My understanding of XML 1.0
(http://www.w3.org/TR/2000/WD-xml-2e-20000814#NT-Name) is that ID can have
":" characters, but XML Schema (http://www.w3.org/TR/xmlschema-2/#ID)
restricts this by forbiding the usage of ":" character
(http://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName). In this way
URN syntax is not allowed in XML Schema ID.
I suspect that this might be Namespace Recommendation issue, but could
(should) this XML Schema constraint be relaxed in the future, or there would
be (is) a way to build upon XML Schema type hierarchy and still have IDREF
semantics checked by validators when ID needs to be compliant to URN syntax?

Received on Thursday, 23 January 2003 18:35:23 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:08:59 UTC