📄 saxparser.hpp
字号:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//* * $Id: SAXParser.hpp 568078 2007-08-21 11:43:25Z amassari $ */#if !defined(SAXPARSER_HPP)#define SAXPARSER_HPP#include <xercesc/sax/Parser.hpp>#include <xercesc/internal/VecAttrListImpl.hpp>#include <xercesc/framework/XMLDocumentHandler.hpp>#include <xercesc/framework/XMLElementDecl.hpp>#include <xercesc/framework/XMLEntityHandler.hpp>#include <xercesc/framework/XMLErrorReporter.hpp>#include <xercesc/framework/XMLBuffer.hpp>#include <xercesc/util/SecurityManager.hpp>#include <xercesc/validators/DTD/DocTypeHandler.hpp>XERCES_CPP_NAMESPACE_BEGINclass DocumentHandler;class EntityResolver;class XMLPScanToken;class XMLScanner;class XMLValidator;class Grammar;class GrammarResolver;class XMLGrammarPool;class XMLEntityResolver;class XMLResourceIdentifier;class PSVIHandler;/** * This class implements the SAX 'Parser' interface and should be * used by applications wishing to parse the XML files using SAX. * It allows the client program to install SAX handlers for event * callbacks. * * <p>It can be used to instantiate a validating or non-validating * parser, by setting a member flag.</p> * * @deprecated This interface has been replaced by the SAX2 * interface, which includes Namespace support. * See SAX2XMLReader for more information. */class PARSERS_EXPORT SAXParser : public XMemory , public Parser , public XMLDocumentHandler , public XMLErrorReporter , public XMLEntityHandler , public DocTypeHandler {public : // ----------------------------------------------------------------------- // Class types // ----------------------------------------------------------------------- /** ValScheme enum used in setValidationScheme * Val_Never: Do not report validation errors. * Val_Always: The parser will always report validation errors. * Val_Auto: The parser will report validation errors only if a grammar is specified. * * @see #setValidationScheme */ enum ValSchemes { Val_Never , Val_Always , Val_Auto }; // ----------------------------------------------------------------------- // Constructors and Destructor // ----------------------------------------------------------------------- /** @name Constructors and Destructor */ //@{ /** Constructor with an instance of validator class to use for * validation. * @param valToAdopt Pointer to the validator instance to use. The * parser is responsible for freeing the memory. * @param manager Pointer to the memory manager to be used to * allocate objects. * @param gramPool The collection of cached grammers. */ SAXParser ( XMLValidator* const valToAdopt = 0 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager , XMLGrammarPool* const gramPool = 0 ); /** * Destructor */ ~SAXParser(); //@} // ----------------------------------------------------------------------- // Getter Methods // ----------------------------------------------------------------------- /** @name Getter methods */ //@{ /** * This method returns the installed document handler. Suitable * for 'lvalue' usages. * * @return The pointer to the installed document handler object. */ DocumentHandler* getDocumentHandler(); /** * This method returns the installed document handler. Suitable * only for 'rvalue' usages. * * @return A const pointer to the installed document handler object. */ const DocumentHandler* getDocumentHandler() const; /** * This method returns the installed entity resolver. Suitable * for 'lvalue' usages. * * @return The pointer to the installed entity resolver object. */ EntityResolver* getEntityResolver(); /** * This method returns the installed entity resolver. Suitable * for 'rvalue' usages. * * @return A const pointer to the installed entity resolver object. */ const EntityResolver* getEntityResolver() const; /** * This method returns the installed entity resolver. Suitable * for 'lvalue' usages. * * @return The pointer to the installed entity resolver object. */ XMLEntityResolver* getXMLEntityResolver(); /** * This method returns the installed entity resolver. Suitable * for 'rvalue' usages. * * @return A const pointer to the installed entity resolver object. */ const XMLEntityResolver* getXMLEntityResolver() const; /** * This method returns the installed error handler. Suitable * for 'lvalue' usages. * * @return The pointer to the installed error handler object. */ ErrorHandler* getErrorHandler(); /** * This method returns the installed error handler. Suitable * for 'rvalue' usages. * * @return A const pointer to the installed error handler object. */ const ErrorHandler* getErrorHandler() const; /** * This method returns the installed PSVI handler. Suitable * for 'lvalue' usages. * * @return The pointer to the installed PSVI handler object. */ PSVIHandler* getPSVIHandler(); /** * This method returns the installed PSVI handler. Suitable * for 'rvalue' usages. * * @return A const pointer to the installed PSVI handler object. */ const PSVIHandler* getPSVIHandler() const; /** * This method returns a reference to the parser's installed * validator. * * @return A const reference to the installed validator object. */ const XMLValidator& getValidator() const; /** * This method returns an enumerated value that indicates the current * validation scheme set on this parser. * * @return The ValSchemes value current set on this parser. * @see #setValidationScheme */ ValSchemes getValidationScheme() const; /** Get the 'do schema' flag * * This method returns the state of the parser's schema processing * flag. * * @return true, if the parser is currently configured to * understand schema, false otherwise. * * @see #setDoSchema */ bool getDoSchema() const; /** Get the 'full schema constraint checking' flag * * This method returns the state of the parser's full schema constraint * checking flag. * * @return true, if the parser is currently configured to * have full schema constraint checking, false otherwise. * * @see #setValidationSchemaFullChecking */ bool getValidationSchemaFullChecking() const; /** Get the 'identity constraint checking' flag * * This method returns the state of the parser's identity constraint * checking flag. * * @return true, if the parser is currently configured to * have identity constraint checking, false otherwise. * * @see #setIdentityConstraintChecking */ bool getIdentityConstraintChecking() const; /** Get error count from the last parse operation. * * This method returns the error count from the last parse * operation. Note that this count is actually stored in the * scanner, so this method simply returns what the * scanner reports. * * @return number of errors encountered during the latest * parse operation. */ int getErrorCount() const; /** * This method returns the state of the parser's namespace * handling capability. * * @return true, if the parser is currently configured to * understand namespaces, false otherwise. * * @see #setDoNamespaces */ bool getDoNamespaces() const; /** * This method returns the state of the parser's * exit-on-First-Fatal-Error flag. * * @return true, if the parser is currently configured to * exit on the first fatal error, false otherwise. * * @see #setExitOnFirstFatalError */ bool getExitOnFirstFatalError() const; /** * This method returns the state of the parser's * validation-constraint-fatal flag. * * @return true, if the parser is currently configured to * set validation constraint errors as fatal, false * otherwise. * * @see #setValidationContraintFatal */ bool getValidationConstraintFatal() const; /** Get the set of Namespace/SchemaLocation that is specified externaly. * * This method returns the list of Namespace/SchemaLocation that was * specified using setExternalSchemaLocation. * * The parser owns the returned string, and the memory allocated for * the returned string will be destroyed when the parser is deleted. * * To ensure assessiblity of the returned information after the parser * is deleted, callers need to copy and store the returned information * somewhere else. * * @return a pointer to the list of Namespace/SchemaLocation that was * specified externally. The pointer spans the same life-time as * the parser. A null pointer is returned if nothing * was specified externally. * * @see #setExternalSchemaLocation(const XMLCh* const) */ XMLCh* getExternalSchemaLocation() const; /** Get the noNamespace SchemaLocation that is specified externaly. * * This method returns the no target namespace XML Schema Location * that was specified using setExternalNoNamespaceSchemaLocation. * * The parser owns the returned string, and the memory allocated for * the returned string will be destroyed when the parser is deleted. * * To ensure assessiblity of the returned information after the parser * is deleted, callers need to copy and store the returned information * somewhere else. * * @return a pointer to the no target namespace Schema Location that was * specified externally. The pointer spans the same life-time as * the parser. A null pointer is returned if nothing * was specified externally. * * @see #setExternalNoNamespaceSchemaLocation(const XMLCh* const) */ XMLCh* getExternalNoNamespaceSchemaLocation() const;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -