W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2000

Re: Namespace qualified attributes?

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Wed, 11 Oct 2000 21:29:46 +0200
Message-ID: <39E4BFAA.C516CA4@dyomedea.com>
To: Norman Walsh <ndw@nwalsh.com>
CC: xmlschema-dev@w3.org
Norman,

My understanding is that you need to define a schema per namespace.

In this case, you'd need to define a 2nd schema for the xlink namespace,
to associate it in the "main" schema though an import statement:

<import namespace="http://www.w3.org/1999/xlink"
schemaLocation="myxlink.xsd"/>

and then to reference the xlink elements and attributes

(<attribute ref='xlink:type'/>)

which will have been defined in myxlink.xsd

Hope this helps.

Eruc

Norman Walsh wrote:
> 
> User error again, I assume?
> 
> Given this document:
> 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <publoc xmlns='http://www.w3.org/2000/xmlspec'
>         xmlns:xlink="http://www.w3.org/1999/xlink">
> <loc xlink:type="simple" href="somehref">text</loc>
> </publoc>
> 
> and this schema:
> 
> <!DOCTYPE schema SYSTEM "/share/doctypes/xmlschema/XMLSchema.dtd" [
> <!ENTITY % schemaAttrs "
>         xmlns:xsd       CDATA   #IMPLIED
>         xmlns:spec      CDATA   #IMPLIED
>         xmlns:xlink     CDATA   #IMPLIED
> ">
> ]>
> <schema xmlns='http://www.w3.org/2000/10/XMLSchema'
>         targetNamespace='http://www.w3.org/2000/xmlspec'
>         xmlns:xsd='http://www.w3.org/2000/10/XMLSchema'
>         xmlns:spec='http://www.w3.org/2000/xmlspec'
>         xmlns:xlink='http://www.w3.org/1999/xlink'
>         elementFormDefault='qualified'>
> 
> <attributeGroup name='common.att'>
>   <attribute name='id' type='ID'/>
>   <attribute name='role' type='NMTOKEN'/>
> </attributeGroup>
> 
> <complexType name='publoc' mixed='true'>
>   <choice minOccurs='0' maxOccurs='unbounded'>
>     <element ref='spec:loc'/>
>   </choice>
>   <attributeGroup ref='spec:common.att'/>
> </complexType>
> 
> <complexType name='loc' mixed='true'>
>   <simpleContent>
>     <extension base="string">
>       <attributeGroup ref='spec:common.att'/>
>       <attribute name='xlink:show' use='fixed' value='replace'/>
>       <attribute name='xlink:type' use='fixed' value='simple'/>
>       <attribute name='xlink:actuate' use='fixed' value='onRequest'/>
>       <attribute name='href' use='required' type='string'/>
>     </extension>
>   </simpleContent>
> </complexType>
> 
> <element name='publoc' type='spec:publoc'/>
> <element name='loc' type='spec:loc'/>
> 
> </schema>
> 
> XSV complains:
> 
> file:///share/projects/w3c/spec-prod/schema/test.xml:4:1:undeclared
> attribute {http://www.w3.org/1999/xlink}:type
> 
> But it looks to me like I've declared it. And I can use the 'href' and
> 'id' attributes so it looks like xsv sees the complex type definition
> and doesn't object to it.
> 
> What'd I do wrong this time? :-)
> 
>                                         Be seeing you,
>                                           norm
> 
> --
> Norman Walsh <ndw@nwalsh.com> | There is a great difference between
> http://nwalsh.com/            | seeking how to raise a laugh from
>                               | everything, and seeking in everything
>                               | what may justly be laughed at.--Lord
>                               | Shaftesbury

-- 
------------------------------------------------------------------------
Eric van der Vlist       Dyomedea                    http://dyomedea.com
http://xmlfr.org         http://4xt.org              http://ducotede.com
------------------------------------------------------------------------
Received on Wednesday, 11 October 2000 15:37:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:18 GMT