Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xml-dev] what is the meaning of elementFormDefault="qualified"in a schema without a targetnamespace?

From: George Cristian Bina <george@---------.--->
To: bryan rasmussen <rasmussen.bryan@-----.--->
Date: 5/3/2007 1:12:00 PM
Hi Bryan,

The target namespace for that schema is absent. If you include the 
schema from another one that has a target namespace then the components 
from that schema will have that target namespace (I believe this is 
called chameleon schema).
See an example below:

test.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
targetNamespace="http://example.com">
     <xs:include schemaLocation="common.xsd"/>
</xs:schema>

common.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified">
     <xs:element name="test">
         <xs:complexType>
             <xs:sequence>
                 <xs:element name="a"/>
                 <xs:element name="b"/>
             </xs:sequence>
         </xs:complexType>
     </xs:element>
</xs:schema>

The following instance is valid against test.xsd

<?xml version="1.0" encoding="UTF-8"?>
<test xmlns="http://example.com"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://example.com test.xsd">
     <a></a>
     <b></b>
</test>

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


bryan rasmussen wrote:
> Hi,
> As per the subject line.
> 
> I am looking over a rather big application with some XML schemas in
> which elementFormDefault is always given as qualified but there is no
> targetNamespace. This strikes me as weird because the implication is
> that one would have instances like this
> 
> <t:test xmlns:t="" xsi:schemaLocation="myschema.xsd"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
> 
> which by my understanding would be very illegal.
> 
> Cheers,
> Bryan Rasmussen
> 
> _______________________________________________________________________
> 
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
> 
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@l...
> subscribe: xml-dev-subscribe@l...
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
>


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