W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2002

looking for help...

From: Michael Case <mecase@ucdavis.edu>
Date: Wed, 16 Jan 2002 15:50:44 -0800
Message-ID: <3C4611D4.F76ACCD8@ucdhep.ucdavis.edu>
To: XSD <xmlschema-dev@w3.org>
Hi,

Please let me know if this is not the forum for this question.

My questions are: (as best as I can put it):  

1)  When you extend a type, is there anything that says the ORDER of the
internal elements is implied?  I may not understand enough to ask it
properly.

2)  Why does comment want xmlns=""???

Somehow, I think I just don't understand the right way to do things :-).

Thanks for any help.

-------------------------
A subset of our Schema is below.  It doesn't do what I want.  It fails
in the following way both with TIBCO's TurboXML and with SAX2Count from
xerces-c1_6_0-linux.  

1) (above) The error in TurboXML is:

Element "RotationSection": expected Rotation

And with SAX2Count I get:

Error at file
/home/mec/Projects/DetectorDescription/G3Convert_0_1_1/DDLSchema/DDLTestRotationInstance.xml,
line 8, char 20
  Message: Element 'comment' is not valid for content model:
'(comment*,Rotation*)'

Which happen when comment elements come after Rotation elements inside a
RotationSection... (example below).

2) (above) The error in TurboXML is:

Element "RotationSection": expected Rotation or comment (with no
namespaces)

SAX2Count I get:

Error at file
/home/mec/Projects/DetectorDescription/G3Convert_0_1_1/DDLSchema/DDLTestRotationInstance.xml,
line 6, char 12
  Message: Element 'comment' should be un-qualified

=============== XML Schema =====================

<?xml version = "1.0" encoding = "UTF-8"?>
<!--Generated by XML Authority. Conforms to w3c
http://www.w3.org/2001/XMLSchema-->
<xsd:schema xmlns = "http://www.cern.ch/cms/DDL"
	 targetNamespace = "http://www.cern.ch/cms/DDL"
	 xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
	 elementFormDefault = "unqualified"
	 attributeFormDefault = "unqualified">

	<xsd:element name = "DDDefinition" type = "DDDefinitionType"/>
	<xsd:complexType name = "DDDefinitionType">
		<xsd:sequence>
			<xsd:element ref = "Section" minOccurs = "0" maxOccurs =
"unbounded"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:element name = "Section" type = "SectionType" abstract = "true"/>
	<xsd:element name = "RotationSection" type = "RotationSectionType"
substitutionGroup = "Section"/>
	<xsd:complexType name = "SectionType">
		<xsd:sequence>
			<xsd:element name = "comment" type = "xsd:string" minOccurs = "0"
maxOccurs = "unbounded"/>
		</xsd:sequence>
		<xsd:attributeGroup ref = "SectionAttributes"/>
	</xsd:complexType>
	<xsd:attributeGroup name = "SectionAttributes">
		<xsd:attribute name = "label" use = "optional" type = "xsd:string"/>
	</xsd:attributeGroup>

	<xsd:complexType name = "RotationSectionType">
		<xsd:complexContent>
			<xsd:extension base = "SectionType">
				<xsd:sequence>
					<xsd:element ref = "Rotation" minOccurs = "0" maxOccurs =
"unbounded"/>
				</xsd:sequence>
			</xsd:extension>
		</xsd:complexContent>
	</xsd:complexType>

	<xsd:element name = "Rotation" type = "RotationType"/>
	<xsd:complexType name = "RotationType">
		<xsd:attributeGroup ref = "RotationAttributes"/>
	</xsd:complexType>
	<xsd:attributeGroup name = "RotationAttributes">
		<xsd:attribute name = "name" use = "required" type = "xsd:string"/>
		<xsd:attribute name = "theta1" use = "required" type = "xsd:float"/>
		<xsd:attribute name = "phi1" use = "required" type = "xsd:float"/>
		<xsd:attribute name = "theta2" use = "required" type = "xsd:float"/>
		<xsd:attribute name = "phi2" use = "required" type = "xsd:float"/>
		<xsd:attribute name = "theta3" use = "required" type = "xsd:float"/>
		<xsd:attribute name = "phi3" use = "required" type = "xsd:float"/>
		<xsd:attribute name = "angleUnit" use = "optional" type =
"xsd:float"/>
	</xsd:attributeGroup>
</xsd:schema>


========================= Instance example ===========================

<?xml version = "1.0" encoding = "UTF-8"?>
<DDDefinition xmlns = "http://www.cern.ch/cms/DDL" xmlns:xsi =
"http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation =
"http://www.cern.ch/cms/DDL
file:///home/mec/Projects/DetectorDescription/G3Convert_0_1_1/DDLSchema/DDLTestRotation.xsd">
	<RotationSection label = "blah">
		<comment xmlns = ""/>
		<Rotation name = "chfghfhf" theta1 = "0" phi1 = "0" theta2 = "0" phi2
= "0" theta3 = "0" phi3 = "0"/>
		<comment xmlns = ""/>
		<comment xmlns = ""/>
	</RotationSection>
</DDDefinition>


-- 

Michael E. Case
UC Davis
case@ucdhep.ucdavis.edu
(530) 754-7226
Received on Wednesday, 16 January 2002 18:52:20 GMT

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