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

RE: Miscellaneous questions

  • From: johns@s... (John F. Schlesinger)
  • To: "Xml-Dev \(E-mail\)" <xml-dev@x...>
  • Date: Tue, 13 Jun 2000 18:46:05 -0400

the name elsa
Diddier,
I think you need to define <element name="MainTag" /> in the main schema.

Also, I think you need a namespace definition for the targetnamespace in the
imported schema.

Given those, I think the example is right. However, I have tried to use XML
Spy to verify this and cannot get XML Spy (version 3.0) to handle <import>
correctly.

Yours,
John F Schlesinger
SysCore Solutions
212 619 5200 x 219
917 886 5895 Mobile

-----Original Message-----
From: owner-xml-dev@x... [mailto:owner-xml-dev@x...]On Behalf Of
Didier Perhirin
Sent: Tuesday, June 13, 2000 10:06 AM
To: 'xmlschema-dev@w...'
Cc: 'xml-dev@x...'
Subject: Miscellaneous questions



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
mean
that an XML instance validated by this schema may have different root
elements
according to the defined global element.
Concretely, if I declare a schema
<schema>
	<element name="A" type="string"/>
	<element name="B" type="string"/>
</schema>
are both following document instances valid :

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

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

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:complexType>
			 <xsd:element name="B" type="xsd:string" minOccurs="0"/>
				<xsd:choice>
					<xsd:element name="A" type="xsd:integer"/>
					<xsd:element name="B" type="xsd:integer"/>
				</xsd:choice>
		</xsd:complexType>
	</xsd:element>
</xsd:schema>

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
imported_schema_ns:

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

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"
	xmlns:imp="imported_schema_ns">
        <xsd:import namespace="imported_schema_ns"
schemaLocation="imp_schema.xsd"/>
	<xsd:element name="lion" type="imp:animal"/>
</xsd:schema>

Is the following XML document valid:

<x:MainTag xmlns:x="main_schema_ns"
	xsi:schemaLocation="main_schema_ns main_schema.xsd">
	<x:lion><x:name>Elsa</x:name></x:lion>
</x:MainTag>

or is this one better:

<x:MainTag xmlns:x="main_schema_ns"
	xmlns:y="imported_schema_ns"
	xsi:schemaLocation="main_schema_ns main_schema.xsd
				imported_schema_ns imp_schema.xsd">
	<x:lion><y:name>Elsa</y:name></x:lion>
</x:MainTag>

Thanks for the answers,

Regards,

Didier Perhirin
CosmosBay

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


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

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.