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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] Schema Sanity Check

[ Lists Home | Date Index | Thread Index ]

So I tried the suggestion, but although MSXML 4.0 seems to have no
problem, the .Net version still seems to complain about the <b> element
having no schema :S

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";>	
	<xsd:element name="name">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="first">
				   <xsd:complexType>
					<xsd:sequence>
						<xsd:any
namespace="##any" processContents="skip"  minOccurs="0"
maxOccurs="unbounded"/>
					</xsd:sequence>
				   </xsd:complexType>
				</xsd:element>
				<xsd:element name="middle"
type="xsd:string" />
				<xsd:element name="last"
type="xsd:string" />				
			</xsd:sequence>		
		</xsd:complexType>
	</xsd:element>
</xsd:schema>

<?xml version="1.0"?>
<name>
	<first><b>Steven</b></first>
	<middle />
	<last>Livingstone-Perez</last>	
</name>

-----Original Message-----
From: Dare Obasanjo [mailto:dareo@microsoft.com] 
Sent: 22 August 2002 19:24
To: Steven Livingstone; xml-dev@lists.xml.org
Subject: RE: [xml-dev] Schema Sanity Check


Looking at the complex type definition for the ur-type[0] we note that
its {content type} has a particle whose {term} is a sequence whose
{particles} contains a single {term} which is wildcard with namespace
constraint set to any. 
 
In short, the content of a complex type of type xs:anyType is anything
from any namespace. However, the default value of processContents[1] for
a wildcard is strict meaning that a schema must be provided for each of
the elements [or attributes] that appear in the content model. 
 
So you can either provide a schema for all the extra elements and
attributes appearing as part of the <first> element or create a type
whose wildcard has processContents set to skip or lax and use that type
instead of xs:anyType. 
 
 
[0] http://www.w3.org/TR/xmlschema-1/#ur-type-itself 
[1] http://www.w3.org/TR/xmlschema-1/#process_contents

	-----Original Message----- 
	From: Steven Livingstone [mailto:s.livingstone@btinternet.com] 
	Sent: Thu 8/22/2002 10:44 AM 
	To: xml-dev@lists.xml.org 
	Cc: 
	Subject: [xml-dev] Schema Sanity Check
	
	

	Do the following Schema and instance look ok?
	I keep getting an error saying the "<b>" elements are not
declared, but
	the type if first is anyType so should this not be anything I
want??
	Tried using MSXML 4.0 and .Net Schema classes.
	
	<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";>      
	        <xsd:element name="name">
	                <xsd:complexType>
	                        <xsd:sequence>
	                                <xsd:element name="first"
	type="xsd:anyType" />          
	                                <xsd:element name="middle"
	type="xsd:string" />
	                                <xsd:element name="last"
	type="xsd:string" />                           
	                        </xsd:sequence>        
	                </xsd:complexType>
	        </xsd:element>
	</xsd:schema>
	
	<?xml version="1.0"?>
	<name xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	        xsi:noNamespaceSchemaLocation="schema.xsd">
	        <first><b>Steven</b></first>
	        <middle />
	        <last>Livingstone-Perez</last> 
	</name>
	
	Thanks,
	Steven
	
	
	
	
-----------------------------------------------------------------
	The xml-dev list is sponsored by XML.org <http://www.xml.org>,
an
	initiative of OASIS <http://www.oasis-open.org>
	
	The list archives are at http://lists.xml.org/archives/xml-dev/
	
	To subscribe or unsubscribe from this list use the subscription
	manager: <http://lists.xml.org/ob/adm.pl>
	
	







 

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

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