Inner element with schema generates EmptyStackException
-------------------------------------------------------

         Key: XERCESC-1421
         URL: http://issues.apache.org/jira/browse/XERCESC-1421
     Project: Xerces-C++
        Type: Bug
  Components: SAX/SAX2  
    Versions: 2.6.0    
 Environment: Debian unstable xerces 2.6.0
(I am the debian maintainer for xerces-c.)
    Reporter: Jay Berkenbilt


When using SAX2XMLReader, an EmptyStackException is thrown when parsing a 
document whose top-level element has no grammar but which contains a 
lower-level element that has a schema associated with it.  (Perhaps I have 
over-generalized -- example below.)  XMLSpy is able to parse this document and, 
as far as I can tell, it should be valid.  In any case, an EmptyStackException 
definitely seems to be out of order here.

To reproduce the problem, parse this document instance:

<?xml version="1.0" encoding="ASCII"?>
<x>
<test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xsi:noNamespaceSchemaLocation="test.xsd"
>1415926535</test>
</x>

with this schema:

<?xml version="1.0" encoding="ASCII"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
 <xs:element name="test" type="xs:decimal"/>
</xs:schema>

using the SAX2Print example with no special arguments (valdation scheme = 
auto).  When I do this, I get the following result:

<?xml version="1.0" encoding="LATIN1"?>
<x>
<test xsi:noNamespaceSchemaLocation="test.xsd">1415926535</test>
Fatal Error at file /u1/home/ejb/Q/bugs/xerces/empty-stack-exception/test.xml, 
line 5, char 19
  Message: An exception occurred! Type:EmptyStackException, Message:The stack 
is empty, cannot access members

Ideally, a document should be able to contain any number of nested elements 
with schemas.  This document:

<?xml version="1.0" encoding="ASCII"?>
<x>
<test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xsi:noNamespaceSchemaLocation="test.xsd"
>1415926535</test>
<y/>
<test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xsi:noNamespaceSchemaLocation="test.xsd"
>7182818284</test>
</x>

should also be okay.  With the validation scheme set to "auto", I expect to get 
schema validation errors reported for the "test" elements and well-formedness 
checking for the rest of the document.  That part seems to be working in as 
much as I can introduce an error in the first test element and see the error 
reported with val scheme = auto.

I will be traveling for the next 12 days, so I may not be able to be 
immediately responsive to responses to this bug report.  When I get a chance, 
however, I will definitely do whatever checking is requested.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
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