Hi Tony. The default value of "processContents" for <anyAttribute> is
"strict". So if the parser fails finding the declaration of "myAttribute",
it reports an error. To solve this, you need to either provide a
declaration for "myAttribute", or write <anyAttribute processContents
="lax"/> (or ="skip", according to your need.)
Cheers,
Sandy Gao
Software Developer, IBM Canada
(1-416) 448-3255
[EMAIL PROTECTED]
Tony Zhang/San
Jose/IBM@IBMUS To: [EMAIL PROTECTED]
cc:
07/20/2001 Subject: validation problem with
<anyAttribute/>
06:00 PM
Please respond
to
xerces-j-dev
I have encounter the following problem when validating with xerces1.4.1
parser
Schema file:
<?xml version="1.0" ?>
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'
xmlns:tns="mynamespace"
targetNamespace="mynamespace"
elementFormDefault="qualified" >
<xs:element name="message" type="tns:email" />
<xs:complexType name="email" >
<xs:sequence>
<xs:element name="from" type="xs:string" />
<xs:element name="to" type="xs:string" />
<xs:any namespace="another"
minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
</xs:sequence>
<xs:anyAttribute/>
</xs:complexType>
</xs:schema>
Instance file:
<?xml version="1.0" ?>
<tns:message xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:tns="mynamespace"
xmlns:a="another"
tns:myAttribute="something"
xsi:schemaLocation='mynamespace anyAtr.xsd' >
<tns:from>[EMAIL PROTECTED]</tns:from>
<tns:to>[EMAIL PROTECTED]</tns:to>
<a:subject>Mail Down</a:subject>
<a:some>whatever</a:some>
</tns:message>
Error message:
error: Attribute "ANY---tns:myAttribute" must be declared for element type
"tns:message". line#6 col#49
If I don't have anyAttribute line in schema at all, the error message is
(understandablely)
error: Attribute "tns:myAttribute" must be declared for element type
"tns:message". line#6 col#49
What did I miss?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]