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

Access to elements from schema imported once removed !

  • To: xml-dev@l...
  • Subject: Access to elements from schema imported once removed !
  • From: "Fraser Goffin" <goffinf@h...>
  • Date: Mon, 05 Sep 2005 15:03:18 +0100
  • Bcc:

xmlns imp
I have a main transcation schema which INCLUDEs a schema containing a number 
of type definitions. That schema IMPORTs another schema which contains some 
global element declarations which are used to extend one of the types in the 
import'ing schema.

Transaction schema
  --> includes base types
       --> imports global elements

When an XML instance based on the transaction schema is created that 
contains a reference to one of the global elements of the imported schema, 
XML Spy outputs the message :-

'Could not validate element <<globalElement>>. No type definition was found'

If I view the transaction schema, the imported types and elements are 
clearly visible. Can anyone tell me why the XML is invalid ??

I have attached a simplified example below :-

XML Instance Doc
===========

<?xml version="1.0" encoding="UTF-8"?>
<tns:includedRoot xmlns:tns="urn:bar" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="urn:bar includingSchema.xsd" xmlns:imp="urn:foo">
  <fromImported>
    <root>blah</root>
    <imp:globalElement>blah</imp:globalElement>
  </fromImported>
</tns:includedRoot>

transaction schema
============

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:bar"
  targetNamespace="urn:bar"
  elementFormDefault="unqualified" attributeFormDefault="unqualified">
  <xs:include schemaLocation="importingSchema.xsd"/>
    <xs:element name="includedRoot">
      <xs:complexType>
        <xs:sequence>
          <xs:element name="fromImported" type="Extended"/>
        </xs:sequence>
      </xs:complexType>
    </xs:element>
</xs:schema>


importing schema
===========

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="unqualified"
   attributeFormDefault="unqualified" xmlns:imp="urn:foo">
  <xs:import namespace="urn:foo" schemaLocation="importedSchema.xsd"/>
  <xs:complexType name="myBaseType">
    <xs:sequence>
      <xs:element name="root" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Extended">
    <xs:complexContent>
      <xs:extension base="myBaseType">
         <xs:sequence>
           <xs:element ref="imp:globalElement" minOccurs="0"/>
         </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>

imported schema
==========

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified"
  attributeFormDefault="qualified" targetNamespace="urn:foo" 
xmlns="urn:foo">
  <xs:element name="globalElement" type="xs:string"/>
</xs:schema>



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.