[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

  • To: xml-dev@l...
  • Subject: Xerces error report "attribute 'foo' should be qualified"
  • From: "Atchley, John" <John.Atchley@f...>
  • Date: Tue, 12 Feb 2002 14:19:48 -0500

attribute should be qualified
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@F...



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

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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.