[Home] [By Thread] [By Date] [Recent Entries]

  • From: George Cristian Bina <george@o...>
  • To: bryan rasmussen <rasmussen.bryan@g...>
  • Date: Thu, 03 May 2007 16:11:24 +0300

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
http://www.oxygenxml.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
> 


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member