[ 
https://issues.apache.org/jira/browse/XERCESJ-1590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Octavian Nadolu updated XERCESJ-1590:
-------------------------------------

    Summary: Alternative type is not detected correctly  (was: Alternative type 
is not detected corectly)
    
> Alternative type is not detected correctly
> ------------------------------------------
>
>                 Key: XERCESJ-1590
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1590
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.1 Structures
>    Affects Versions: 2.11.0
>            Reporter: Octavian Nadolu
>            Priority: Trivial
>
> When I validate the following xml document with the associated schema, I get 
> the error: cvc-complex-type.2.4.a: Invalid content was found starting with 
> element 'NameFr'. One of '{NameEn}' is expected.
> There should be no error because the lang attribute is inheritable, and the 
> Author element type should be frAuthorType.
> I tested on the xml-schema-1.1-dev branch. 
> ----------XML Document-----------------
> <BookStore xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
> xsi:noNamespaceSchemaLocation="schema.xsd">
>     <Book lang="fr">
>         <TitleFr></TitleFr>
>         <Author>
>             <NameFr></NameFr>
>         </Author>
>     </Book>
> </BookStore>
> -----------------------------------------------------
> -------------- schema.xsd -----------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
> elementFormDefault="qualified">
>     <xs:element name="BookStore">
>         <xs:complexType>
>             <xs:sequence>
>                 <xs:element ref="Book" maxOccurs="unbounded"/>
>             </xs:sequence>
>         </xs:complexType>
>     </xs:element>
>     
>     <xs:element name="Book">
>         <xs:alternative test="@lang='en'" type="enType"/>
>         <xs:alternative test="@lang='fr'" type="frType"/>
>     </xs:element>
>     
>     <xs:element name="Author">
>         <xs:alternative test="@lang='en'" type="enAuthorType"/>
>         <xs:alternative test="@lang='fr'" type="frAuthorType"/>
>         <xs:alternative type="enAuthorType"/>
>     </xs:element>
>     
>     <xs:complexType name="enType">
>         <xs:sequence>
>             <xs:element name="TitleEn" type="xs:string"/>
>             <xs:element ref="Author"/>
>         </xs:sequence>
>         <xs:attribute name="lang" inheritable="true" type="xs:string"/>
>     </xs:complexType>
>     
>     <xs:complexType name="frType">
>         <xs:sequence>
>             <xs:element name="TitleFr" type="xs:string"/>
>             <xs:element ref="Author"/>
>         </xs:sequence>
>         <xs:attribute name="lang" inheritable="true" type="xs:string"/>
>     </xs:complexType>
>     
>     <xs:complexType name="enAuthorType">
>         <xs:sequence>
>             <xs:element name="NameEn" type="xs:string"/>
>         </xs:sequence>
>     </xs:complexType>
>     
>     <xs:complexType name="frAuthorType">
>         <xs:sequence>
>             <xs:element name="NameFr" type="xs:string"/>
>         </xs:sequence>
>     </xs:complexType>
> </xs:schema>
> ---------------------------------------------------------

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to