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 ]

Cool - none of the examples I could find anywhere did it like that -
that's what left me confused.
From the range of examples I could find either no-one has a clue how to
use it or they're wrong..

I had read the primer...http://www.w3.org/TR/xmlschema-0/#typeContent

====================
2.5.4 anyType 
The anyType represents an abstraction called the ur-type which is the
base type from which all simple and complex types are derived. An
anyType type does not constrain its content in any way. It is possible
to use anyType like other types, for example: 

<xsd:element name="anything" type="xsd:anyType"/>

The content of the element declared in this way is unconstrained, so the
element value may be 423.46, but it may be any other sequence of
characters as well, or indeed a mixture of characters and elements. In
fact, anyType is the default type when none is specified, so the above
could also be written as follows: 

<xsd:element name="anything"/>
====================

The wording there doesn't seem particularly helpful w.r.t. your reply.
I just got the impression that what you mail says only applied to the
<any> element (your [1]), rather than anyType type.

I'll try out based on your mail - thanks.

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