Author: amassari
Date: Wed Apr 9 07:12:25 2008
New Revision: 646366
URL: http://svn.apache.org/viewvc?rev=646366&view=rev
Log:
When an element had a complex type coming from a different namespace, and the
type was anonymous, the grammar was not switched and locally defined elements
used by the type could not to be found (because the local search was done in
the namespace of the element, and a global search was done in the namespace of
the type) (XERCESC-1776)
Added:
xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1776/
xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1776/gargamel.xsd
xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1776/smerf.xml
xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1776/smerf.xsd
Modified:
xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp
xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
xerces/c/trunk/tests/src/XSTSHarness/regression/Xerces.testSet
Modified: xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp?rev=646366&r1=646365&r2=646366&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp Wed Apr 9 07:12:25
2008
@@ -2509,36 +2509,31 @@
// switch grammar if the typeinfo has a different grammar (happens
when there is xsi:type)
XMLCh* typeName = typeinfo->getTypeName();
- //anonymous used to have a name starting with #
- //const XMLCh poundStr[] = {chPound, chNull};
- //if (!XMLString::startsWith(typeName, poundStr)) {
- if (!typeinfo->getAnonymous()) {
- const int comma = XMLString::indexOf(typeName, chComma);
- if (comma > 0) {
- XMLBuffer prefixBuf(comma+1, fMemoryManager);
- prefixBuf.append(typeName, comma);
- const XMLCh* uriStr = prefixBuf.getRawBuffer();
+ const int comma = XMLString::indexOf(typeName, chComma);
+ if (comma > 0) {
+ XMLBuffer prefixBuf(comma+1, fMemoryManager);
+ prefixBuf.append(typeName, comma);
+ const XMLCh* uriStr = prefixBuf.getRawBuffer();
- bool errorCondition = !switchGrammar(uriStr) && fValidate;
- if (errorCondition && !laxThisOne)
- {
- fValidator->emitError
- (
- XMLValid::GrammarNotFound
- , prefixBuf.getRawBuffer()
- );
- }
+ bool errorCondition = !switchGrammar(uriStr) && fValidate;
+ if (errorCondition && !laxThisOne)
+ {
+ fValidator->emitError
+ (
+ XMLValid::GrammarNotFound
+ , prefixBuf.getRawBuffer()
+ );
}
- else if (comma == 0) {
- bool errorCondition =
!switchGrammar(XMLUni::fgZeroLenString) && fValidate;
- if (errorCondition && !laxThisOne)
- {
- fValidator->emitError
- (
- XMLValid::GrammarNotFound
- , XMLUni::fgZeroLenString
- );
- }
+ }
+ else if (comma == 0) {
+ bool errorCondition = !switchGrammar(XMLUni::fgZeroLenString)
&& fValidate;
+ if (errorCondition && !laxThisOne)
+ {
+ fValidator->emitError
+ (
+ XMLValid::GrammarNotFound
+ , XMLUni::fgZeroLenString
+ );
}
}
}
Modified: xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp?rev=646366&r1=646365&r2=646366&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp Wed Apr 9 07:12:25
2008
@@ -1515,36 +1515,31 @@
// switch grammar if the typeinfo has a different grammar (happens
when there is xsi:type)
XMLCh* typeName = typeinfo->getTypeName();
- //anonymous used to have a name starting with #
- //const XMLCh poundStr[] = {chPound, chNull};
- //if (!XMLString::startsWith(typeName, poundStr)) {
- if (!typeinfo->getAnonymous()) {
- const int comma = XMLString::indexOf(typeName, chComma);
- if (comma > 0) {
- XMLBuffer prefixBuf(comma+1, fMemoryManager);
- prefixBuf.append(typeName, comma);
- const XMLCh* uriStr = prefixBuf.getRawBuffer();
+ const int comma = XMLString::indexOf(typeName, chComma);
+ if (comma > 0) {
+ XMLBuffer prefixBuf(comma+1, fMemoryManager);
+ prefixBuf.append(typeName, comma);
+ const XMLCh* uriStr = prefixBuf.getRawBuffer();
- bool errorCondition = !switchGrammar(uriStr) && fValidate;
- if (errorCondition && !laxThisOne)
- {
- fValidator->emitError
- (
- XMLValid::GrammarNotFound
- , prefixBuf.getRawBuffer()
- );
- }
+ bool errorCondition = !switchGrammar(uriStr) && fValidate;
+ if (errorCondition && !laxThisOne)
+ {
+ fValidator->emitError
+ (
+ XMLValid::GrammarNotFound
+ , prefixBuf.getRawBuffer()
+ );
}
- else if (comma == 0) {
- bool errorCondition = !switchGrammar(XMLUni::fgZeroLenString)
&& fValidate;
- if (errorCondition && !laxThisOne)
- {
- fValidator->emitError
- (
- XMLValid::GrammarNotFound
- , XMLUni::fgZeroLenString
- );
- }
+ }
+ else if (comma == 0) {
+ bool errorCondition = !switchGrammar(XMLUni::fgZeroLenString) &&
fValidate;
+ if (errorCondition && !laxThisOne)
+ {
+ fValidator->emitError
+ (
+ XMLValid::GrammarNotFound
+ , XMLUni::fgZeroLenString
+ );
}
}
}
Added: xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1776/gargamel.xsd
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1776/gargamel.xsd?rev=646366&view=auto
==============================================================================
--- xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1776/gargamel.xsd
(added)
+++ xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1776/gargamel.xsd
Wed Apr 9 07:12:25 2008
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://gargamel" elementFormDefault="qualified" >
+ <xsd:complexType name="gargamelType">
+ <xsd:sequence>
+ <xsd:element name="Data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="Object"
type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
\ No newline at end of file
Added: xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1776/smerf.xml
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1776/smerf.xml?rev=646366&view=auto
==============================================================================
--- xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1776/smerf.xml
(added)
+++ xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1776/smerf.xml Wed
Apr 9 07:12:25 2008
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s:Alert xmlns:s="http://smerf" xmlns:g="http://gargamel"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation='http://smerf smerf.xsd' >
+ <g:Data>
+ <g:Object>
+ pawel
+ </g:Object>
+ </g:Data>
+</s:Alert>
\ No newline at end of file
Added: xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1776/smerf.xsd
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1776/smerf.xsd?rev=646366&view=auto
==============================================================================
--- xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1776/smerf.xsd
(added)
+++ xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1776/smerf.xsd Wed
Apr 9 07:12:25 2008
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:g="http://gargamel"
targetNamespace="http://smerf" elementFormDefault="qualified">
+ <import namespace="http://gargamel" schemaLocation="gargamel.xsd" />
+ <element name="Alert" > <!-- type="g:gargamelType"> -->
+ <complexType>
+ <complexContent>
+ <extension base="g:gargamelType" />
+ </complexContent>
+ </complexType>
+ </element>
+</schema>
\ No newline at end of file
Modified: xerces/c/trunk/tests/src/XSTSHarness/regression/Xerces.testSet
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/tests/src/XSTSHarness/regression/Xerces.testSet?rev=646366&r1=646365&r2=646366&view=diff
==============================================================================
--- xerces/c/trunk/tests/src/XSTSHarness/regression/Xerces.testSet (original)
+++ xerces/c/trunk/tests/src/XSTSHarness/regression/Xerces.testSet Wed Apr 9
07:12:25 2008
@@ -413,6 +413,22 @@
<current status="accepted" date="2008-02-25"/>
</schemaTest>
</testGroup>
+ <testGroup name="XERCESC-1776">
+ <annotation>
+ <documentation>Bug in schema processing (using the
"xsd:extension" for an another file) since v2.8.0</documentation>
+ </annotation>
+ <documentationReference
xlink:href="https://issues.apache.org/jira/browse/XERCESC-1776"/>
+ <schemaTest name="XERCESC-1776-1">
+ <schemaDocument xlink:href="./XERCESC-1776/smerf.xsd"/>
+ <expected validity="valid"/>
+ <current status="accepted" date="2008-04-09"/>
+ </schemaTest>
+ <instanceTest name="XERCESC-1776-2">
+ <instanceDocument
xlink:href="./XERCESC-1776/smerf.xml"/>
+ <expected validity="valid"/>
+ <current status="accepted" date="2008-04-09"/>
+ </instanceTest>
+ </testGroup>
<testGroup name="XERCESC-1777">
<annotation>
<documentation>Restriction checking code resolves an
element from a wrong schema grammar</documentation>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]