Andre Heynatz wrote:
Hello,

I am new to XML Schema, and I have a problem to enforce a sequence of elements
onto the XML instance. In the example below, it is obvious, that the faulty
example.xml must not validate against the syntax defined in example.xsd,
because:

...


But it does validate (using the SAX2 parser), at least there is no indication
of an error (error or fatalError callbacks are not called).

Please see below for further details.

...


The XML Schema is read in and validated. Changing the line
        <xs:element name="a" type="xs:nonNegativeInteger"/>
to
        <xs:element ame="a" type="xs:nonNegativeInteger"/>

leads to an error as expected:

SAX2Handler::error: Element must have a name or a ref attribute
 - element ignored at line: 6


I have tried Xerces 2.6 and 2.7 on Linux/x86-32 with the following options:

  m_parser = XMLReaderFactory::createXMLReader();
  m_parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true); // default with 2.6
  m_parser->setFeature(XMLUni::fgXercesSchema, true);       // default with 2.6
  m_parser->setFeature(XMLUni::fgSAX2CoreValidation, true); // default with 2.6
  m_parser->setFeature(XMLUni::fgXercesValidationErrorAsFatal, true);
  m_parser->setFeature(XMLUni::fgXercesDynamic, false);     // default with 2.6
  m_parser->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
// m_parser->setFeature(XMLUni::fgXercesStandardUriConformant, true); // does 
not work
  m_parser->setFeature(XMLUni::fgXercesIdentityConstraintChecking, true); // 
default with 2.6
  m_parser->setProperty(XMLUni::fgXercesScannerName,
                (void *)XMLUni::fgSGXMLScanner); // only schema support needed

What happens if you use IGXMLScanner instead of SGXMLScanner? Since SGXMLScanner is not used that often, I wouldn't be surprised if there are some bugs there.

Dave

Reply via email to