OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Miscellaneous questions

[ Lists Home | Date Index | Thread Index ]
  • From: Didier Perhirin <dperhirin@smtp2.cosmosbay.com>
  • To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
  • Date: Tue, 13 Jun 2000 16:06:28 +0200

I'm a newbie in XML Schema definitions, and I have some questions about it.
I'm sorry if the answers are trivial.

1- When we define more than one global element inside a schema, does it 
that an XML instance validated by this schema may have different root 
according to the defined global element.
Concretely, if I declare a schema
	<element name="A" type="string"/>
	<element name="B" type="string"/>
are both following document instances valid :

<?xml version="1.0"?>
<!-- doc1.xml -->

<?xml version="1.0"?>
<!-- doc2.xml -->

or, just the first one ?

2-This schema defined below is validated by the W3C xmlschema-check CGI :

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema">
	<xsd:element name="root">
			 <xsd:element name="B" type="xsd:string" minOccurs="0"/>
					<xsd:element name="A" type="xsd:integer"/>
					<xsd:element name="B" type="xsd:integer"/>

but, how can a parser do the difference between the use of the first 
element B and the use  the second element B which is defined into the 
choice group.
I thought this schema was not correct, due to an ambiguity.

3- This question is about targetNamespace and the <import> element

Suppose I have a schema which defined a complexType with a targetNamespace 

schema imp_schema.xsd:
<xsd:schema targetNamespace="imported_schema_ns">
	<xsd:complexType name="animal">
		<xsd:element name="name" type="xsd:string"/>

This schema is imported inside a main schema main_schema.xsd, which have a 
different targetNamespace main_schema_ns:

<xsd:schema targetNamespace="main_schema_ns"
        <xsd:import namespace="imported_schema_ns"
	<xsd:element name="lion" type="imp:animal"/>

Is the following XML document valid:

<x:MainTag xmlns:x="main_schema_ns"
	xsi:schemaLocation="main_schema_ns main_schema.xsd">

or is this one better:

<x:MainTag xmlns:x="main_schema_ns"
	xsi:schemaLocation="main_schema_ns main_schema.xsd
				imported_schema_ns imp_schema.xsd">

Thanks for the answers,


Didier Perhirin

This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS