[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: reference to element, elementFormDefault unqualified

  • From: "Antoli, Leo" <Leo.Antoli@M...>
  • To: Michael Kay <mike@s...>, "'Oliver Kusche'" <oli@t...>, xmlschema-dev@w..., xml-dev@l...
  • Date: Tue, 17 Oct 2006 15:11:06 +0100

xs schema elementformdefault
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@s...] 
Sent: 13 April 2006 16:47
To: 'Oliver Kusche'; xmlschema-dev@w...
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@w... 
> [mailto:xmlschema-dev-request@w...] On Behalf Of Oliver Kusche
> Sent: 13 April 2006 16:01
> To: xmlschema-dev@w...
> 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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.