[
Lists Home |
Date Index |
Thread Index
]
- To: xml-dev@lists.xml.org
- Subject: RE: [xml-dev] Access to elements from schema imported once removed !
- From: "Fraser Goffin" <goffinf@hotmail.com>
- Date: Mon, 05 Sep 2005 15:36:59 +0100
- Bcc:
- In-reply-to: <74B14CBC0FEB9D4EB16969F09FA51F45510038@MCLNEXVS08.resource.ds.bah.com>
Sorry, will do.
Fraser.
>From: "Chiusano Joseph" <chiusano_joseph@bah.com>
>To: "Fraser Goffin" <goffinf@hotmail.com>
>Subject: RE: [xml-dev] Access to elements from schema imported once removed
>!
>Date: Mon, 5 Sep 2005 10:34:12 -0400
>
>Please send to XML-DEV and I will respond there. Thanks.
>
>________________________________
>
>From: Fraser Goffin [mailto:goffinf@hotmail.com]
>Sent: Mon 9/5/2005 10:30 AM
>To: Chiusano Joseph
>Subject: RE: [xml-dev] Access to elements from schema imported once removed
>!
>
>
>
>Joe,
>
>the "imported schema" is declared with a targetNamespace or 'urn:foo' and a
>default namespace of 'urn:foo', and the element declaration is at global
>level. That puts it firmly in the urn:foo namespace does it not ?
>
>Fraser.
>
>
> >From: "Chiusano Joseph" <chiusano_joseph@bah.com>
> >To: "Fraser Goffin" <goffinf@hotmail.com>, <xml-dev@lists.xml.org>
> >Subject: RE: [xml-dev] Access to elements from schema imported once
>removed
> >!
> >Date: Mon, 5 Sep 2005 10:18:14 -0400
> >
> >From a quick glance, in your "imported schema", element "globalElement is
> >not in the "urn:foo" namespace because it does not have a namespace
>prefix,
> >and you have not specified a default namespace for that schema. If you
>add
> >a default namespace declaration to the imported schema that makes the
> >"urn:foo" namespace your default namespace, it should work.
> >
> >Joe Chiusano
> >
> >________________________________
> >
> >From: Fraser Goffin [mailto:goffinf@hotmail.com]
> >Sent: Mon 9/5/2005 10:03 AM
> >To: xml-dev@lists.xml.org
> >Subject: [xml-dev] Access to elements from schema imported once removed !
> >
> >
> >
> >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>
> >
> >
> >
> >-----------------------------------------------------------------
> >The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> >initiative of OASIS <http://www.oasis-open.org>
> >
> >The list archives are at http://lists.xml.org/archives/xml-dev/
> >
> >To subscribe or unsubscribe from this list use the subscription
> >manager: <http://www.oasis-open.org/mlmanage/index.php>
> >
> >
> >
>
>
>
>
|