[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-j-dev
Subject:    Re: Validating ID/IDREF/IDRES with a default value...
From:       Michael Glavassevich <mrglavas () ca ! ibm ! com>
Date:       2005-09-14 14:57:28
Message-ID: OFCD523DE1.20A1AB1D-ON8525707C.004FEC50-8525707C.005229BA () ca ! ibm ! com
[Download RAW message or body]

Hi Christian,

Christian Will <christian.will@gmail.com> wrote on 09/05/2005 12:19:42 PM:

> Hi,
> 
> I have a question...
> 
> I created an element declaration with an attribute of type IDREF and a
> default value. The xml processor creates automaticaly the attribute
> with the default value, if it is absent in the instance document.
> 
> So I expected that the validator also checks ID/IDREF dependency for
> default attributes.
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
>   <xs:element name="ROOT">
>     <xs:complexType>
>       <xs:sequence>
>         <xs:element name="ELEMENT" minOccurs="0" maxOccurs="unbounded">
>           <xs:complexType>
>             <xs:attribute name="idref" type="xs:IDREF" default="ID001"/>
>             <xs:attribute name="id" type="xs:ID"/>
>           </xs:complexType>
>         </xs:element>
>       </xs:sequence>
>     </xs:complexType>
>   </xs:element>
> </xs:schema>
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="schema.xsd">
> <ELEMENT id="ID002"></ELEMENT>
> </ROOT>
> 
> For example for this instance document I expected the error
> "cvc-id.1: There is no ID/IDREF binding for IDREF 'ID001'",
> but xerces reports no error.
> 
> So maybe I'm wrong or this is a bug? Where can I find the rule for
> this case in the schema recommendation?

It's a grey area of the spec. It isn't clear whether IDREF is enforced for 
defaulted attributes. Members of the schema WG are aware of this issue and 
have opened a bug report against the spec in Bugzilla [1]. I think this is 
probably a bug, but will wait for a response from them before making any 
changes to the code.

> Cheers,
> Christian
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
> 

Thanks.

[1] http://www.w3.org/Bugs/Public/show_bug.cgi?id=2041

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic