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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Xerces error report "attribute 'foo' should be qualified"

[ Lists Home | Date Index | Thread Index ]

In my search for a truly conformant W3C schema validating parser (*is* there
really such an animal?) I've just started trying to use Xerces-C (C++, Win
32, VC6).  Running the Xerces examples (Sax2Count, for instance) on a simple
document I'm getting some errors that are puzzling me. (I've included the
full content of my instance and schema files at the end of this e-mail.)

Given the following element in my instance document:

<person foo="eh?" bar="what?" legibility="excellent">John Atchley</person>

I am getting the following errors (two of them I WOULD expect).  I've added
my puzzlement / comments in brackets:

[1]
Error at file D:\XML\testschema.xml, line 7, char 55
  Message: Attribute 'foo' should be qualified

[This error (and the others like it that follow) are most puzzling error to
me.  If I qualify this (xmlns:foo="eh?") this message goes away.  However,
WHY should I need to qualify this when it is defined in the default
namespace and the parser is obviously finding it in the declaration of
element person in the schema?]

[2]
Error at file D:\XML\testschema.xml, line 7, char 55
  Message: Attribute '{}bar' is not declared for element 'person'

[This error does NOT surprise me.  Attribute bar is not defined for element
person.  I inserted this just to see if the parser was actually finding the
declaration of the element person, which it obviously is.  Which only
increases my puzzlement at error 1 above.]

[3]
Error at file D:\XML\testschema.xml, line 7, char 55
  Message: Attribute 'legibility' should be qualified

[This is the same as error 1 above.  Not only is the parser obviously
finding the declaration of element person with that element's attributes, it
is also properly parsing the declaration of this (referenced) attribute
itself, as evidenced by the next error message!]

[4]
Error at file D:\XML\testschema.xml, line 7, char 55
  Message: Datatype error: Type:InvalidDatatypeValueException, Message:Value
'excellent' is not in enumeration .

[This error does NOT surprise me.  I intentionally used an invalid value to
make sure that the parser was actually evaluating the attribute declaration
correctly.]

I appreciate any help anyone here can shed on this.  If it's a problem with
Xerces I'll hit bugzilla and maybe look at finding the source of the problem
myself.  If it's something about schemas that I don't understand then I
*really* need help!

Thanks,
John Atchley
Senior Software Analyst
Engineering and Design, Courseware Support
FlightSafety International, Inc.
mailto:John.Atchley@FlightSafety.com



=====================================================================
The following is my complete schema file:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
	targetNamespace="http://notarealurl.com/sourcedata/2002_01_31";
	xmlns="http://notarealurl.com/sourcedata/2002_01_31";
	elementFormDefault="qualified"
	attributeFormDefault="qualified">
  
	
	<xs:element name="abstract">
		<xs:complexType mixed="true">
			<xs:all>
				<xs:element name="title" type="xs:string"
minOccurs="1" maxOccurs="1"/>
				<xs:element ref="person" minOccurs="0"
maxOccurs="1"/>
			</xs:all>
		</xs:complexType>
	</xs:element>
	<xs:element name="date" type="srcstr"/>
	<xs:element name="person">
		<xs:complexType mixed="true">
			<xs:all>
				<xs:element name="surname" type="srcstr"
minOccurs="0" maxOccurs="1"/>
				<xs:element name="maidenname" type="srcstr"
minOccurs="0" maxOccurs="1"/>
				<xs:element name="givenname" type="srcstr"
minOccurs="0" maxOccurs="1"/>
				<xs:element name="nickname" type="srcstr"
minOccurs="0" maxOccurs="1"/>
				<xs:element name="titleprefix" type="srcstr"
minOccurs="0" maxOccurs="1"/>
				<xs:element name="titlesuffix" type="srcstr"
minOccurs="0" maxOccurs="1"/>
			</xs:all>
			<xs:attributeGroup ref="globalAttributes"/>
			<xs:attribute name="foo" type="xs:string"
use="optional"/>
		</xs:complexType>
	</xs:element>
	
	<xs:complexType name="srcstr">
		<xs:annotation>
			<xs:documentation>
				snipped for brevity
			</xs:documentation>
		</xs:annotation>
		<xs:attributeGroup ref="globalAttributes"/>
	</xs:complexType>
	
	<xs:attributeGroup name="globalAttributes">
		<xs:attribute name="legibility" type="legibilityType"
default="normal"/>
		<xs:attribute name="correction" type="xs:string"
use="optional"/>
		<xs:attribute name="reason" type="xs:string"
use="optional"/>
		<xs:attribute name="category" type="categoryType"
use="optional"/>
		<xs:attribute name="id" type="xs:string" use="optional"/>
	</xs:attributeGroup>
		
	<!-- for legibility attributes -->
	<xs:simpleType name="legibilityType">
	 	<xs:restriction base="xs:string">
			<xs:enumeration value="poor"/>
			<xs:enumeration value="normal"/>
			<xs:enumeration value="good"/>
		</xs:restriction>
	</xs:simpleType>
  
	<!-- for (correction) category attributes -->
	<xs:simpleType name="categoryType">
  	<xs:restriction base="xs:string">
			<xs:enumeration value="spelling"/>
			<xs:enumeration value="refuted"/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>

============================================================================
=
Following is my complete instance file:

<?xml version="1.0" encoding="UTF-8"?>
<abstract
	xmlns="http://notarealurl.com/sourcedata/2002_01_31";
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	xsi:schemaLocation="http://notarealurl.com/sourcedata/2002_01_31
gensrcschema.xsd">
	<title>This are a title</title>
	<person foo="eh?" bar="what?" legibility="excellent">John
Atchley</person>
</abstract>

============================================================================
===





 

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

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