Author: cargilld
Date: Sun Dec 3 14:10:31 2006
New Revision: 481947
URL: http://svn.apache.org/viewvc?view=rev&rev=481947
Log:
Merge fixes from 2.7 branch
Modified:
xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp
xerces/c/trunk/src/xercesc/internal/WFXMLScanner.cpp
xerces/c/trunk/src/xercesc/util/regx/RangeToken.cpp
xerces/c/trunk/src/xercesc/util/regx/RangeToken.hpp
xerces/c/trunk/src/xercesc/util/regx/RegularExpression.cpp
xerces/c/trunk/src/xercesc/util/regx/UnicodeRangeFactory.cpp
xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp
xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp
Modified: xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp?view=diff&rev=481947&r1=481946&r2=481947
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp Sun Dec 3 14:10:31
2006
@@ -1527,7 +1527,7 @@
, (fDoNamespaces) ? elemDecl->getElementName()->getPrefix() : 0
, *fAttrList
, attCount
- , false
+ , isEmpty
, isRoot
);
}
@@ -1550,19 +1550,6 @@
, elemDecl->getFormattedContentModel()
);
}
- }
-
- // If we have a doc handler, tell it about the end tag
- if (fDocHandler)
- {
- fDocHandler->endElement
- (
- *elemDecl
- , uriId
- , isRoot
- , (fDoNamespaces) ? elemDecl->getElementName()->getPrefix()
- : XMLUni::fgZeroLenString
- );
}
// Pop the element stack back off since it'll never be used now
Modified: xerces/c/trunk/src/xercesc/internal/WFXMLScanner.cpp
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/WFXMLScanner.cpp?view=diff&rev=481947&r1=481946&r2=481947
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/WFXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/WFXMLScanner.cpp Sun Dec 3 14:10:31
2006
@@ -1515,7 +1515,7 @@
, elemDecl->getElementName()->getPrefix()
, *fAttrList
, attCount
- , false
+ , isEmpty
, isRoot
);
}
@@ -1527,18 +1527,6 @@
{
// Pop the element stack back off since it'll never be used now
fElemStack.popTop();
-
- // If we have a doc handler, tell it about the end tag
- if (fDocHandler)
- {
- fDocHandler->endElement
- (
- *elemDecl
- , uriId
- , isRoot
- , elemDecl->getElementName()->getPrefix()
- );
- }
// If the elem stack is empty, then it was an empty root
if (isRoot)
Modified: xerces/c/trunk/src/xercesc/util/regx/RangeToken.cpp
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/regx/RangeToken.cpp?view=diff&rev=481947&r1=481946&r2=481947
==============================================================================
--- xerces/c/trunk/src/xercesc/util/regx/RangeToken.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/regx/RangeToken.cpp Sun Dec 3 14:10:31 2006
@@ -77,6 +77,72 @@
}
+// This is a struct that defines a mapping for
+// case-insensitive matching. The first character
+// is the character we try to match in the range.
+// The second is the character we add to the range,
+// because it maps to the first when we're folding
+// case.
+struct ExceptionCharsStruct
+{
+ XMLInt32 baseChar;
+
+ XMLInt32 matchingChar;
+};
+
+
+// This is an array of character mappings that we will
+// add to ranges for case-insensitive matching.
+static const ExceptionCharsStruct s_exceptions[] =
+{
+ { 0x49, 0x130 },
+ { 0x49, 0x131 },
+ { 0x4b, 0x212a },
+ { 0x53, 0x17f },
+ { 0x69, 0x130 },
+ { 0x69, 0x131 },
+ { 0x6b, 0x212a },
+ { 0x73, 0x17f },
+ { 0xc5, 0x212b },
+ { 0xe5, 0x212b },
+ { 0x1c4, 0x1c5 },
+ { 0x1c6, 0x1c5 },
+ { 0x1c7, 0x1c8 },
+ { 0x1c9, 0x1c8 },
+ { 0x1ca, 0x1cb },
+ { 0x1cc, 0x1cb },
+ { 0x1f1, 0x1f2 },
+ { 0x1f3, 0x1f2 },
+ { 0x392, 0x3d0 },
+ { 0x395, 0x3f5 },
+ { 0x398, 0x3d1 },
+ { 0x398, 0x3f4 },
+ { 0x399, 0x345 },
+ { 0x399, 0x1fbe },
+ { 0x39a, 0x3f0 },
+ { 0x39c, 0xb5 },
+ { 0x3a0, 0x3d6 },
+ { 0x3a1, 0x3f1 },
+ { 0x3a3, 0x3c2 },
+ { 0x3a6, 0x3d5 },
+ { 0x3a9, 0x2126 },
+ { 0x3b2, 0x3d0 },
+ { 0x3b5, 0x3f5 },
+ { 0x3b8, 0x3d1 },
+ { 0x3b8, 0x3f4 },
+ { 0x3b9, 0x345 },
+ { 0x3b9, 0x1fbe },
+ { 0x3ba, 0x3f0 },
+ { 0x3bc, 0xb5 },
+ { 0x3c0, 0x3d6 },
+ { 0x3c1, 0x3f1 },
+ { 0x3c3, 0x3c2 },
+ { 0x3c6, 0x3d5 },
+ { 0x3c9, 0x2126 },
+ { 0x1e60, 0x1e9b },
+ { 0x1e61, 0x1e9b }
+};
+
// ---------------------------------------------------------------------------
// RangeToken: Getter methods
// ---------------------------------------------------------------------------
@@ -86,12 +152,13 @@
bool isNRange = (getTokenType() == T_NRANGE) ? true : false;
RangeToken* lwrToken = tokFactory->createRange(isNRange);
+ unsigned int exceptIndex = 0;
#if XERCES_USE_TRANSCODER_ICU && ((U_ICU_VERSION_MAJOR_NUM > 2) ||
(U_ICU_VERSION_MAJOR_NUM == 2 && U_ICU_VERSION_MINOR_NUM >=4))
UChar*
rangeStr=(UChar*)fMemoryManager->allocate(40*fElemCount*sizeof(UChar));
ArrayJanitor<UChar> janRange(rangeStr, fMemoryManager);
int c=0;
- rangeStr[c++] = chOpenSquare;
+ rangeStr[c++] = chOpenSquare;
for (unsigned int i = 0; i < fElemCount - 1; i += 2) {
XMLCh buffer[10];
unsigned int len, j;
@@ -182,6 +249,34 @@
lwrToken->addRange(ch, ch);
}
#endif
+
+ const unsigned int exceptionsSize =
+ sizeof(s_exceptions) / sizeof(s_exceptions[0]);
+
+ // Add any exception chars. These are characters where the the
+ // case mapping is not symmetric. (Unicode case mappings are
not isomorphic...)
+ while (exceptIndex < exceptionsSize)
+ {
+ if (s_exceptions[exceptIndex].baseChar < ch)
+ {
+ ++exceptIndex;
+ }
+ else if (s_exceptions[exceptIndex].baseChar == ch)
+ {
+ const XMLInt32 matchingChar =
+ s_exceptions[exceptIndex].matchingChar;
+
+ lwrToken->addRange(
+ matchingChar,
+ matchingChar);
+
+ ++exceptIndex;
+ }
+ else
+ {
+ break;
+ }
+ }
}
}
@@ -262,7 +357,7 @@
if(fSorted && fRanges[fElemCount-1] >= val1)
{
- for (int i = 0; i < (int)fElemCount; i +=2)
+ for (int i = 0; i < (int)fElemCount; i +=2)
{
// check if this range is already part of this one
if (fRanges[i] <= val1 && fRanges[i+1] >= val2)
@@ -273,8 +368,8 @@
fRanges[i+1]=val2;
break;
}
- else if (fRanges[i] > val1 ||
- (fRanges[i]==val1 && fRanges[i+1] > val2))
+ else if (fRanges[i] > val1 ||
+ (fRanges[i]==val1 && fRanges[i+1] > val2))
{
for(int j=fElemCount-1;j>=i;j--)
fRanges[j+2]=fRanges[j];
@@ -283,7 +378,7 @@
fElemCount += 2;
break;
}
- }
+ }
}
else
{
Modified: xerces/c/trunk/src/xercesc/util/regx/RangeToken.hpp
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/regx/RangeToken.hpp?view=diff&rev=481947&r1=481946&r2=481947
==============================================================================
--- xerces/c/trunk/src/xercesc/util/regx/RangeToken.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/regx/RangeToken.hpp Sun Dec 3 14:10:31 2006
@@ -56,6 +56,8 @@
// -----------------------------------------------------------------------
RangeToken* getCaseInsensitiveToken(TokenFactory* const tokFactory);
+ void setCaseInsensitiveToken(RangeToken* tok);
+
// -----------------------------------------------------------------------
// Setter methods
// -----------------------------------------------------------------------
@@ -114,6 +116,11 @@
MemoryManager* fMemoryManager;
};
+
+inline void RangeToken::setCaseInsensitiveToken(RangeToken* tok)
+{
+ fCaseIToken = tok;
+}
inline void RangeToken::createMap()
{
Modified: xerces/c/trunk/src/xercesc/util/regx/RegularExpression.cpp
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/regx/RegularExpression.cpp?view=diff&rev=481947&r1=481946&r2=481947
==============================================================================
--- xerces/c/trunk/src/xercesc/util/regx/RegularExpression.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/regx/RegularExpression.cpp Sun Dec 3
14:10:31 2006
@@ -1619,7 +1619,8 @@
if (fOperations != 0 && fOperations->getNextOp() == 0 &&
(fOperations->getOpType() == Op::O_STRING ||
- fOperations->getOpType() == Op::O_CHAR) )
{
+ fOperations->getOpType() == Op::O_CHAR) &&
+ !isSet(fOptions, IGNORE_CASE) ) {
fFixedStringOnly = true;
@@ -1648,8 +1649,9 @@
fBMPattern = new (fMemoryManager) BMPattern(fFixedString, 256,
isSet(fOptions, IGNORE_CASE), fMemoryManager);
}
- else if (!isSet(fOptions, XMLSCHEMA_MODE) &&
- !isSet(fOptions, PROHIBIT_FIXED_STRING_OPTIMIZATION)) {
+ else if (!isSet(fOptions, XMLSCHEMA_MODE) &&
+ !isSet(fOptions, PROHIBIT_FIXED_STRING_OPTIMIZATION) &&
+ !isSet(fOptions, IGNORE_CASE)) {
int fixedOpts = 0;
Token* tok = fTokenTree->findFixedString(fOptions, fixedOpts);
Modified: xerces/c/trunk/src/xercesc/util/regx/UnicodeRangeFactory.cpp
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/regx/UnicodeRangeFactory.cpp?view=diff&rev=481947&r1=481946&r2=481947
==============================================================================
--- xerces/c/trunk/src/xercesc/util/regx/UnicodeRangeFactory.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/regx/UnicodeRangeFactory.cpp Sun Dec 3
14:10:31 2006
@@ -194,9 +194,16 @@
tok->createMap();
rangeTokMap->setRangeToken(fgUniIsSpace, tok , true);
+ RangeToken* const dummyToken =
+ tokFactory->createRange();
+
+ dummyToken->addRange(-1, -2);
+ dummyToken->createMap();
+
// build the internal maps.
for (int l=0; l < UNICATEGSIZE; l++) {
ranges[l]->createMap();
+ ranges[l]->setCaseInsensitiveToken(dummyToken);
}
fRangesCreated = true;
Modified: xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp?view=diff&rev=481947&r1=481946&r2=481947
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp Sun Dec 3
14:10:31 2006
@@ -1427,11 +1427,13 @@
// case of mixed complex types with attributes only
if (derivedURI == XMLElementDecl::fgPCDataElemId) {
- if (!XMLString::equals(derivedName, baseName) || derivedURI != baseURI)
- ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_NameTypeOK1,
fMemoryManager);
return;
}
+ if (!XMLString::equals(derivedName, baseName) || derivedURI != baseURI) {
+ ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_NameTypeOK1,
fMemoryManager);
+ }
+
SchemaGrammar* aGrammar = currentGrammar;
const XMLCh* schemaURI =
fGrammarResolver->getStringPool()->getValueForId(derivedURI);
@@ -1634,28 +1636,85 @@
void
SchemaValidator::checkRecurseAsIfGroup(SchemaGrammar* const currentGrammar,
- ContentSpecNode* const derivedSpecNode,
+ ContentSpecNode* const
derivedSpecNodeIn,
const int derivedScope,
const ContentSpecNode* const
baseSpecNode,
const int baseScope,
ValueVectorOf<ContentSpecNode*>* const
baseNodes,
const ComplexTypeInfo* const baseInfo) {
- ContentSpecNode::NodeTypes baseType = baseSpecNode->getType();
- ValueVectorOf<ContentSpecNode*> derivedNodes(1, fMemoryManager);
+ ContentSpecNode::NodeTypes baseType = baseSpecNode->getType();
bool toLax = false;
//Treat the element as if it were in a group of the same variety as base
- ContentSpecNode derivedGroupNode(baseType, derivedSpecNode, 0, false,
true, fMemoryManager);
-
- derivedNodes.addElement(derivedSpecNode);
+ ContentSpecNode derivedGroupNode(baseType, derivedSpecNodeIn, 0, false,
true, fMemoryManager);
+ const ContentSpecNode* const derivedSpecNode = &derivedGroupNode;
if ((baseSpecNode->getType() & 0x0f) == ContentSpecNode::Choice) {
toLax = true;
}
+ // Instead of calling this routine, inline it
+ // checkRecurse(currentGrammar, &derivedGroupNode, derivedScope,
&derivedNodes,
+ // baseSpecNode, baseScope, baseNodes, baseInfo, toLax);
+
+ if (!isOccurrenceRangeOK(derivedSpecNode->getMinOccurs(),
derivedSpecNode->getMaxOccurs(),
+ baseSpecNode->getMinOccurs(),
baseSpecNode->getMaxOccurs())) {
+ ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::PD_Recurse1,
fMemoryManager);
+ }
+
+ // check for mapping of children
+ XMLExcepts::Codes codeToThrow = XMLExcepts::NoError;
+ unsigned int count2= baseNodes->size();
+ unsigned int current = 0;
+
+ {
+ bool matched = false;
+
+ for (unsigned int j = current; j < count2; j++) {
+
+ ContentSpecNode* baseNode = baseNodes->elementAt(j);
+ current++;
+
+ bool bDoBreak=false; // workaround for Borland bug with 'break'
in 'catch'
+ try {
+
+ checkParticleDerivationOk(currentGrammar, derivedSpecNodeIn,
+ derivedScope, baseNode, baseScope,
baseInfo);
+ matched = true;
+ break;
+ }
+ catch(const XMLException&) {
+ if (!toLax && baseNode->getMinTotalRange()) {
+ bDoBreak=true;
+ }
+ }
+ if(bDoBreak)
+ break;
+ }
+
+ // did not find a match
+ if (!matched) {
+ codeToThrow = XMLExcepts::PD_Recurse2;
+ }
+ }
+
+ // Now, see if there are some elements in the base we didn't match up
+ // in case of Sequence or All
+ if (!toLax && codeToThrow == XMLExcepts::NoError &&
+ (true || (baseType & 0x0f) == ContentSpecNode::All ||
+ derivedSpecNodeIn->getElement()->getURI() !=
XMLElementDecl::fgPCDataElemId)) {
+ for (unsigned int j = current; j < count2; j++) {
+ if (baseNodes->elementAt(j)->getMinTotalRange() *
baseSpecNode->getMinOccurs()) { //!emptiable
+ codeToThrow = XMLExcepts::PD_Recurse2;
+ break;
+ }
+ }
+ }
+
+ if (codeToThrow != XMLExcepts::NoError) {
+ ThrowXMLwithMemMgr(RuntimeException, codeToThrow, fMemoryManager);
+ }
- checkRecurse(currentGrammar, &derivedGroupNode, derivedScope,
&derivedNodes,
- baseSpecNode, baseScope, baseNodes, baseInfo, toLax);
}
void
Modified: xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp?view=diff&rev=481947&r1=481946&r2=481947
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp Sun Dec 3
14:10:31 2006
@@ -6175,7 +6175,12 @@
// Compose the final content model by concatenating the base and
// the current in sequence
if (!specNode) {
-
+ if (isMixed) {
+ if (baseSpecNode && baseSpecNode->hasAllContent()) {
+ reportSchemaError(ctElem, XMLUni::fgXMLErrDomain,
XMLErrs::NotAllContent);
+ throw TraverseSchema::InvalidComplexTypeInfo; //
REVISIT - should we continue
+ }
+ }
if (baseSpecNode) {
specNodeJan.reset(new (fGrammarPoolMemoryManager)
ContentSpecNode(*baseSpecNode));
specNode = specNodeJan.get();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]