Angelo created XERCESJ-1710:
-------------------------------

             Summary: XSD 1.1 all XS11AllCM#whatCanGoHere doesn't take care of 
maxOccurs="unbounded"
                 Key: XERCESJ-1710
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1710
             Project: Xerces2-J
          Issue Type: Bug
          Components: XML Schema 1.0 Structures
    Affects Versions: 2.12.0
            Reporter: Angelo


Hi all,

I consume XSCMValidator API to manage completion in XML editor based on XML 
Schema by taking care of existing XML elements and filter available elements 
according XML Schema constraints.

It works great except whis xs:all in XSD 1.1 and maxOccurs="unbound"

For instance if I have this xs:all:

------------------------------------------------------------

<xs:all>
 <xs:element name="testEle" minOccurs="1" maxOccurs="unbounded" 
type="xs:string"/>
 <xs:element name="testEleTwo" type="xs:string"/>
 </xs:all>

------------------------------------------------------------

and I have this XML file:

------------------------------------------------------------

     <t:testEle>A</t:testEle>
     <t:testEle>B</t:testEle>

|
     <t:testEleTwo>C</t:testEleTwo>

------------------------------------------------------------

If I open completion on | (after the 2 t:testEle, I would like to have 

 

 * t:testEle

 * t:testEleTwo

 

but I have only:

 * t:testEleTwo

 

After debugging Xerces, it appears that you don't take care of "unbound" in the 
XS11AllCM#whatCanGoHere.

 

You do this test:

------------------------------------------------------------

if (state[i] == STATE_START || state[i] < fMaxOccurs[i]) {

------------------------------------------------------------

although I think test should be:

------------------------------------------------------------

if (state[i] == STATE_START || state[i] < fMaxOccurs[i] || fMaxOccurs[i] == 
SchemaSymbols.OCCURRENCE_UNBOUNDED) {

------------------------------------------------------------

 

This errors occurs in the following code:

 * 
[https://github.com/apache/xerces2-j/blob/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11AllCM.java#L328]

 * 
[https://github.com/apache/xerces2-j/blob/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/models/XS11AllCM.java#L336]

 

It seems this bug doesn't affect validation since in this case 
XS11AllCM#whatCanGoHere is never called.

 

Many thank's for your help.

 

Regard's Angelo



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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

Reply via email to