W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2010

Re: phantom attribute?

From: Noah Mendelsohn <nrm@arcanedomain.com>
Date: Wed, 29 Sep 2010 17:09:33 -0400
Message-ID: <4CA3AB0D.7050803@arcanedomain.com>
To: David McBride <dmcbride@codeaurora.org>
CC: xmlschema-dev@w3.org
David:  I don't have an answer, but I suspect it would help if you 
indicated which parser you used, and any other such details that might 
affect what you're seeing.  Thank you.

Noah

On 9/29/2010 3:48 PM, David McBride wrote:
> I’m seeing some odd behavior when I parse XML with the schema that I just
> developed. In particular, there are two elements, ‘signal’ and ‘method’,
> which may contain an element, ‘arg’. In the case of ‘method’, the element
> ‘arg’ may have a ‘direction’ attribute. However, in the case of ‘signal’,
> the ‘arg’ element may NOT have a ‘direction’ attribute.
>
> I’ve represented this in my schema, as follows:
>
> <xs:complexType name="signal_arg_type">
>
> <xs:sequence>
>
> <xs:element maxOccurs="unbounded" minOccurs="0" ref="annotation"/>
>
> </xs:sequence>
>
> <xs:attribute ref="name"/>
>
> <xs:attribute name="type" type="arg_and_property_type" use="required"/>
>
> </xs:complexType>
>
> <xs:complexType name="method_arg_type">
>
> <xs:attribute ref="name"/>
>
> <xs:attribute name="type" type="arg_and_property_type" use="required"/>
>
> <xs:attribute default="in" name="direction" type="arg_direction"/>
>
> </xs:complexType>
>
> <xs:element name="method">
>
> <xs:complexType>
>
> <xs:choice maxOccurs="unbounded" minOccurs="0">
>
> <xs:element maxOccurs="unbounded" minOccurs="0" ref="annotation"/>
>
> <xs:element maxOccurs="unbounded" minOccurs="0" name="arg"
> type="method_arg_type"/>
>
> </xs:choice>
>
> <xs:attribute ref="name" use="required"/>
>
> </xs:complexType>
>
> </xs:element>
>
> <xs:element name="signal">
>
> <xs:complexType>
>
> <xs:choice maxOccurs="unbounded" minOccurs="0">
>
> <xs:element maxOccurs="unbounded" minOccurs="0" name="arg"
> type="signal_arg_type"/>
>
> <xs:element maxOccurs="unbounded" minOccurs="0" ref="annotation"/>
>
> </xs:choice>
>
> <xs:attribute ref="name" use="required"/>
>
> </xs:complexType>
>
> </xs:element>
>
> Strangely enough, when I parse XML with signal elements, I end up with
> SAXParseExceptions that say that the ‘arg’ element in ‘signal’ is not
> allowed to have a ‘direction’ attribute, even though the xml that caused
> the exception does not contain the ‘direction’ attribute!! For example,
> here is one of the elements that causes the exception:
>
> <signal name="DeviceAdded">
>
> <arg name="udi" type="s"/>
>
> </signal>
>
> As you can see, there’s no ‘direction’ attribute. How is it possible that
> my parser could be throwing these exceptions, given the schema that I
> described above?!
>
> Thanks, in advance, for any feedback.
>
Received on Wednesday, 29 September 2010 21:10:30 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:18 UTC