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

Re: [Moderator Action] Defining an attribute in the different namespace

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 28 Sep 2000 09:15:03 +0100
To: "Milan Trninic" <mtrninic@galdosinc.com>
Cc: <xmlschema-dev@w3.org>
Message-ID: <f5b66nhdjaw.fsf@cogsci.ed.ac.uk>
"Milan Trninic" <mtrninic@galdosinc.com> writes:

> I am trying to define an attribute in the namespace different than the target
> one for the schema. So it would look like:
> 
>  
> 
> <attribute name="newns:attrName" type="string"/>
> 
>  
> 
> I do not want to reference it <attribute ref="newns:attrName"/> since it is
> not defined there.
> 
> The xsv parser doesn't recognize the "newns:" as the namespace prefix, but as
> the part of the name.

You can't define qualified names directly -- you must define a schema
for the namespace in question, and import the definition from there:

<schema xmlns="http://www.w3.org/2000/10/XMLSchema"
targetNamespace="http://www.example.com/News">
 <attribute name="attrName" type="string"/>
</schema>

<schema xmlns="http://www.w3.org/2000/10/XMLSchema"
targetNamespace="http://www.example.com/Other"
   xmlns:newns="http://www.example.com/News"
   xmlns:my="http://www.example.com/Other">
 <import namespace="http://www.example.com/News"/>
 <complexType name="foo">
  . . .
  <attribute ref="newns:attrName"/>
</schema>

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
Received on Thursday, 28 September 2000 04:15:12 GMT

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