[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
RE: reference to element, elementFormDefault unqualified
- From: "Antoli, Leo" <Leo.Antoli@Misys.com>
- To: Michael Kay <mike@saxonica.com>, "'Oliver Kusche'" <oli@trip.net>, xmlschema-dev@w3.org, xml-dev@lists.xml.org
- Date: Tue, 17 Oct 2006 15:11:06 +0100
Hi,
Have you used or you know of some public schema which uses
elementFormDefault="unqualified" ?
Are there good reasons to use it? Are there good reasons to avoid it?
Sorry because it's quite an open question but any thoughts about that will
be more than welcome.
Thanks.
Regards,
Leo Antoli
-----Original Message-----
From: Michael Kay [mailto:mike@saxonica.com]
Sent: 13 April 2006 16:47
To: 'Oliver Kusche'; xmlschema-dev@w3.org
Subject: RE: reference to element, elementFormDefault unqualified
elementFormDefault="unqualified" means that a locally-declared element (one
declared with <element name="x"> as part of a complex type) will be in no
namespace. (I've always thought this was a weird thing to want to do.)
Elements declared at the top level of a schema are always in the target
namespace of that schema, regardless of the value of elementFormDefault in
either their own schema document or in a referencing schema document.
You might be able to achieve what you want using chameleon includes, but
that's another strange facility that I prefer to admire from a distance.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: xmlschema-dev-request@w3.org
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Oliver Kusche
> Sent: 13 April 2006 16:01
> To: xmlschema-dev@w3.org
> Subject: reference to element, elementFormDefault unqualified
>
>
> Hi,
>
> I'm experiencing a behavior with a referenced element that I
> don't quite
> understand. I have a schema for common datatypes that defines an own
> targetNamespace. Within, I have a global element declared
> that actually is used
> by a complexType definition in the same schema, but that can also be
> independently used by an importing schema.
>
> Then I have a main schema that imports the common schema and
> defines two
> elements, one of the complex type and one referencing the
> global element.
>
> To hide namespaces from instance documents,
> elementFormDefault is set to
> unqualified.
>
> common schema:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="nscommon" xmlns="nscommon"
> elementFormDefault="unqualified">
> <xs:complexType name="LinkType">
> <xs:sequence>
> <xs:element name="sub1" type="xs:string"/>
> <xs:element ref="sub2"></xs:element>
> </xs:sequence>
> </xs:complexType>
> <xs:element name="sub2" type="xs:string"/>
> </xs:schema>
>
> main schema:
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="nsprocess" xmlns="nsprocess" xmlns:common="nscommon"
> xmlns:process="nsprocess" elementFormDefault="unqualified">
> <xs:import namespace="nscommon" schemaLocation="common.xsd"/>
>
> <xs:element name="root" type="process:rootType"/>
>
> <xs:complexType name="rootType">
> <xs:sequence>
> <xs:element name="link" type="common:LinkType"/>
> <xs:element ref="common:sub2"/>
> </xs:sequence>
> </xs:complexType>
> </xs:schema>
>
> Now the following instance document is invalid, since the
> processor seems to
> expect a namespace declaration (nscommon) for the sub2 elements.
>
> instance document:
>
> <process:root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:process="nsprocess"
> xsi:schemaLocation="nsprocess process.xsd">
> <link>
> <sub1/>
> <sub2/>
> </link>
>
> <sub2/>
>
> </process:root>
>
> However, when I set elementFormDefault to qualified in both
> schemas and qualify
> all elements in the instance document with the appropriate
> namespace, the
> document is valid.
>
> Now why is this thing behaving differently, and is there a
> way of making such a
> reference with elementFormDefault unqualified at all?
>
> cheers,
> Oli
>
> ----------------------------------------------------------------
>
>
>
>
>
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]