You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2001/07/09 17:22:51 UTC
cvs commit: xml-xerces/c/src/validators/schema SchemaElementDecl.cpp TraverseSchema.cpp
knoaman 01/07/09 08:22:51
Modified: c/src/internal XMLScanner2.cpp
c/src/validators/common CMAny.cpp ContentSpecNode.hpp
DFAContentModel.cpp MixedContentModel.cpp
c/src/validators/schema SchemaElementDecl.cpp
TraverseSchema.cpp
Log:
complete <any> declaration.
Revision Changes Path
1.44 +12 -17 xml-xerces/c/src/internal/XMLScanner2.cpp
Index: XMLScanner2.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/internal/XMLScanner2.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- XMLScanner2.cpp 2001/07/09 13:42:08 1.43
+++ XMLScanner2.cpp 2001/07/09 15:22:30 1.44
@@ -55,7 +55,7 @@
*/
/*
- * $Id: XMLScanner2.cpp,v 1.43 2001/07/09 13:42:08 tng Exp $
+ * $Id: XMLScanner2.cpp,v 1.44 2001/07/09 15:22:30 knoaman Exp $
*/
@@ -2664,21 +2664,18 @@
&& !(XMLString::compareString(fElemMap->getLocalPart(), element->getLocalPart())))
break;
} else if (type == ContentSpecNode::Any) {
- if (uri == fEmptyNamespaceId || uri == elementURI)
+ break;
+ } else if (type == ContentSpecNode::Any_NS) {
+ if (uri == elementURI)
break;
- } else if (type == ContentSpecNode::Any_Local) {
- if (elementURI == fEmptyNamespaceId)
- break;
} else if (type == ContentSpecNode::Any_Other) {
if (uri != elementURI)
break;
} else if (type == ContentSpecNode::Any_Skip) {
- if (uri == fEmptyNamespaceId || uri == elementURI) {
- skipThisOne = true;
- break;
- }
- } else if (type == ContentSpecNode::Any_Local_Skip) {
- if (elementURI == fEmptyNamespaceId) {
+ skipThisOne = true;
+ break;
+ } else if (type == ContentSpecNode::Any_NS_Skip) {
+ if (uri == elementURI) {
skipThisOne = true;
break;
}
@@ -2688,12 +2685,10 @@
break;
}
} else if (type == ContentSpecNode::Any_Lax) {
- if (uri == fEmptyNamespaceId || uri == elementURI) {
- laxThisOne = true;
- break;
- }
- } else if (type == ContentSpecNode::Any_Local_Lax) {
- if (elementURI == fEmptyNamespaceId) {
+ laxThisOne = true;
+ break;
+ } else if (type == ContentSpecNode::Any_NS_Lax) {
+ if (uri == elementURI) {
laxThisOne = true;
break;
}
1.5 +4 -1 xml-xerces/c/src/validators/common/CMAny.cpp
Index: CMAny.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/common/CMAny.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CMAny.cpp 2001/06/07 20:58:38 1.4
+++ CMAny.cpp 2001/07/09 15:22:35 1.5
@@ -56,6 +56,9 @@
/*
* $Log: CMAny.cpp,v $
+ * Revision 1.5 2001/07/09 15:22:35 knoaman
+ * complete <any> declaration.
+ *
* Revision 1.4 2001/06/07 20:58:38 tng
* Fix no newline at the end warning. By Pei Yong Zhang.
*
@@ -90,7 +93,7 @@
{
if ((type != ContentSpecNode::Any)
&& (type != ContentSpecNode::Any_Other)
- && (type != ContentSpecNode::Any_Local))
+ && (type != ContentSpecNode::Any_NS))
{
ThrowXML1(RuntimeException,
XMLExcepts::CM_NotValidSpecTypeForNode,
1.8 +6 -3 xml-xerces/c/src/validators/common/ContentSpecNode.hpp
Index: ContentSpecNode.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/common/ContentSpecNode.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ContentSpecNode.hpp 2001/05/11 13:27:18 1.7
+++ ContentSpecNode.hpp 2001/07/09 15:22:36 1.8
@@ -56,6 +56,9 @@
/*
* $Log: ContentSpecNode.hpp,v $
+ * Revision 1.8 2001/07/09 15:22:36 knoaman
+ * complete <any> declaration.
+ *
* Revision 1.7 2001/05/11 13:27:18 tng
* Copyright update.
*
@@ -124,13 +127,13 @@
, Sequence
, Any
, Any_Other
- , Any_Local = 8
+ , Any_NS = 8
, Any_Lax = 22
, Any_Other_Lax = 23
- , Any_Local_Lax = 24
+ , Any_NS_Lax = 24
, Any_Skip = 38
, Any_Other_Skip = 39
- , Any_Local_Skip = 40
+ , Any_NS_Skip = 40
, UnknownType = -1
};
1.15 +15 -25 xml-xerces/c/src/validators/common/DFAContentModel.cpp
Index: DFAContentModel.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/common/DFAContentModel.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- DFAContentModel.cpp 2001/06/13 20:50:56 1.14
+++ DFAContentModel.cpp 2001/07/09 15:22:36 1.15
@@ -56,6 +56,9 @@
/*
* $Log: DFAContentModel.cpp,v $
+ * Revision 1.15 2001/07/09 15:22:36 knoaman
+ * complete <any> declaration.
+ *
* Revision 1.14 2001/06/13 20:50:56 peiyongz
* fIsMixed: to handle mixed Content Model
*
@@ -276,16 +279,13 @@
}
else if ((type & 0x0f)== ContentSpecNode::Any)
{
- unsigned int uri = inElem->getURI();
- if ((uri == emptyNamespaceId) || (uri == curElem->getURI())) {
- nextState = fTransTable[curState][elemIndex];
- if (nextState != XMLContentModel::gInvalidTrans)
+ nextState = fTransTable[curState][elemIndex];
+ if (nextState != XMLContentModel::gInvalidTrans)
break;
- }
}
- else if ((type & 0x0f) == ContentSpecNode::Any_Local)
+ else if ((type & 0x0f) == ContentSpecNode::Any_NS)
{
- if (curElem->getURI() == emptyNamespaceId)
+ if (inElem->getURI() == curElem->getURI())
{
nextState = fTransTable[curState][elemIndex];
if (nextState != XMLContentModel::gInvalidTrans)
@@ -376,17 +376,13 @@
}
else if ((type & 0x0f)== ContentSpecNode::Any)
{
- unsigned int uri = inElem->getURI();
- if ((uri == emptyNamespaceId) || (uri == curElem->getURI()))
- {
- nextState = fTransTable[curState][elemIndex];
- if (nextState != XMLContentModel::gInvalidTrans)
+ nextState = fTransTable[curState][elemIndex];
+ if (nextState != XMLContentModel::gInvalidTrans)
break;
- }
}
- else if ((type & 0x0f) == ContentSpecNode::Any_Local)
+ else if ((type & 0x0f) == ContentSpecNode::Any_NS)
{
- if (curElem->getURI() == emptyNamespaceId)
+ if (inElem->getURI() == curElem->getURI())
{
nextState = fTransTable[curState][elemIndex];
if (nextState != XMLContentModel::gInvalidTrans)
@@ -860,18 +856,12 @@
// Get the spec type of the passed node
const ContentSpecNode::NodeTypes curType = curNode->getType();
- if ((curType & 0x0f) == ContentSpecNode::Any)
+ if ((curType & 0x0f) == ContentSpecNode::Any
+ || (curType & 0x0f) == ContentSpecNode::Any_Other
+ || (curType & 0x0f) == ContentSpecNode::Any_NS)
{
retNode = new CMAny(curType, curNode->getElement()->getURI(), fLeafCount++);
}
- else if ((curType & 0x0f) == ContentSpecNode::Any_Other)
- {
- retNode = new CMAny(curType, curNode->getElement()->getURI(), fLeafCount++);
- }
- else if ((curType & 0x0f) == ContentSpecNode::Any_Local)
- {
- retNode = new CMAny(curType, 0, fLeafCount++);
- }
else if (curType == ContentSpecNode::Leaf)
{
//
@@ -1014,7 +1004,7 @@
// Recurse as required
if ( ((curType & 0x0f) == ContentSpecNode::Any) ||
- ((curType & 0x0f) == ContentSpecNode::Any_Local) ||
+ ((curType & 0x0f) == ContentSpecNode::Any_NS) ||
((curType & 0x0f) == ContentSpecNode::Any_Other) )
{
QName* qname = new QName(XMLUni::fgZeroLenString, XMLUni::fgZeroLenString, ((CMAny*) nodeCur)->getURI());
1.11 +14 -21 xml-xerces/c/src/validators/common/MixedContentModel.cpp
Index: MixedContentModel.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/common/MixedContentModel.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- MixedContentModel.cpp 2001/06/12 22:13:33 1.10
+++ MixedContentModel.cpp 2001/07/09 15:22:37 1.11
@@ -56,6 +56,9 @@
/*
* $Log: MixedContentModel.cpp,v $
+ * Revision 1.11 2001/07/09 15:22:37 knoaman
+ * complete <any> declaration.
+ *
* Revision 1.10 2001/06/12 22:13:33 peiyongz
* validateContentSpecial() : apply SubstitutionGroupComparator.isEquivalentTo()
*
@@ -254,12 +257,9 @@
}
}
else if (type == ContentSpecNode::Any) {
- unsigned int uri = inChild->getURI();
- if ((uri != emptyNamespaceId) && (uri != curChild->getURI()))
- return outIndex;
}
- else if (type == ContentSpecNode::Any_Local) {
- if (curChild->getURI() != emptyNamespaceId)
+ else if (type == ContentSpecNode::Any_NS) {
+ if (inChild->getURI() != curChild->getURI())
return outIndex;
}
else if (type == ContentSpecNode::Any_Other) {
@@ -303,12 +303,10 @@
}
}
else if (type == ContentSpecNode::Any) {
- unsigned int uri = inChild->getURI();
- if ((uri == emptyNamespaceId) || (uri == curChild->getURI()))
- break;
+ break;
}
- else if (type == ContentSpecNode::Any_Local) {
- if (curChild->getURI() == emptyNamespaceId)
+ else if (type == ContentSpecNode::Any_NS) {
+ if (inChild->getURI() == curChild->getURI())
break;
}
else if (type == ContentSpecNode::Any_Other) {
@@ -348,7 +346,7 @@
if ((curType == ContentSpecNode::Leaf) ||
(curType == ContentSpecNode::Any) ||
(curType == ContentSpecNode::Any_Other) ||
- (curType == ContentSpecNode::Any_Local) )
+ (curType == ContentSpecNode::Any_NS) )
{
toFill.addElement(curNode->getElement());
toType.addElement(curType);
@@ -408,12 +406,9 @@
return outIndex;
}
else if (type == ContentSpecNode::Any) {
- unsigned int uri = inChild->getURI();
- if ((uri != emptyNamespaceId) && (uri != curChild->getURI()))
- return outIndex;
}
- else if (type == ContentSpecNode::Any_Local) {
- if (curChild->getURI() != emptyNamespaceId)
+ else if (type == ContentSpecNode::Any_NS) {
+ if (inChild->getURI() != curChild->getURI())
return outIndex;
}
else if (type == ContentSpecNode::Any_Other) {
@@ -448,12 +443,10 @@
break;
}
else if (type == ContentSpecNode::Any) {
- unsigned int uri = inChild->getURI();
- if ((uri == emptyNamespaceId) || (uri == curChild->getURI()))
- break;
+ break;
}
- else if (type == ContentSpecNode::Any_Local) {
- if (curChild->getURI() == emptyNamespaceId)
+ else if (type == ContentSpecNode::Any_NS) {
+ if (inChild->getURI() == curChild->getURI())
break;
}
else if (type == ContentSpecNode::Any_Other) {
1.10 +24 -5 xml-xerces/c/src/validators/schema/SchemaElementDecl.cpp
Index: SchemaElementDecl.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/schema/SchemaElementDecl.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SchemaElementDecl.cpp 2001/06/13 20:51:18 1.9
+++ SchemaElementDecl.cpp 2001/07/09 15:22:43 1.10
@@ -56,6 +56,9 @@
/*
* $Log: SchemaElementDecl.cpp,v $
+ * Revision 1.10 2001/07/09 15:22:43 knoaman
+ * complete <any> declaration.
+ *
* Revision 1.9 2001/06/13 20:51:18 peiyongz
* fIsMixed: to handle mixed Content Model
*
@@ -308,9 +311,15 @@
// pretty long, but very few will be longer than one K. The buffer
// will expand to handle the more pathological ones.
//
- XMLBuffer bufFmt;
- getContentSpec()->formatSpec(bufFmt);
- newValue = XMLString::replicate(bufFmt.getRawBuffer());
+ const ContentSpecNode* specNode = getContentSpec();
+
+ if (specNode) {
+ XMLBuffer bufFmt;
+
+
+ specNode->formatSpec(bufFmt);
+ newValue = XMLString::replicate(bufFmt.getRawBuffer());
+ }
}
return newValue;
}
@@ -327,7 +336,17 @@
// Just create a mixel content model object. This type of
// content model is optimized for mixed content validation.
//
- cmRet = createChildModel(true);
+ ContentSpecNode* specNode = getContentSpec();
+
+ if(!specNode)
+ ThrowXML(RuntimeException, XMLExcepts::CM_UnknownCMSpecType);
+
+ if (specNode->getElement()->getURI() == XMLElementDecl::fgPCDataElemId) {
+ cmRet = new MixedContentModel(false, this);
+ }
+ else {
+ cmRet = createChildModel(true);
+ }
}
else if (fModelType == Children)
{
@@ -373,7 +392,7 @@
//
if (((specNode->getType() & 0x0f) == ContentSpecNode::Any) ||
((specNode->getType() & 0x0f) == ContentSpecNode::Any_Other) ||
- ((specNode->getType() & 0x0f) == ContentSpecNode::Any_Local)) {
+ ((specNode->getType() & 0x0f) == ContentSpecNode::Any_NS)) {
// let fall through to build a DFAContentModel
}
else if (isMixed)
1.27 +28 -26 xml-xerces/c/src/validators/schema/TraverseSchema.cpp
Index: TraverseSchema.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/validators/schema/TraverseSchema.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- TraverseSchema.cpp 2001/07/09 14:29:44 1.26
+++ TraverseSchema.cpp 2001/07/09 15:22:45 1.27
@@ -56,6 +56,9 @@
/*
* $Log: TraverseSchema.cpp,v $
+ * Revision 1.27 2001/07/09 15:22:45 knoaman
+ * complete <any> declaration.
+ *
* Revision 1.26 2001/07/09 14:29:44 knoaman
* Fixes for import/include declarations
*
@@ -1185,25 +1188,23 @@
// Set default node type based on 'processContents' value
// ------------------------------------------------------------------
ContentSpecNode::NodeTypes anyType = ContentSpecNode::Any;
- ContentSpecNode::NodeTypes anyLocalType = ContentSpecNode::Any_Local;
+ ContentSpecNode::NodeTypes anyLocalType = ContentSpecNode::Any_NS;
ContentSpecNode::NodeTypes anyOtherType = ContentSpecNode::Any_Other;
- if (XMLString::stringLen(processContents) != 0) {
+ if (XMLString::stringLen(processContents) > 0
+ && XMLString::compareString(processContents, fgStrict)) {
- if (XMLString::compareString(processContents, fgStrict) != 0) {
- // Do nothing
- }
- else if (XMLString::compareString(processContents, fgLax) == 0) {
+ if (!XMLString::compareString(processContents, fgLax)) {
anyType = ContentSpecNode::Any_Lax;
anyOtherType = ContentSpecNode::Any_Other_Lax;
- anyLocalType = ContentSpecNode::Any_Local_Lax;
+ anyLocalType = ContentSpecNode::Any_NS_Lax;
}
- else if (XMLString::compareString(processContents, fgSkip) == 0) {
+ else if (!XMLString::compareString(processContents, fgSkip)) {
anyType = ContentSpecNode::Any_Skip;
anyOtherType = ContentSpecNode::Any_Other_Skip;
- anyLocalType = ContentSpecNode::Any_Local_Skip;
+ anyLocalType = ContentSpecNode::Any_NS_Skip;
}
}
@@ -1213,22 +1214,24 @@
int emptyURI = fURIStringPool->addOrFind(XMLUni::fgZeroLenString);
ContentSpecNode* retSpecNode = 0;
QName elemName(XMLUni::fgZeroLenString, XMLUni::fgZeroLenString,
- fTargetNSURI);
+ emptyURI);
if (XMLString::stringLen(nameSpace) == 0
- || XMLString::compareString(nameSpace, SchemaSymbols::fgATTVAL_TWOPOUNDANY) == 0) {
+ || !XMLString::compareString(nameSpace, SchemaSymbols::fgATTVAL_TWOPOUNDANY)) {
retSpecNode = new ContentSpecNode(&elemName);
retSpecNode->setType(anyType);
}
- else if (XMLString::compareString(nameSpace, SchemaSymbols::fgATTVAL_TWOPOUNDOTHER) == 0) {
+ else if (!XMLString::compareString(nameSpace, SchemaSymbols::fgATTVAL_TWOPOUNDOTHER)) {
+ elemName.setURI(fTargetNSURI);
retSpecNode = new ContentSpecNode(&elemName);
retSpecNode->setType(anyOtherType);
}
else {
RefVectorOf<XMLCh>* nameSpaceTokens = XMLString::tokenizeString(nameSpace);
+ ValueVectorOf<unsigned int> uriList(8);
ContentSpecNode* firstNode = 0;
ContentSpecNode* secondNode = 0;
unsigned int tokensSize = nameSpaceTokens->size();
@@ -1237,26 +1240,25 @@
const XMLCh* tokenElem = nameSpaceTokens->elementAt(i);
int uriIndex = emptyURI;
-
- if (XMLString::compareString(tokenElem,
- SchemaSymbols::fgATTVAL_TWOPOUNDLOCAL) == 0) {
- elemName.setURI(uriIndex);
- firstNode = new ContentSpecNode(&elemName);
- firstNode->setType(anyLocalType);
- }
- else {
+ if (XMLString::compareString(tokenElem,SchemaSymbols::fgATTVAL_TWOPOUNDLOCAL)) { // not ##local
- if (XMLString::compareString(tokenElem,
- SchemaSymbols::fgATTVAL_TWOPOUNDTRAGETNAMESPACE) == 0) {
+ if (!XMLString::compareString(tokenElem,SchemaSymbols::fgATTVAL_TWOPOUNDTRAGETNAMESPACE)) {
uriIndex = fTargetNSURI;
}
+ else {
+ uriIndex = fURIStringPool->addOrFind(tokenElem);
+ }
+ }
- uriIndex = fURIStringPool->addOrFind(tokenElem);
- elemName.setURI(uriIndex);
- firstNode = new ContentSpecNode(&elemName);
- firstNode->setType(anyType);
+ if (locationsContain(&uriList, uriIndex)) {
+ continue;
}
+
+ uriList.addElement(uriIndex);
+ elemName.setURI(uriIndex);
+ firstNode = new ContentSpecNode(&elemName);
+ firstNode->setType(anyLocalType);
if (secondNode == 0) {
secondNode = firstNode;
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org