knoaman 2003/10/22 13:22:30
Modified: c/src/xercesc/internal XMLScanner.hpp XMLScanner.cpp
WFXMLScanner.hpp WFXMLScanner.cpp SGXMLScanner.hpp
SGXMLScanner.cpp IGXMLScanner.hpp IGXMLScanner.cpp
ElemStack.hpp ElemStack.cpp DGXMLScanner.hpp
DGXMLScanner.cpp
Log:
Prepare for annotation support.
Revision Changes Path
1.24 +24 -1 xml-xerces/c/src/xercesc/internal/XMLScanner.hpp
Index: XMLScanner.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/XMLScanner.hpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- XMLScanner.hpp 10 Jul 2003 19:47:24 -0000 1.23
+++ XMLScanner.hpp 22 Oct 2003 20:22:30 -0000 1.24
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.24 2003/10/22 20:22:30 knoaman
+ * Prepare for annotation support.
+ *
* Revision 1.23 2003/07/10 19:47:24 peiyongz
* Stateless Grammar: Initialize scanner with grammarResolver,
* creating grammar through grammarPool
@@ -285,6 +288,7 @@
#include <xercesc/util/RefHashTableOf.hpp>
#include <xercesc/util/SecurityManager.hpp>
#include <xercesc/internal/ReaderMgr.hpp>
+#include <xercesc/internal/ElemStack.hpp>
#include <xercesc/validators/DTD/DTDEntityDecl.hpp>
#include <xercesc/framework/XMLAttr.hpp>
#include <xercesc/validators/common/GrammarResolver.hpp>
@@ -433,7 +437,6 @@
, const bool toCache = false
) = 0;
-
// -----------------------------------------------------------------------
// Getter methods
// -----------------------------------------------------------------------
@@ -486,6 +489,9 @@
Grammar* getRootGrammar() const;
XMLReader::XMLVersion getXMLVersion() const;
MemoryManager* getMemoryManager() const;
+ ValueVectorOf<PrefMapElem*>* getNamespaceContext() const;
+ unsigned int getPrefixId(const XMLCh* const prefix) const;
+ const XMLCh* getPrefixForId(unsigned int prefId) const;
// -----------------------------------------------------------------------
// Getter methods
@@ -941,6 +947,7 @@
XMLBuffer fQNameBuf;
XMLBuffer fPrefixBuf;
XMLBuffer fURIBuf;
+ ElemStack fElemStack;
private :
// -----------------------------------------------------------------------
@@ -1197,6 +1204,21 @@
inline MemoryManager* XMLScanner::getMemoryManager() const
{
return fMemoryManager;
+}
+
+inline ValueVectorOf<PrefMapElem*>* XMLScanner::getNamespaceContext() const
+{
+ return fElemStack.getNamespaceMap();
+}
+
+inline unsigned int XMLScanner::getPrefixId(const XMLCh* const prefix) const
+{
+ return fElemStack.getPrefixId(prefix);
+}
+
+inline const XMLCh* XMLScanner::getPrefixForId(unsigned int prefId) const
+{
+ return fElemStack.getPrefixForId(prefId);
}
// ---------------------------------------------------------------------------
1.49 +3 -1 xml-xerces/c/src/xercesc/internal/XMLScanner.cpp
Index: XMLScanner.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/XMLScanner.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- XMLScanner.cpp 1 Oct 2003 16:32:38 -0000 1.48
+++ XMLScanner.cpp 22 Oct 2003 20:22:30 -0000 1.49
@@ -220,6 +220,7 @@
, fQNameBuf(1023, manager)
, fPrefixBuf(1023, manager)
, fURIBuf(1023, manager)
+ , fElemStack(manager)
{
commonInit();
@@ -289,6 +290,7 @@
, fQNameBuf(1023, manager)
, fPrefixBuf(1023, manager)
, fURIBuf(1023, manager)
+ , fElemStack(manager)
{
commonInit();
1.8 +4 -6 xml-xerces/c/src/xercesc/internal/WFXMLScanner.hpp
Index: WFXMLScanner.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/WFXMLScanner.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- WFXMLScanner.hpp 10 Jul 2003 19:47:24 -0000 1.7
+++ WFXMLScanner.hpp 22 Oct 2003 20:22:30 -0000 1.8
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.8 2003/10/22 20:22:30 knoaman
+ * Prepare for annotation support.
+ *
* Revision 1.7 2003/07/10 19:47:24 peiyongz
* Stateless Grammar: Initialize scanner with grammarResolver,
* creating grammar through grammarPool
@@ -85,7 +88,6 @@
#define WFXMLSCANNER_HPP
#include <xercesc/internal/XMLScanner.hpp>
-#include <xercesc/internal/ElemStack.hpp>
#include <xercesc/util/ValueHashTableOf.hpp>
#include <xercesc/util/ValueVectorOf.hpp>
#include <xercesc/validators/DTD/DTDElementDecl.hpp>
@@ -195,10 +197,6 @@
// -----------------------------------------------------------------------
// Data members
//
- // fElemStack
- // This is the element stack that is used to track the elements that
- // are currently being worked on.
- //
// fEntityTable
// This the table that contains the default entity entries.
//
@@ -217,7 +215,6 @@
ValueVectorOf<unsigned int>* fAttrNameHashList;
ValueVectorOf<XMLAttr*>* fAttrNSList;
RefHashTableOf<XMLElementDecl>* fElementLookup;
- ElemStack fElemStack;
};
inline const XMLCh* WFXMLScanner::getName() const
1.16 +1 -3 xml-xerces/c/src/xercesc/internal/WFXMLScanner.cpp
Index: WFXMLScanner.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/WFXMLScanner.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- WFXMLScanner.cpp 1 Oct 2003 16:32:38 -0000 1.15
+++ WFXMLScanner.cpp 22 Oct 2003 20:22:30 -0000 1.16
@@ -90,7 +90,6 @@
, fAttrNameHashList(0)
, fAttrNSList(0)
, fElementLookup(0)
- , fElemStack(manager)
{
try
{
@@ -122,7 +121,6 @@
, fAttrNameHashList(0)
, fAttrNSList(0)
, fElementLookup(0)
- , fElemStack(manager)
{
try
{
1.10 +3 -6 xml-xerces/c/src/xercesc/internal/SGXMLScanner.hpp
Index: SGXMLScanner.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/SGXMLScanner.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SGXMLScanner.hpp 22 Sep 2003 19:51:41 -0000 1.9
+++ SGXMLScanner.hpp 22 Oct 2003 20:22:30 -0000 1.10
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.10 2003/10/22 20:22:30 knoaman
+ * Prepare for annotation support.
+ *
* Revision 1.9 2003/09/22 19:51:41 neilg
* scanners should maintain their own pools of undeclared elements, rather than
requiring grammars to do this. This makes grammar objects stateless with regard to
validation.
*
@@ -91,7 +94,6 @@
#define SGXMLSCANNER_HPP
#include <xercesc/internal/XMLScanner.hpp>
-#include <xercesc/internal/ElemStack.hpp>
#include <xercesc/util/KVStringPair.hpp>
#include <xercesc/util/ValueHashTableOf.hpp>
#include <xercesc/util/RefHash3KeysIdPool.hpp>
@@ -279,10 +281,6 @@
// -----------------------------------------------------------------------
// Data members
//
- // fElemStack
- // This is the element stack that is used to track the elements that
- // are currently being worked on.
- //
// fRawAttrList
// During the initial scan of the attributes we can only do a raw
// scan for key/value pairs. So this vector is used to store them
@@ -318,7 +316,6 @@
Grammar::GrammarType fGrammarType;
unsigned int fElemStateSize;
unsigned int* fElemState;
- ElemStack fElemStack;
XMLBuffer fContent;
ValueHashTableOf<XMLCh>* fEntityTable;
RefVectorOf<KVStringPair>* fRawAttrList;
1.42 +1 -3 xml-xerces/c/src/xercesc/internal/SGXMLScanner.cpp
Index: SGXMLScanner.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/SGXMLScanner.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- SGXMLScanner.cpp 9 Oct 2003 19:11:37 -0000 1.41
+++ SGXMLScanner.cpp 22 Oct 2003 20:22:30 -0000 1.42
@@ -101,7 +101,6 @@
, fSeeXsi(false)
, fElemStateSize(16)
, fElemState(0)
- , fElemStack(manager)
, fContent(1023, manager)
, fEntityTable(0)
, fRawAttrList(0)
@@ -148,7 +147,6 @@
, fSeeXsi(false)
, fElemStateSize(16)
, fElemState(0)
- , fElemStack(manager)
, fContent(1023, manager)
, fEntityTable(0)
, fRawAttrList(0)
1.11 +3 -6 xml-xerces/c/src/xercesc/internal/IGXMLScanner.hpp
Index: IGXMLScanner.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/IGXMLScanner.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- IGXMLScanner.hpp 22 Sep 2003 19:51:41 -0000 1.10
+++ IGXMLScanner.hpp 22 Oct 2003 20:22:30 -0000 1.11
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.11 2003/10/22 20:22:30 knoaman
+ * Prepare for annotation support.
+ *
* Revision 1.10 2003/09/22 19:51:41 neilg
* scanners should maintain their own pools of undeclared elements, rather than
requiring grammars to do this. This makes grammar objects stateless with regard to
validation.
*
@@ -94,7 +97,6 @@
#define IGXMLSCANNER_HPP
#include <xercesc/internal/XMLScanner.hpp>
-#include <xercesc/internal/ElemStack.hpp>
#include <xercesc/util/KVStringPair.hpp>
#include <xercesc/util/NameIdPool.hpp>
#include <xercesc/util/RefHash3KeysIdPool.hpp>
@@ -288,10 +290,6 @@
// -----------------------------------------------------------------------
// Data members
//
- // fElemStack
- // This is the element stack that is used to track the elements that
- // are currently being worked on.
- //
// fRawAttrList
// During the initial scan of the attributes we can only do a raw
// scan for key/value pairs. So this vector is used to store them
@@ -332,7 +330,6 @@
Grammar::GrammarType fGrammarType;
unsigned int fElemStateSize;
unsigned int* fElemState;
- ElemStack fElemStack;
XMLBuffer fContent;
RefVectorOf<KVStringPair>* fRawAttrList;
DTDValidator* fDTDValidator;
1.26 +1 -3 xml-xerces/c/src/xercesc/internal/IGXMLScanner.cpp
Index: IGXMLScanner.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/IGXMLScanner.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- IGXMLScanner.cpp 5 Oct 2003 02:15:12 -0000 1.25
+++ IGXMLScanner.cpp 22 Oct 2003 20:22:30 -0000 1.26
@@ -98,7 +98,6 @@
, fSeeXsi(false)
, fElemStateSize(16)
, fElemState(0)
- , fElemStack(manager)
, fContent(1023, manager)
, fRawAttrList(0)
, fDTDValidator(0)
@@ -141,7 +140,6 @@
, fSeeXsi(false)
, fElemStateSize(16)
, fElemState(0)
- , fElemStack(manager)
, fContent(1023, manager)
, fRawAttrList(0)
, fDTDValidator(0)
1.7 +36 -25 xml-xerces/c/src/xercesc/internal/ElemStack.hpp
Index: ElemStack.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/ElemStack.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ElemStack.hpp 16 May 2003 21:36:57 -0000 1.6
+++ ElemStack.hpp 22 Oct 2003 20:22:30 -0000 1.7
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.7 2003/10/22 20:22:30 knoaman
+ * Prepare for annotation support.
+ *
* Revision 1.6 2003/05/16 21:36:57 knoaman
* Memory manager implementation: Modify constructors to pass in the memory manager.
*
@@ -119,12 +122,19 @@
#include <xercesc/util/StringPool.hpp>
#include <xercesc/util/QName.hpp>
+#include <xercesc/util/ValueVectorOf.hpp>
XERCES_CPP_NAMESPACE_BEGIN
class XMLElementDecl;
class Grammar;
+struct PrefMapElem : public XMemory
+{
+ unsigned int fPrefId;
+ unsigned int fURIId;
+};
+
//
// During the scan of content, we have to keep up with the nesting of
// elements (for validation and wellformedness purposes) and we have to
@@ -184,12 +194,6 @@
// affected by an sibling xmlns attributes, whereas elements are
// affected by its own xmlns attributes.
// -----------------------------------------------------------------------
- struct PrefMapElem : public XMemory
- {
- unsigned int fPrefId;
- unsigned int fURIId;
- };
-
struct StackElem : public XMemory
{
XMLElementDecl* fThisElement;
@@ -264,7 +268,9 @@
, const MapModes mode
, bool& unknown
) const;
-
+ ValueVectorOf<PrefMapElem*>* getNamespaceMap() const;
+ unsigned int getPrefixId(const XMLCh* const prefix) const;
+ const XMLCh* getPrefixForId(unsigned int prefId) const;
// -----------------------------------------------------------------------
// Miscellaneous methods
@@ -333,18 +339,19 @@
// the 'xml' and 'xmlns' namespaces. And also its prefix pool id,
// which is stored here for fast access.
// -----------------------------------------------------------------------
- unsigned int fEmptyNamespaceId;
- unsigned int fGlobalPoolId;
- XMLStringPool fPrefixPool;
- StackElem** fStack;
- unsigned int fStackCapacity;
- unsigned int fStackTop;
- unsigned int fUnknownNamespaceId;
- unsigned int fXMLNamespaceId;
- unsigned int fXMLPoolId;
- unsigned int fXMLNSNamespaceId;
- unsigned int fXMLNSPoolId;
- MemoryManager* fMemoryManager;
+ unsigned int fEmptyNamespaceId;
+ unsigned int fGlobalPoolId;
+ XMLStringPool fPrefixPool;
+ StackElem** fStack;
+ unsigned int fStackCapacity;
+ unsigned int fStackTop;
+ unsigned int fUnknownNamespaceId;
+ unsigned int fXMLNamespaceId;
+ unsigned int fXMLPoolId;
+ unsigned int fXMLNSNamespaceId;
+ unsigned int fXMLNSPoolId;
+ ValueVectorOf<PrefMapElem*>* fNamespaceMap;
+ MemoryManager* fMemoryManager;
};
@@ -380,12 +387,6 @@
// affected by an sibling xmlns attributes, whereas elements are
// affected by its own xmlns attributes.
// -----------------------------------------------------------------------
- struct PrefMapElem : public XMemory
- {
- unsigned int fPrefId;
- unsigned int fURIId;
- };
-
struct StackElem : public XMemory
{
int fTopPrefix;
@@ -578,6 +579,16 @@
{
fStack[fStackTop-1]->fCurrentURI = uri;
return;
+}
+
+inline unsigned int ElemStack::getPrefixId(const XMLCh* const prefix) const
+{
+ return fPrefixPool.getId(prefix);
+}
+
+inline const XMLCh* ElemStack::getPrefixForId(unsigned int prefId) const
+{
+ return fPrefixPool.getValueForId(prefId);
}
// ---------------------------------------------------------------------------
1.8 +32 -0 xml-xerces/c/src/xercesc/internal/ElemStack.cpp
Index: ElemStack.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/ElemStack.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ElemStack.cpp 18 May 2003 14:02:04 -0000 1.7
+++ ElemStack.cpp 22 Oct 2003 20:22:30 -0000 1.8
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.8 2003/10/22 20:22:30 knoaman
+ * Prepare for annotation support.
+ *
* Revision 1.7 2003/05/18 14:02:04 knoaman
* Memory manager implementation: pass per instance manager.
*
@@ -165,6 +168,7 @@
, fXMLPoolId(0)
, fXMLNSNamespaceId(0)
, fXMLNSPoolId(0)
+ , fNamespaceMap(0)
, fMemoryManager(manager)
{
// Do an initial allocation of the stack and zero it out
@@ -173,6 +177,8 @@
fStackCapacity * sizeof(StackElem*)
);//new StackElem*[fStackCapacity];
memset(fStack, 0, fStackCapacity * sizeof(StackElem*));
+
+ fNamespaceMap = new (fMemoryManager) ValueVectorOf<PrefMapElem*>(16);
}
ElemStack::~ElemStack()
@@ -466,6 +472,32 @@
return fUnknownNamespaceId;
}
+
+ValueVectorOf<PrefMapElem*>* ElemStack::getNamespaceMap() const
+{
+ fNamespaceMap->removeAllElements();
+
+ // Start at the stack top and work backwards until we come to some
+ // element that mapped this prefix.
+ int startAt = (int)(fStackTop - 1);
+ for (int index = startAt; index >= 0; index--)
+ {
+ // Get a convenience pointer to the current element
+ StackElem* curRow = fStack[index];
+
+ // If no prefixes mapped at this level, then go the next one
+ if (!curRow->fMapCount)
+ continue;
+
+ // Search the map at this level for the passed prefix
+ for (unsigned int mapIndex = 0; mapIndex < curRow->fMapCount; mapIndex++)
+ {
+ fNamespaceMap->addElement(&(curRow->fMap[mapIndex]));
+ }
+ }
+
+ return fNamespaceMap;
+}
// ---------------------------------------------------------------------------
// ElemStack: Miscellaneous methods
1.10 +3 -6 xml-xerces/c/src/xercesc/internal/DGXMLScanner.hpp
Index: DGXMLScanner.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/DGXMLScanner.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DGXMLScanner.hpp 22 Sep 2003 19:51:41 -0000 1.9
+++ DGXMLScanner.hpp 22 Oct 2003 20:22:30 -0000 1.10
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.10 2003/10/22 20:22:30 knoaman
+ * Prepare for annotation support.
+ *
* Revision 1.9 2003/09/22 19:51:41 neilg
* scanners should maintain their own pools of undeclared elements, rather than
requiring grammars to do this. This makes grammar objects stateless with regard to
validation.
*
@@ -91,7 +94,6 @@
#define DGXMLSCANNER_HPP
#include <xercesc/internal/XMLScanner.hpp>
-#include <xercesc/internal/ElemStack.hpp>
#include <xercesc/util/ValueVectorOf.hpp>
#include <xercesc/util/NameIdPool.hpp>
#include <xercesc/validators/common/Grammar.hpp>
@@ -223,10 +225,6 @@
// -----------------------------------------------------------------------
// Data members
//
- // fElemStack
- // This is the element stack that is used to track the elements that
- // are currently being worked on.
- //
// fRawAttrList
// During the initial scan of the attributes we can only do a raw
// scan for key/value pairs. So this vector is used to store them
@@ -244,7 +242,6 @@
// registry of "faulted-in" DTD element decls
//
// -----------------------------------------------------------------------
- ElemStack fElemStack;
ValueVectorOf<XMLAttr*>* fAttrNSList;
DTDValidator* fDTDValidator;
DTDGrammar* fDTDGrammar;
1.25 +1 -3 xml-xerces/c/src/xercesc/internal/DGXMLScanner.cpp
Index: DGXMLScanner.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/DGXMLScanner.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- DGXMLScanner.cpp 1 Oct 2003 16:32:38 -0000 1.24
+++ DGXMLScanner.cpp 22 Oct 2003 20:22:30 -0000 1.25
@@ -90,7 +90,6 @@
, MemoryManager* const manager) :
XMLScanner(valToAdopt, grammarResolver, manager)
- , fElemStack(manager)
, fAttrNSList(0)
, fDTDValidator(0)
, fDTDGrammar(0)
@@ -130,7 +129,6 @@
, MemoryManager* const manager) :
XMLScanner(docHandler, docTypeHandler, entityHandler, errHandler, valToAdopt,
grammarResolver, manager)
- , fElemStack(manager)
, fAttrNSList(0)
, fDTDValidator(0)
, fDTDGrammar(0)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]