You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Doron Rosenberg <do...@gmail.com> on 2005/09/07 23:42:20 UTC
xsd:attribute and ref issue
I am having a problem I can't figure with xsd:attribute and ref=""
Given:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" targetNamespace="http://schema/test"
xmlns:test="http://schema/test">
<xs:attribute name="eek" type="xs:boolean"/>
<xs:element name="balance7">
<xs:complexType>
<xs:attribute ref="test:eek"/>
</xs:complexType>
</xs:element>
</xs:schema>
and:
<?xml version="1.0" encoding="UTF-8"?>
<balance7 xmlns:test="http://schema/test"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://schema/test" eek="true"></balance7>
Trying to validate the xml file against the schema using xerces-j
(latest release) returns:
SystemID: /home/doron/temp/Untitled1.xml
Location: 3:43
Description: E cvc-complex-type.3.2.2: Attribute 'eek' is not allowed
to appear in element 'balance7'.
URL: http://www.w3.org/TR/xmlschema-1/#cvc-complex-type
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: xsd:attribute and ref issue
Posted by Michael Glavassevich <mr...@apache.org>.
On Wed, 7 Sep 2005, Doron Rosenberg wrote:
> I am having a problem I can't figure with xsd:attribute and ref=""
>
> Given:
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified" targetNamespace="http://schema/test"
> xmlns:test="http://schema/test">
> <xs:attribute name="eek" type="xs:boolean"/>
>
> <xs:element name="balance7">
> <xs:complexType>
> <xs:attribute ref="test:eek"/>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> and:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <balance7 xmlns:test="http://schema/test"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns="http://schema/test" eek="true"></balance7>
The default namespace [1] does not apply to attributes. Adding a prefix to
'eek' should fix the problem.
> Trying to validate the xml file against the schema using xerces-j
> (latest release) returns:
> SystemID: /home/doron/temp/Untitled1.xml
> Location: 3:43
> Description: E cvc-complex-type.3.2.2: Attribute 'eek' is not allowed
> to appear in element 'balance7'.
> URL: http://www.w3.org/TR/xmlschema-1/#cvc-complex-type
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>
>
[1] http://www.w3.org/TR/REC-xml-names/#defaulting
---------------------------
Michael Glavassevich
E-mail: mrglavas@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org