Hi,

I tried that and the error I get is (apparently fitting what I should
be waiting for):
---
line 37, error: cvc-type.3.1.1: Element 'myElement' is a simple type,
so it cannot have attributes, excepting those whose namespace name is
identical to 'http://www.w3.org/2001/XMLSchema-instance' and whose
[local name] is one of 'type', 'nil', 'schemaLocation' or
'noNamespaceSchemaLocation'. However, the attribute, 'attribute' was
found.
line 43, error: cvc-type.3.1.2: Element 'myElement' is a simple type,
so it must have no element information item [children].
line 43, error: cvc-datatype-valid.1.2.1: '' is not a valid value for 'error'.
line 43, error: cvc-type.3.1.3: The value '' of element 'myElement' is
not valid.
---
(line 37 is the beginning of my wrong element, and line 43 is at the
closing tag)

I would rather have an error saying:
---
line 37, error: cvc-enumeration-valid: Value 'value3' is not
facet-valid with respect to enumeration '[value1, value2]'. It must be
a value from the enumeration.
---
(I get this using my own complexType errors. So something like this
would be nice - it is easier to understand than the first 4 errors.)

Thanks,
Yoann



On Tue, May 4, 2010 at 11:42 AM, Mukul Gandhi <muk...@apache.org> wrote:
> On Tue, May 4, 2010 at 2:27 PM, yoann moranville
> <yoann.moranvi...@gmail.com> wrote:
>> So actually, the only way I made it work for me, is to create a new (3rd) 
>> alternative rule:
>> <xs:alternative test="(@attribute ne 'value1') and (@attribute ne 'value2')" 
>> type="myElement.error" />
>
> It seems to me, that a more appropriate way to define type
> alternatives for this example, is perhaps like, following:
>
> <xs:element name="myElement">
>    <xs:alternative test="@attribute = 'value1'" type="myElement.value1" />
>    <xs:alternative test="@attribute = 'value2'" type="myElement.value2" />
>    <xs:alternative type="xs:error" />
> </xs:element>
>
> With an element definition like above, if 1st two XPath expressions
> evaluate to false, the element would become invalid (because, it then
> maps to type, xs:error).
>
> Whereas, if the 3rd alternative also has a test attribute (which
> you've specified in your example), and all type alternatives evaluate
> to false, then the element get's the default type for the element
> (which in this case is, xs:anyType --  and therefore, the element will
> be valid in this case, if all alternatives would evaluate to false).
>
>
> --
> Regards,
> Mukul Gandhi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
> For additional commands, e-mail: j-users-h...@xerces.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to