[ 
https://issues.apache.org/jira/browse/XERCESJ-1590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13473118#comment-13473118
 ] 

Mukul Gandhi commented on XERCESJ-1590:
---------------------------------------

I agree, that there seems to be a bug as you've given an appropriate example 
for that. If you remove the following element from the schema which you've 
provided, <xs:alternative type="enAuthorType"/> (within the element 
declaration, <xs:element name="Author">) I can see that the needed 
functionality becomes available.

Great to see that, Michael has volunteered to look at this issue.
                
> 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
>            Assignee: Michael Glavassevich
>            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