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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[1] http://www.w3.org/TR/REC-xml-names/#defaulting

---------------------------
Michael Glavassevich
E-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to