knoaman 2003/11/20 09:52:14
Modified: c/src/xercesc/validators/common ContentSpecNode.hpp
ContentSpecNode.cpp
Log:
PSVI: store element declaration (leaf nodes)
Revision Changes Path
1.10 +46 -0 xml-xerces/c/src/xercesc/validators/common/ContentSpecNode.hpp
Index: ContentSpecNode.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/common/ContentSpecNode.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ContentSpecNode.hpp 7 Nov 2003 17:08:11 -0000 1.9
+++ ContentSpecNode.hpp 20 Nov 2003 17:52:14 -0000 1.10
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.10 2003/11/20 17:52:14 knoaman
+ * PSVI: store element declaration (leaf nodes)
+ *
* Revision 1.9 2003/11/07 17:08:11 knoaman
* For PSVI support, distinguish wildcard elements with namespace lists.
*
@@ -200,9 +203,11 @@
, Any_NS = 8
, All = 9
, Any_NS_Choice = 20
+ , ModelGroupSequence = 21
, Any_Lax = 22
, Any_Other_Lax = 23
, Any_NS_Lax = 24
+ , ModelGroupChoice = 36
, Any_Skip = 38
, Any_Other_Skip = 39
, Any_NS_Skip = 40
@@ -222,6 +227,11 @@
);
ContentSpecNode
(
+ XMLElementDecl* const elemDecl
+ , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
+ );
+ ContentSpecNode
+ (
QName* const toAdopt
, const bool copyQName
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
@@ -243,6 +253,8 @@
// -----------------------------------------------------------------------
QName* getElement();
const QName* getElement() const;
+ XMLElementDecl* getElementDecl();
+ const XMLElementDecl* getElementDecl() const;
ContentSpecNode* getFirst();
const ContentSpecNode* getFirst() const;
ContentSpecNode* getSecond();
@@ -327,6 +339,7 @@
// -----------------------------------------------------------------------
MemoryManager* fMemoryManager;
QName* fElement;
+ XMLElementDecl* fElementDecl;
ContentSpecNode* fFirst;
ContentSpecNode* fSecond;
NodeTypes fType;
@@ -343,6 +356,7 @@
fMemoryManager(manager)
, fElement(0)
+ , fElementDecl(0)
, fFirst(0)
, fSecond(0)
, fType(ContentSpecNode::Leaf)
@@ -359,6 +373,7 @@
fMemoryManager(manager)
, fElement(0)
+ , fElementDecl(0)
, fFirst(0)
, fSecond(0)
, fType(ContentSpecNode::Leaf)
@@ -372,12 +387,32 @@
}
inline
+ContentSpecNode::ContentSpecNode(XMLElementDecl* const elemDecl,
+ MemoryManager* const manager) :
+
+ fMemoryManager(manager)
+ , fElement(0)
+ , fElementDecl(elemDecl)
+ , fFirst(0)
+ , fSecond(0)
+ , fType(ContentSpecNode::Leaf)
+ , fAdoptFirst(true)
+ , fAdoptSecond(true)
+ , fMinOccurs(1)
+ , fMaxOccurs(1)
+{
+ if (elemDecl)
+ fElement = new (manager) QName(*(elemDecl->getElementName()));
+}
+
+inline
ContentSpecNode::ContentSpecNode( QName* const element
, const bool copyQName
, MemoryManager* const manager) :
fMemoryManager(manager)
, fElement(0)
+ , fElementDecl(0)
, fFirst(0)
, fSecond(0)
, fType(ContentSpecNode::Leaf)
@@ -407,6 +442,7 @@
fMemoryManager(manager)
, fElement(0)
+ , fElementDecl(0)
, fFirst(firstAdopt)
, fSecond(secondAdopt)
, fType(type)
@@ -442,6 +478,16 @@
inline const QName* ContentSpecNode::getElement() const
{
return fElement;
+}
+
+inline XMLElementDecl* ContentSpecNode::getElementDecl()
+{
+ return fElementDecl;
+}
+
+inline const XMLElementDecl* ContentSpecNode::getElementDecl() const
+{
+ return fElementDecl;
}
inline ContentSpecNode* ContentSpecNode::getFirst()
1.11 +13 -17 xml-xerces/c/src/xercesc/validators/common/ContentSpecNode.cpp
Index: ContentSpecNode.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/common/ContentSpecNode.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ContentSpecNode.cpp 7 Nov 2003 17:08:11 -0000 1.10
+++ ContentSpecNode.cpp 20 Nov 2003 17:52:14 -0000 1.11
@@ -78,30 +78,27 @@
ContentSpecNode::ContentSpecNode(const ContentSpecNode& toCopy) :
fMemoryManager(toCopy.fMemoryManager)
+ , fElement(0)
+ , fElementDecl(toCopy.fElementDecl)
+ , fFirst(0)
+ , fSecond(0)
+ , fType(toCopy.fType)
+ , fAdoptFirst(true)
+ , fAdoptSecond(true)
+ , fMinOccurs(toCopy.fMinOccurs)
+ , fMaxOccurs(toCopy.fMaxOccurs)
{
const QName* tempElement = toCopy.getElement();
if (tempElement)
fElement = new (fMemoryManager) QName(*tempElement);
- else
- fElement = 0;
const ContentSpecNode *tmp = toCopy.getFirst();
if (tmp)
fFirst = new (fMemoryManager) ContentSpecNode(*tmp);
- else
- fFirst = 0;
tmp = toCopy.getSecond();
if (tmp)
fSecond = new (fMemoryManager) ContentSpecNode(*tmp);
- else
- fSecond = 0;
-
- fType = toCopy.getType();
- fAdoptFirst = true;
- fAdoptSecond = true;
- fMinOccurs = toCopy.getMinOccurs();
- fMaxOccurs = toCopy.getMaxOccurs();
}
// ---------------------------------------------------------------------------
@@ -134,7 +131,7 @@
}
// Now handle our type
- switch(curType)
+ switch(curType & 0x0f)
{
case ContentSpecNode::Leaf :
if (curNode->getElement()->getURI() == XMLElementDecl::fgPCDataElemId)
@@ -171,7 +168,6 @@
break;
case ContentSpecNode::Choice :
- case ContentSpecNode::Any_NS_Choice:
if (parentType != curType)
bufToFill.append(chOpenParen);
formatNode(first, curType, bufToFill);
@@ -233,7 +229,7 @@
int min = fMinOccurs;
- if (fType == ContentSpecNode::Sequence
+ if ((fType & 0x0f) == ContentSpecNode::Sequence
|| fType == ContentSpecNode::All
|| (fType & 0x0f) == ContentSpecNode::Choice) {
@@ -265,7 +261,7 @@
return SchemaSymbols::XSD_UNBOUNDED;
}
- if (fType == ContentSpecNode::Sequence
+ if ((fType & 0x0f) == ContentSpecNode::Sequence
|| fType == ContentSpecNode::All
|| (fType & 0x0f) == ContentSpecNode::Choice) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]