W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2000

Element names

From: Daniel Acton <dacton@itouch.co.za>
Date: Sat, 2 Dec 2000 20:56:31 +0200 (SAST)
To: xmlschema-dev@w3.org
Message-ID: <Pine.BSF.4.21.0012022025290.55438-100000@alcapone.intouch.co.za>


I am trying to make an xmlschema to vaalidate different instances of an
xml document. Do I have to explicitly name the elements in the schema, or
can I make an element be recognised by it's attributes. Here's a scenario:

--First instance--
  <sleep time="10" energy="5joules"/>
  <walk time="10km" energy="10joules"/>

--Second instance--
  <sleep time="25" energy="14joules"/>
  <stroll distance="2km" energy="50joules"/>


<xsd:element name="sleep" type="activityType"/>
<xsd:element name="walk" type="activityType"/>

  <xsd:attribute name="distance" type="xsd:string"/>
  <xsd:attribute name="energy" type="xsd:string"/>

The above schema, I assume, and once again am standing to correction,
would validate the first instance, but not the second. I have tried
something similar, and have received the following:  
 > Element 'stroll' not expected

Is there a way I can tell the schema to expect an element with those
attributes, but not explicitly state the name?

Thank you in advance
Received on Saturday, 2 December 2000 14:00:17 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:14:48 UTC