saxparser.hpp
来自「IBM的解析xml的工具Xerces的源代码」· HPP 代码 · 共 1,708 行 · 第 1/5 页
HPP
1,708 行
/* * Copyright 1999-2004 The Apache Software Foundation. * * Licensed 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. *//* * $Log: SAXParser.hpp,v $ * Revision 1.36 2004/09/29 19:28:12 cargilld * Mark SAXParser as deprecated. * * Revision 1.35 2004/09/29 19:00:29 peiyongz * [jira1207] --patch from Dan Rosen * * Revision 1.34 2004/09/28 02:14:14 cargilld * Add support for validating annotations. * * Revision 1.33 2004/09/23 01:09:55 cargilld * Add support for generating synthetic XSAnnotations. When a schema component has non-schema attributes and no child attributes create a synthetic XSAnnotation (under feature control) so the non-schema attributes can be recovered under PSVI. * * Revision 1.32 2004/09/08 13:56:18 peiyongz * Apache License Version 2.0 * * Revision 1.31 2004/09/02 19:08:09 cargilld * Fix API Doc warning message * * Revision 1.30 2004/04/13 18:58:36 peiyongz * correct comment * * Revision 1.29 2004/04/13 16:53:26 peiyongz * get/setIdentityConstraintChecking * * Revision 1.28 2003/12/01 23:23:26 neilg * fix for bug 25118; thanks to Jeroen Witmond * * Revision 1.27 2003/11/06 15:30:07 neilg * first part of PSVI/schema component model implementation, thanks to David Cargill. This covers setting the PSVIHandler on parser objects, as well as implementing XSNotation, XSSimpleTypeDefinition, XSIDCDefinition, and most of XSWildcard, XSComplexTypeDefinition, XSElementDeclaration, XSAttributeDeclaration and XSAttributeUse. * * Revision 1.26 2003/10/30 21:37:31 knoaman * Enhanced Entity Resolver Support. Thanks to David Cargill. * * Revision 1.25 2003/10/20 13:41:10 amassari * Added getGrammarResolver API * * Revision 1.24 2003/06/20 18:55:54 peiyongz * Stateless Grammar Pool :: Part I * * Revision 1.23 2003/05/15 18:26:50 knoaman * Partial implementation of the configurable memory manager. * * Revision 1.22 2003/04/17 21:58:50 neilg * Adding a new property, * http://apache.org/xml/properties/security-manager, with * appropriate getSecurityManager/setSecurityManager methods on DOM * and SAX parsers. Also adding a new SecurityManager class. * * The purpose of these modifications is to permit applications a * means to have the parser reject documents whose processing would * otherwise consume large amounts of system resources. Malicious * use of such documents could be used to launch a denial-of-service * attack against a system running the parser. Initially, the * SecurityManager only knows about attacks that can result from * exponential entity expansion; this is the only known attack that * involves processing a single XML document. Other, simlar attacks * can be launched if arbitrary schemas may be parsed; there already * exist means (via use of the EntityResolver interface) by which * applications can deny processing of untrusted schemas. In future, * the SecurityManager will be expanded to take these other exploits * into account. * * Add support for the SecurityManager * * Revision 1.21 2003/03/07 18:09:17 tng * Return a reference instead of void for operator= * * Revision 1.20 2003/02/04 19:27:43 knoaman * Performance: use global buffer to eliminate repetitive memory creation/deletion. * * Revision 1.19 2003/01/09 19:07:08 tng * [Bug 15802] Add "const" qualifier to getURIText. * * Revision 1.18 2003/01/03 20:09:36 tng * New feature StandardUriConformant to force strict standard uri conformance. * * Revision 1.17 2002/12/30 20:15:51 knoaman * Make calculate src offset option false by default. * * Revision 1.16 2002/12/23 15:23:18 knoaman * Added a public api to various parsers to return the src offset within the input * source. * * Revision 1.15 2002/12/04 01:57:09 knoaman * Scanner re-organization. * * Revision 1.14 2002/11/04 14:57:03 tng * C++ Namespace Support. * * Revision 1.13 2002/08/14 15:20:38 knoaman * [Bug 3111] Problem with LexicalHandler::startDTD() and LexicalHandler::endDTD(). * * Revision 1.12 2002/07/11 18:27:03 knoaman * Grammar caching/preparsing - initial implementation. * * Revision 1.11 2002/06/27 18:48:04 tng * API Documentation Update and move getScanner as protected * * Revision 1.10 2002/06/17 15:41:44 tng * Update API Documentation * * Revision 1.9 2002/06/06 20:38:18 tng * Document Fix: document that the returned object from resolveEntity is owned by the parser * * Revision 1.8 2002/05/31 15:13:53 tng * Fix doxygen documentation. * * Revision 1.7 2002/05/30 16:39:06 knoaman * DOM L3 LS. * * Revision 1.6 2002/05/30 16:20:09 tng * Add feature to optionally ignore external DTD. * * Revision 1.5 2002/05/29 21:37:47 knoaman * Add baseURI to resolveEntity to support DOMInputSource. * * Revision 1.4 2002/05/28 20:44:14 tng * [Bug 9104] prefixes dissapearing when schema validation turned on. * * Revision 1.3 2002/05/27 18:39:21 tng * To get ready for 64 bit large file, use XMLSSize_t to represent line and column number. * * Revision 1.2 2002/02/20 18:17:01 tng * [Bug 5977] Warnings on generating apiDocs. * * Revision 1.1.1.1 2002/02/01 22:22:07 peiyongz * sane_include * * Revision 1.22 2001/12/05 22:09:02 tng * Update documentation for setExternalSchemaLocation and setExternalNoNamespaceSchemaLocation. * * Revision 1.21 2001/11/20 18:51:44 tng * Schema: schemaLocation and noNamespaceSchemaLocation to be specified outside the instance document. New methods setExternalSchemaLocation and setExternalNoNamespaceSchemaLocation are added (for SAX2, two new properties are added). * * Revision 1.20 2001/08/01 19:11:02 tng * Add full schema constraint checking flag to the samples and the parser. * * Revision 1.19 2001/07/27 20:24:21 tng * put getScanner() back as they were there before, not to break existing apps. * * Revision 1.18 2001/07/16 12:52:09 tng * APIDocs fix: default for schema processing in DOMParser, IDOMParser, and SAXParser should be false. * * Revision 1.17 2001/06/23 14:13:16 tng * Remove getScanner from the Parser headers as this is not needed and Scanner is not internal class. * * Revision 1.16 2001/06/03 19:26:20 jberry * Add support for querying error count following parse; enables simple parse without requiring error handler. * * Revision 1.15 2001/05/11 13:26:22 tng * Copyright update. * * Revision 1.14 2001/05/03 19:09:25 knoaman * Support Warning/Error/FatalError messaging. * Validity constraints errors are treated as errors, with the ability by user to set * validity constraints as fatal errors. * * Revision 1.13 2001/03/30 16:46:57 tng * Schema: Use setDoSchema instead of setSchemaValidation which makes more sense. * * Revision 1.12 2001/03/21 21:56:09 tng * Schema: Add Schema Grammar, Schema Validator, and split the DTDValidator into DTDValidator, DTDScanner, and DTDGrammar. * * Revision 1.11 2001/02/15 15:56:29 tng * Schema: Add setSchemaValidation and getSchemaValidation for DOMParser and SAXParser. * Add feature "http://apache.org/xml/features/validation/schema" for SAX2XMLReader. * New data field fSchemaValidation in XMLScanner as the flag. * * Revision 1.10 2001/01/12 21:23:41 tng * Documentation Enhancement: explain values of Val_Scheme * * Revision 1.9 2000/08/02 18:05:15 jpolast * changes required for sax2 * (changed private members to protected) * * Revision 1.8 2000/04/12 22:58:30 roddey * Added support for 'auto validate' mode. * * Revision 1.7 2000/03/03 01:29:34 roddey * Added a scanReset()/parseReset() method to the scanner and * parsers, to allow for reset after early exit from a progressive parse. * Added calls to new Terminate() call to all of the samples. Improved * documentation in SAX and DOM parsers. * * Revision 1.6 2000/02/17 03:54:27 rahulj * Added some new getters to query the parser state and * clarified the documentation. * * Revision 1.5 2000/02/16 03:42:58 rahulj * Finished documenting the SAX Driver implementation. * * Revision 1.4 2000/02/15 04:47:37 rahulj * Documenting the SAXParser framework. Not done yet. * * Revision 1.3 2000/02/06 07:47:56 rahulj * Year 2K copyright swat. * * Revision 1.2 1999/12/15 19:57:48 roddey * Got rid of redundant 'const' on boolean return value. Some compilers choke * on this and its useless. * * Revision 1.1.1.1 1999/11/09 01:07:51 twl * Initial checkin * * Revision 1.6 1999/11/08 20:44:54 rahul * Swat for adding in Product name and CVS comment log variable. * */#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. *
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?