W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2006

Re: include and targetNamespace error

From: George Cristian Bina <george@oxygenxml.com>
Date: Thu, 18 May 2006 09:48:15 +0300
Message-ID: <446C18AF.7000309@oxygenxml.com>
To: Debora Vanni <debora.vanni@tvblob.com>
CC: xmlschema-dev@w3.org, priscilla@walmsley.com

Hi Debora,

The schemas look ok, except for a couple of missing closing tags that I 
had to add to make the document wellformed. I guess the problem is in 
your instance document, or in the way you associate the schema. Make 
sure you correctly place the root element in your schema target 
namespace and if you associate the schema in file then make sure you use 
the xsi:schemaLocation for that (and not xsi:noNamespaceSchemaLocation).
Assuming the schema name is sample.xsd you can find below a valid instance:

sample.xml

<?xml version="1.0" encoding="UTF-8"?>
<message_content xmlns="http://www.tvblob3.com/TVB"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.tvblob3.com/TVB sample.xsd">
   <filter-parameters xmlns=""></filter-parameters>
</message_content>


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


Debora Vanni wrote:
> Hi!
> I have some problems with targetNamespace:
> I have a file .xsd with some simpleType that I want to use also in
> another file.xsd, so I would like to include it.
> When I do it it comes out this error
> element message_content: Schemas validity error : Element
> 'message_content': No matching global declaration available.
> (message_content is the root node of the message xml).
> I tried not to use the include and define types inside schema but it's
> the same. It only works without define targetNamespace and xmls.
> These are files...what's wrong?
> Please help me!
> 
> <?xml version="1.0"?>
> <xs:schema 
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.tvblob3.com/TVB"
> xmlns:tvb="http://www.tvblob3.com/TVB">
> 
> 
> <xs:include schemaLocation="common_types.xsd"/>
> 
> 
> <xs:element name="message_content">
> <xs:complexType>
> 	<xs:all>
> 	    	      
>         <xs:element name="filter-parameters" >
>           <xs:complexType>
> 	    <xs:all minOccurs="0">
> 
> 		<xs:element name="family-name" type="tvb:simple_text"/> 
> 				
> 		<xs:element name="first-name" type = "tvb:simple_text"/>
> 				
> 	    </xs:all>			
>          </xs:complexType>
>        </xs:element>
> 		
> 		
> 			
> 	
> </xs:element>
> 	     
> </xs:schema>
> 
> and the other file is
> <?xml version="1.0"?>
> <xs:schema 
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.tvblob3.com/TVB"
> xmlns:tvb="http://www.tvblob3.com/TVB">
> 
> <xs:simpleType name="simple_text">
>   <xs:restriction base="xs:string">
>     <xs:pattern
> value="([a-zA-Z'])+([ ])*([a-zA-Z'])*([ ])*([a-zA-Z'])*([ ])*([a-zA-Z'])*([ ])*([a-zA-Z'])*([ ])*([a-zA-Z'])*"/>
>   </xs:restriction>
> </xs:simpleType>
> 
> <xs:simpleType name="alfa_numeric_plus">
>   <xs:restriction base="xs:string">
>     <xs:pattern value="([a-zA-Z0-9])+[-_#*]*"/>
>   </xs:restriction>
> </xs:simpleType>
> 
> <xs:simpleType name="alfa_numeric">
>   <xs:restriction base="xs:string">
>     <xs:pattern value="([a-zA-Z0-9])+"/>
>   </xs:restriction>
> </xs:simpleType>
> 
> </xs:schema>
> 
> Thanks
> Debora Vanni
> debora.vanni@tvblob.com
> 
> 
> 
> 
> 
Received on Thursday, 18 May 2006 06:45:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:54 GMT