Hi Martin,

In DONTWORK.addr.xsd, the schema components are defined in the
targetNamespace of the schema. So, if you refer to any global components
of that schema, you need to qualify them (i.e. use a prefix that will resolve to

the schema target namespace). Here is a link to the QName resolution
constraint as defined in the schema spec:
http://www.w3.org/TR/xmlschema-1/#src-resolve.

You need to change your schema to declare a prefix that maps to the
schema's targetNamespace, and use that prefix when refering to global
declarations.

e.g.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
  xmlns:co="http://www.my.co.nz"; targetNamespace="http://www.my.co.nz";>

   <!-- Definition of simple type elements -->

   <xs:simpleType name="addressline">
         <xs:restriction base="xs:string">
               <xs:maxLength value="30"/>
         </xs:restriction>
   </xs:simpleType>

   <xs:complexType name="address">
         <xs:sequence>
             <xs:element name="line1" type="co:addressline" minOccurs="1"
maxOccurs="1"/>
             <xs:element name="line2" type="co:addressline" minOccurs="0"
maxOccurs="1"/>
             <xs:element name="line3" type="co:addressline" minOccurs="0"
maxOccurs="1"/>
         </xs:sequence>
...
...
</xs:schema>

Regards,
Khaled

Martin Wilson wrote:

> Hi all,
>
> I have a problem validating a document that uses 'TargetNamespace' in the
> schema and 'schemaLocation' in the document.
> i get "Line: 3, Column: 154, Error: Type not found in :addressline" from the
> parser when trying to validate this document.
>
> The other version work fine when put through the DOM_Parser - it uses
> 'noNamespaceSchemaLocation'.
>
> This is probably a lack of understanding on my part bu what makes these two
> documents different and why ????
>
> Many thanks in advance.
>
>  <<DONTWORK.addr.xml>>  <<DONTWORK.addr.xsd>>  <<addr.xml>>  <<addr.xsd>>
>
> Martin Wilson
> Transport Systems Division
>
> The information contained in this email is privileged and confidential and
> intended for the addressee only. If you are not the intended recipient, you
> are asked to respect that confidentiality and not disclose, copy or make use
> of its contents. If received in error you are asked to destroy this email
> and contact the sender immediately. Your assistance is appreciated.
>
>   ------------------------------------------------------------------------
>                         Name: DONTWORK.addr.xml
>    DONTWORK.addr.xml    Type: XML Document (text/xml)
>                     Encoding: base64
>
>    DONTWORK.addr.xsdName: DONTWORK.addr.xsd
>                     Type: unspecified type (application/octet-stream)
>
>    addr.xmlName: addr.xml
>            Type: XML Document (text/xml)
>
>    addr.xsdName: addr.xsd
>            Type: unspecified type (application/octet-stream)
>
>   ------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to