Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: reference to element, elementFormDefault unqualified

From: George Cristian Bina <george@---------.--->
To: Oliver Kusche <oli@----.--->
Date: 4/13/2006 9:35:00 PM
Hi Oliver,

The schema/@elementFormDefault an element/@form apply to local elements 
and not to global elements. Global elements are always defined in the 
schema target namespace.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
www.---.com


Oliver Kusche wrote:
> 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
> 
> ----------------------------------------------------------------
> 
> 
> 
> 

From mike@s... Thu Apr 13 15:46:39 2006
Received: from maggie.w3.org ([193.51.208.68])
	by frink.w3.org with esmtp 


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent