knoaman 2004/11/25 06:36:40
Modified: c/src/xercesc/validators/common AllContentModel.cpp
AllContentModel.hpp
Log:
Fix problem with an All content model with minOccurs of 0.
Revision Changes Path
1.11 +10 -2
xml-xerces/c/src/xercesc/validators/common/AllContentModel.cpp
Index: AllContentModel.cpp
===================================================================
RCS file:
/home/cvs/xml-xerces/c/src/xercesc/validators/common/AllContentModel.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- AllContentModel.cpp 16 Sep 2004 13:32:03 -0000 1.10
+++ AllContentModel.cpp 25 Nov 2004 14:36:40 -0000 1.11
@@ -16,6 +16,9 @@
/*
* $Log$
+ * Revision 1.11 2004/11/25 14:36:40 knoaman
+ * Fix problem with an All content model with minOccurs of 0.
+ *
* Revision 1.10 2004/09/16 13:32:03 amassari
* Updated error message for UPA to also state the complex type that is
failing the test
*
@@ -84,6 +87,7 @@
, fChildOptional(0)
, fNumRequired(0)
, fIsMixed(isMixed)
+ , fHasOptionalContent(false)
{
//
// Create a vector of unsigned ints that will be filled in with the
@@ -105,6 +109,10 @@
ThrowXMLwithMemMgr(RuntimeException, XMLExcepts::CM_NoParentCSN,
fMemoryManager);
// And now call the private recursive method that iterates the tree
+ if (curNode->getType() == ContentSpecNode::All
+ && curNode->getMinOccurs() == 0) {
+ fHasOptionalContent = true;
+ }
buildChildList(curNode, children, childOptional);
//
@@ -144,7 +152,7 @@
{
// If <all> had minOccurs of zero and there are
// no children to validate, trivially validate
- if (!fNumRequired && !childCount)
+ if (childCount == 0 && (fHasOptionalContent || !fNumRequired))
return -1;
// Check for duplicate element
@@ -221,7 +229,7 @@
// If <all> had minOccurs of zero and there are
// no children to validate, trivially validate
- if (!fNumRequired && !childCount)
+ if (childCount == 0 && (fHasOptionalContent || !fNumRequired))
return -1;
// Check for duplicate element
1.9 +4 -1
xml-xerces/c/src/xercesc/validators/common/AllContentModel.hpp
Index: AllContentModel.hpp
===================================================================
RCS file:
/home/cvs/xml-xerces/c/src/xercesc/validators/common/AllContentModel.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- AllContentModel.hpp 16 Sep 2004 13:32:03 -0000 1.8
+++ AllContentModel.hpp 25 Nov 2004 14:36:40 -0000 1.9
@@ -16,6 +16,9 @@
/*
* $Log$
+ * Revision 1.9 2004/11/25 14:36:40 knoaman
+ * Fix problem with an All content model with minOccurs of 0.
+ *
* Revision 1.8 2004/09/16 13:32:03 amassari
* Updated error message for UPA to also state the complex type that is
failing the test
*
@@ -163,7 +166,7 @@
bool* fChildOptional;
unsigned int fNumRequired;
bool fIsMixed;
-
+ bool fHasOptionalContent;
};
inline ContentLeafNameTypeVector*
AllContentModel::getContentLeafNameTypeVector() const
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]