SGXMLScanner omits namespace prefixes when reporting start/end element QNames
-----------------------------------------------------------------------------
Key: XERCESC-1598
URL: http://issues.apache.org/jira/browse/XERCESC-1598
Project: Xerces-C++
Type: Bug
Components: Validating Parser (Schema) (Xerces 1.5 or up only)
Versions: 2.7.0
Environment: 64-bit
Solaris 10
Sun CC: Sun C++ 5.7 Patch 117830-07 2006/03/15
Reporter: Michael Fuller
When parsing a document the SGXMLScanner and (sometimes) the IGXMLScanner
does not
correctly report QNames when calling startElement() and endElement():
specifically, it omits
the namespace prefix. (Other scanners behave differently=>correctly.)
For example, using the SAX2Print sample against the document:
<doc xsi:schemaLocation="doc doc.xsd ent ent.xsd"
xmlns="doc" xmlns:ent="ent"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ent:company>HP</ent:company>
</doc>
(with appropriate "doc.xsd" and "ent.xsd" files in the CWD), "SAX2Print -s"
reports:
<?xml version="1.0" encoding="LATIN1"?>
<doc xsi:schemaLocation="doc doc.xsd ent ent.xsd">
<ent:company>HP</ent:company>
</doc>
but "SAX2Print" reports:
<?xml version="1.0" encoding="LATIN1"?>
<doc xsi:schemaLocation="doc doc.xsd ent ent.xsd">
<company>HP</company>
</doc>
Note "<company>" vs. "<ent:company>".
Note also that SAX2Print by default will be using the IGXMLScanner;
if you force the use of the SGXMLScanner by modifying SAX2Print.cpp:
*** SAX2Print.cpp Fri May 26 16:18:07 2006
--- SAX2Print.cpp.ORIG Fri May 26 16:16:13 2006
***************
*** 319,329 ****
parser->setFeature(XMLUni::fgXercesSchemaFullChecking,
schemaFullChecking);
parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes,
namespacePrefixes);
- parser->setProperty(
- xercesc::XMLUni::fgXercesScannerName,
- static_cast<void*>(const_cast<XMLCh*>(
- xercesc::XMLUni::fgSGXMLScanner)));
-
//
// Create the handler object and install it as the document and error
// handler for the parser. Then parse the file and catch any exceptions
then both "SAX2Print -s" and SAX2Print" fail, printing <company> rather than
<ent:company>.
I will attach the test document and schema files.
We have a kludge for SAX2XMLReaderImpl.cpp that works around the above bug,
but it's not the right fix, as there is nothing really wrong with
SAX2XMLReaderImpl.cpp,
just the underlying scanners. Nonetheless, I will attach that also.
--
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]