[jira] [Updated] (XERCESC-2060) Reopening of Issue XERCESC-1187 Xerces SAX2 parser can not skip xs:any if xsi:nil is used in xml
[ https://issues.apache.org/jira/browse/XERCESC-2060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Nuckols updated XERCESC-2060: -- Description: Issue 1187 not completely resolved. The following modification to that issue shows that when xsi:nil="true" is encountered within an section in a top level element, the parser complains that the entire node should be empty. schema: http://www.w3.org/2001/XMLSchema; xmlns="http://www.w3schools.com; elementFormDefault="qualified" targetNamespace="http://www.w3schools.com;> example: http://www.w3schools.com; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://www.w3schools.com note.xsd"> Tove Jani result from schema validation: ../StdInParse -n -s < test.xml Error at (file stdin, line 11, char 8): element 'note' is nil and must be empty I debugged the issue within the IGXMLScanner code and know the root cause: Internally, as attributes are scanned per element in the scanner method: scanRawAttrListforNameSpaces() the validator object is modified when any xsi:nil="true" is encountered. This is normally fine when the actual element will be validated (i.e. fValidate == true) because the checkContent() method of the validator is called during the scanEndTag() method, resetting the state of fNil/fNilFound. When fValidate == false (i.e. within a tag with processContents="skip"), scanRawAttrListforNameSpaces continues to modify the fNil/fNilFound variables within the validator on an element by element case. Therefore if the last element in the block has xsi:nil="true" when the final scanEndTag() for the parent element is called the state of the fNil/fNilFound variables in the validator are left incorrect. I think the solution might be to store the fNil/fNilFound states within the element stack so that as scanEndTag calls fire off, the correct state is maintained. was: Issue 1187 not completely resolved. The following modification to that issue shows that when xsi:nil="true" is encountered within an section in a top level element, the parser complains that the entire node should be empty. schema: http://www.w3.org/2001/XMLSchema; xmlns="http://www.w3schools.com; elementFormDefault="qualified" targetNamespace="http://www.w3schools.com;> example: http://www.w3schools.com; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://www.w3schools.com note.xsd"> Tove Jani result from schema validation: ../StdInParse -n -s < test.xml Error at (file stdin, line 11, char 8): element 'note' is nil and must be empty I debugged the issue within the IGXMLScanner code and know the root cause: Internally, as attributes are scanned per element in the scanner method: scanRawAttrListforNameSpaces() the validator object is modified when any xsi:nil="true" is encountered. This is normally fine when the actual element will be validated (i.e. fValidate == true) because the checkContent() method of the validator is called during the scanEndTag() method, resetting the state of fNil/fNilFound When fValidate == false (i.e. within a tag with processContents="skip"), scanRawAttrListforNameSpaces continues to modify the fNil/fNilFound variables within the validator on an element by element case. Therefore if the last element in the block has xsi:nil="true" when the final scanEndTag() for the parent element is called the state of the fNil/fNilFound variables in the validator are left incorrect. I think the solution might be to store the fNil/fNilFound states within the element stack so that as scanEndTag calls fire off, the correct state is maintained. > Reopening of Issue XERCESC-1187 Xerces SAX2 parser can not skip xs:any if > xsi:nil is used in xml > > > Key: XERCESC-2060 > URL: https://issues.apache.org/jira/browse/XERCESC-2060 > Project: Xerces-C++ > Issue Type: Bug > Components: Validating Parser (XML Schema) >Affects Versions: 3.1.2 > Environment: Linux Intel 64 Bit >Reporter: Eric Nuckols > > Issue 1187 not completely resolved. > The following modification to that issue shows that when xsi:nil="true" is > encountered within an section in a top level element, the parser > complains that the entire node should be empty. > schema: > > http://www.w3.org/2001/XMLSchema; > xmlns="http://www.w3schools.com; > elementFormDefault="qualified" > targetNamespace="http://www.w3schools.com;> > > > > > >
[jira] [Updated] (XERCESC-2060) Reopening of Issue XERCESC-1187 Xerces SAX2 parser can not skip xs:any if xsi:nil is used in xml
[ https://issues.apache.org/jira/browse/XERCESC-2060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Eric Nuckols updated XERCESC-2060: -- Description: Issue 1187 not completely resolved. The following modification to that issue shows that when xsi:nil="true" is encountered within an section in a top level element, the parser complains that the entire node should be empty. schema: http://www.w3.org/2001/XMLSchema; xmlns="http://www.w3schools.com; elementFormDefault="qualified" targetNamespace="http://www.w3schools.com;> example: http://www.w3schools.com; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://www.w3schools.com note.xsd"> Tove Jani result from schema validation: ../StdInParse -n -s < test.xml Error at (file stdin, line 11, char 8): element 'note' is nil and must be empty I debugged the issue within the IGXMLScanner code and know the root cause: Internally, as attributes are scanned per element in the scanner method: scanRawAttrListforNameSpaces() the validator object is modified when any xsi:nil="true" is encountered. This is normally fine when the actual element will be validated (i.e. fValidate == true) because the checkContent() method of the validator is called during the scanEndTag() method, resetting the state of fNil/fNilFound When fValidate == false (i.e. within a tag with processContents="skip"), scanRawAttrListforNameSpaces continues to modify the fNil/fNilFound variables within the validator on an element by element case. Therefore if the last element in the block has xsi:nil="true" when the final scanEndTag() for the parent element is called the state of the fNil/fNilFound variables in the validator are left incorrect. I think the solution might be to store the fNil/fNilFound states within the element stack so that as scanEndTag calls fire off, the correct state is maintained. was: Issue 1187 not completely resolved. The following modification to that issue shows that when xsi:nil="true" is encountered within an section in a top level element, the parser complains that the entire node should be empty. schema: http://www.w3.org/2001/XMLSchema; xmlns="http://www.w3schools.com; elementFormDefault="qualified" targetNamespace="http://www.w3schools.com;> example: http://www.w3schools.com; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://www.w3schools.com note.xsd"> Tove Jani result from schema validation: ../StdInParse -n -s < test.xml Error at (file stdin, line 11, char 8): element 'note' is nil and must be empty I debugged the issue within the IGXMLScanner code and know the root cause: Internally, as attributes are scanned per element in the scanner method: scanRawAttrListforNameSpaces() the validator object is modified when any xsi:nil="true" is encountered. This is normally fine when the actual element will be validated (i.e. fValidate == true) because the checkContent() method of the validator is called during the scanEndTag() method. When fValidate == false (i.e. within a tag with processContents="skip"), scanRawAttrListforNameSpaces continues to modify the fNil/fNilFound variables within the validator on an element by element case. Therefore if the last element in the block has xsi:nil="true" when the final scanEndTag() for the parent element is called the state of the fNil/fNilFound variables in the validator are left incorrect. I think the solution might be to store the fNil/fNilFound states within the element stack so that as scanEndTag calls fire off, the correct state is maintained. > Reopening of Issue XERCESC-1187 Xerces SAX2 parser can not skip xs:any if > xsi:nil is used in xml > > > Key: XERCESC-2060 > URL: https://issues.apache.org/jira/browse/XERCESC-2060 > Project: Xerces-C++ > Issue Type: Bug > Components: Validating Parser (XML Schema) >Affects Versions: 3.1.2 > Environment: Linux Intel 64 Bit >Reporter: Eric Nuckols > > Issue 1187 not completely resolved. > The following modification to that issue shows that when xsi:nil="true" is > encountered within an section in a top level element, the parser > complains that the entire node should be empty. > schema: > > http://www.w3.org/2001/XMLSchema; > xmlns="http://www.w3schools.com; > elementFormDefault="qualified" > targetNamespace="http://www.w3schools.com;> > > > > > >