📄 abstractdomparser.hpp
字号:
//@{ /** Construct a AbstractDOMParser, with an optional validator * * Constructor with an instance of validator class to use for * validation. If you don't provide a validator, a default one will * be created for you in the scanner. * * @param valToAdopt Pointer to the validator instance to use. The * parser is responsible for freeing the memory. * * @param gramPool Pointer to the grammar pool instance from * external application (through derivatives). * The parser does NOT own it. * * @param manager Pointer to the memory manager to be used to * allocate objects. */ AbstractDOMParser ( XMLValidator* const valToAdopt = 0 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager , XMLGrammarPool* const gramPool = 0 ); //@} // ----------------------------------------------------------------------- // Protected getter methods // ----------------------------------------------------------------------- /** @name Protected getter methods */ //@{ /** Get the current DOM node * * This provides derived classes with access to the current node, i.e. * the node to which new nodes are being added. */ DOMNode* getCurrentNode(); /** Get the XML scanner * * This provides derived classes with access to the XML scanner. */ XMLScanner* getScanner() const; /** Get the Grammar resolver * * This provides derived classes with access to the grammar resolver. */ GrammarResolver* getGrammarResolver() const; /** Get the parse in progress flag * * This provides derived classes with access to the parse in progress * flag. */ bool getParseInProgress() const; MemoryManager* getMemoryManager() const; //@} // ----------------------------------------------------------------------- // Protected setter methods // ----------------------------------------------------------------------- /** @name Protected setter methods */ //@{ /** Set the current DOM node * * This method sets the current node maintained inside the parser to * the one specified. * * @param toSet The DOM node which will be the current node. */ void setCurrentNode(DOMNode* toSet); /** Set the document node * * This method sets the DOM Document node to the one specified. * * @param toSet The new DOM Document node for this XML document. */ void setDocument(DOMDocument* toSet); /** Set the parse in progress flag * * This method sets the parse in progress flag to true or false. * * @param toSet The value of the flag to be set. */ void setParseInProgress(const bool toSet); //@} // ----------------------------------------------------------------------- // Protected Helper methods // ----------------------------------------------------------------------- /** @name Protected helper methods */ //@{ virtual DOMElement* createElementNSNode(const XMLCh *fNamespaceURI, const XMLCh *qualifiedName); void resetPool(); /** * Returns true if the user has adopted the document */ bool isDocumentAdopted() const; //@}private : // ----------------------------------------------------------------------- // Initialize/Cleanup methods // ----------------------------------------------------------------------- void initialize(); void cleanUp(); // ----------------------------------------------------------------------- // Unimplemented constructors and operators // ----------------------------------------------------------------------- AbstractDOMParser(const AbstractDOMParser&); AbstractDOMParser& operator=(const AbstractDOMParser&);protected: // ----------------------------------------------------------------------- // Protected data members // // fCurrentNode // fCurrentParent // Used to track the current node during nested element events. Since // the tree must be built from a set of disjoint callbacks, we need // these to keep up with where we currently are. // // fCurrentEntity // Used to track the current entity decl. If a text decl is seen later on, // it is used to update the encoding and version information. // // fDocument // The root document object, filled with the document contents. // // fCreateEntityReferenceNodes // Indicates whether entity reference nodes should be created. // // fIncludeIgnorableWhitespace // Indicates whether ignorable whiltespace should be added to // the DOM tree for validating parsers. // // fScanner // The scanner used for this parser. This is created during the // constructor. // // fImplementationFeatures // The implementation features that we use to get an implementation // for use in creating the DOMDocument used during parse. If this is // null then the default DOMImplementation is used // // fNodeStack // Used to track previous parent nodes during nested element events. // // fParseInProgress // Used to prevent multiple entrance to the parser while its doing // a parse. // // fWithinElement // A flag to indicate that the parser is within at least one level // of element processing. // // fDocumentType // Used to store and update the documentType variable information // in fDocument // // fDocumentVector // Store all the previous fDocument(s) (thus not the current fDocument) // created in this parser. It is destroyed when the parser is destructed. // // fCreateCommentNodes // Indicates whether comment nodes should be created. // // fDocumentAdoptedByUser // The DOMDocument ownership has been transferred to application // If set to true, the parser does not own the document anymore // and thus will not release its memory. // // fInternalSubset // Buffer for storing the internal subset information. // Once complete (after DOCTYPE is finished scanning), send // it to DocumentType Node // // fGrammarPool // The grammar pool passed from external application (through derivatives). // which could be 0, not owned. // // ----------------------------------------------------------------------- bool fCreateEntityReferenceNodes; bool fIncludeIgnorableWhitespace; bool fWithinElement; bool fParseInProgress; bool fCreateCommentNodes; bool fDocumentAdoptedByUser; XMLScanner* fScanner; XMLCh* fImplementationFeatures; DOMNode* fCurrentParent; DOMNode* fCurrentNode; DOMEntity* fCurrentEntity; DOMDocumentImpl* fDocument; ValueStackOf<DOMNode*>* fNodeStack; DOMDocumentTypeImpl* fDocumentType; RefVectorOf<DOMDocumentImpl>* fDocumentVector; GrammarResolver* fGrammarResolver; XMLStringPool* fURIStringPool; XMLValidator* fValidator; MemoryManager* fMemoryManager; XMLGrammarPool* fGrammarPool; XMLBufferMgr fBufMgr; XMLBuffer& fInternalSubset; PSVIHandler* fPSVIHandler;};// ---------------------------------------------------------------------------// AbstractDOMParser: Getter methods// ---------------------------------------------------------------------------inline bool AbstractDOMParser::getExpandEntityReferences() const{ return !fCreateEntityReferenceNodes;}inline bool AbstractDOMParser::getCreateEntityReferenceNodes() const{ return fCreateEntityReferenceNodes;}inline bool AbstractDOMParser::getIncludeIgnorableWhitespace() const{ return fIncludeIgnorableWhitespace;}inline bool AbstractDOMParser::getParseInProgress() const{ return fParseInProgress;}inline XMLScanner* AbstractDOMParser::getScanner() const{ return fScanner;}inline GrammarResolver* AbstractDOMParser::getGrammarResolver() const{ return fGrammarResolver;}inline bool AbstractDOMParser::getCreateCommentNodes() const{ return fCreateCommentNodes;}inline PSVIHandler* AbstractDOMParser::getPSVIHandler(){ return fPSVIHandler;}inline const PSVIHandler* AbstractDOMParser::getPSVIHandler() const{ return fPSVIHandler;}// ---------------------------------------------------------------------------// AbstractDOMParser: Setter methods// ---------------------------------------------------------------------------inline void AbstractDOMParser::setExpandEntityReferences(const bool expand){ fCreateEntityReferenceNodes = !expand;}inline void AbstractDOMParser::setCreateEntityReferenceNodes(const bool create){ fCreateEntityReferenceNodes = create;}inline void AbstractDOMParser::setIncludeIgnorableWhitespace(const bool include){ fIncludeIgnorableWhitespace = include;}inline void AbstractDOMParser::setCreateCommentNodes(const bool create){ fCreateCommentNodes = create;}inline void AbstractDOMParser::useImplementation(const XMLCh* const implementationFeatures){ fMemoryManager->deallocate(fImplementationFeatures); fImplementationFeatures = XMLString::replicate(implementationFeatures, fMemoryManager); }// ---------------------------------------------------------------------------// AbstractDOMParser: Protected getter methods// ---------------------------------------------------------------------------inline DOMNode* AbstractDOMParser::getCurrentNode(){ return fCurrentNode;}inline MemoryManager* AbstractDOMParser::getMemoryManager() const{ return fMemoryManager;}// ---------------------------------------------------------------------------// AbstractDOMParser: Protected setter methods// ---------------------------------------------------------------------------inline void AbstractDOMParser::setCurrentNode(DOMNode* toSet){ fCurrentNode = toSet;}inline void AbstractDOMParser::setDocument(DOMDocument* toSet){ fDocument = (DOMDocumentImpl *)toSet;}inline void AbstractDOMParser::setParseInProgress(const bool toSet){ fParseInProgress = toSet;}XERCES_CPP_NAMESPACE_END#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -