📄 sax2xmlreader.hpp
字号:
*/ virtual void setEntityResolver(EntityResolver* const resolver) = 0; /** * Allow an application to register an error event handler. * * If the application does not register an error event handler, * all error events reported by the SAX parser will be silently * ignored, except for fatalError, which will throw a SAXException * (this is the default behaviour implemented by HandlerBase). * * Applications may register a new or different handler in the * middle of a parse, and the SAX parser must begin using the new * handler immediately. * * @param handler The error handler. * @see ErrorHandler#ErrorHandler * @see SAXException#SAXException * @see HandlerBase#HandlerBase */ virtual void setErrorHandler(ErrorHandler* const handler) = 0; /** * Set the state of any feature in a SAX2 XMLReader. * Supported features in SAX2 for xerces-c are: * <br>(See http://xml.apache.org/xerces-c/program-sax2.html#SAX2Features for detail description). * * <br>http://xml.org/sax/features/validation (default: true) * <br>http://xml.org/sax/features/namespaces (default: true) * <br>http://xml.org/sax/features/namespace-prefixes (default: false) * <br>http://apache.org/xml/features/validation/dynamic (default: false) * <br>http://apache.org/xml/features/validation/reuse-grammar (default: false) * <br>http://apache.org/xml/features/validation/schema (default: true) * <br>http://apache.org/xml/features/validation/schema-full-checking (default: false) * <br>http://apache.org/xml/features/nonvalidating/load-external-dtd (default: true) * <br>http://apache.org/xml/features/continue-after-fatal-error (default: false) * <br>http://apache.org/xml/features/validation-error-as-fatal (default: false) * <br>http://apache.org/xml/features/validation/reuse-validator (Deprecated) (default: false) * * @param name The unique identifier (URI) of the feature. * @param value The requested state of the feature (true or false). * @exception SAXNotRecognizedException If the requested feature is not known. * @exception SAXNotSupportedException Feature modification is not supported during parse * */ virtual void setFeature(const XMLCh* const name, const bool value) = 0; /** * Set the value of any property in a SAX2 XMLReader. * Supported properties in SAX2 for xerces-c are: * <br>(See http://xml.apache.org/xerces-c/program-sax2.html#SAX2Properties for detail description). * * <br>http://apache.org/xml/properties/schema/external-schemaLocation * <br>http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation. * * It takes a void pointer as the property value. Application is required to initialize this void * pointer to a correct type. See http://xml.apache.org/xerces-c/program-sax2.html#SAX2Properties * to learn exactly what type of property value each property expects for processing. * Passing a void pointer that was initialized with a wrong type will lead to unexpected result. * If the same property is set more than once, the last one takes effect. * * @param name The unique identifier (URI) of the property being set. * @param value The requested value for the property. See * http://xml.apache.org/xerces-c/program-sax2.html#SAX2Properties to learn * exactly what type of property value each property expects for processing. * Passing a void pointer that was initialized with a wrong type will lead * to unexpected result. * @exception SAXNotRecognizedException If the requested property is not known. * @exception SAXNotSupportedException Property modification is not supported during parse */ virtual void setProperty(const XMLCh* const name, void* value) = 0 ; /** * Parse an XML document. * * The application can use this method to instruct the SAX parser * to begin parsing an XML document from any valid input * source (a character stream, a byte stream, or a URI). * * Applications may not invoke this method while a parse is in * progress (they should create a new Parser instead for each * additional XML document). Once a parse is complete, an * application may reuse the same Parser object, possibly with a * different input source. * * @param source The input source for the top-level of the * XML document. * @exception SAXException Any SAX exception, possibly * wrapping another exception. * @exception XMLException An exception from the parser or client * handler code. * @see InputSource#InputSource * @see #setEntityResolver * @see #setDTDHandler * @see #setDocumentHandler * @see #setErrorHandler */ virtual void parse ( const InputSource& source ) = 0; /** * Parse an XML document from a system identifier (URI). * * This method is a shortcut for the common case of reading a * document from a system identifier. It is the exact equivalent * of the following: * * parse(new URLInputSource(systemId)); * * If the system identifier is a URL, it must be fully resolved * by the application before it is passed to the parser. * * @param systemId The system identifier (URI). * @exception SAXException Any SAX exception, possibly * wrapping another exception. * @exception XMLException An exception from the parser or client * handler code. * @see #parse(InputSource) */ virtual void parse ( const XMLCh* const systemId ) = 0; /** * Parse an XML document from a system identifier (URI). * * This method is a shortcut for the common case of reading a * document from a system identifier. It is the exact equivalent * of the following: * * parse(new URLInputSource(systemId)); * * If the system identifier is a URL, it must be fully resolved * by the application before it is passed to the parser. * * @param systemId The system identifier (URI). * @exception SAXException Any SAX exception, possibly * wrapping another exception. * @exception XMLException An exception from the parser or client * handler code. * @see #parse(InputSource) */ virtual void parse ( const char* const systemId ) = 0; //@} // ----------------------------------------------------------------------- // SAX 2.0-ext // ----------------------------------------------------------------------- /** @name SAX 2.0-ext */ //@{ /** * This method returns the installed declaration handler. * * @return A pointer to the installed declaration handler object. */ virtual DeclHandler* getDeclarationHandler() const = 0 ; /** * This method returns the installed lexical handler. * * @return A pointer to the installed lexical handler object. */ virtual LexicalHandler* getLexicalHandler() const = 0 ; /** * Allow an application to register a declaration event handler. * * If the application does not register a declaration handler, * all events reported by the SAX parser will be silently * ignored. (this is the default behaviour implemented by DefaultHandler). * * Applications may register a new or different handler in the * middle of a parse, and the SAX parser must begin using the new * handler immediately. * * @param handler The DTD declaration handler. * @see DeclHandler#DeclHandler * @see SAXException#SAXException * @see DefaultHandler#DefaultHandler */ virtual void setDeclarationHandler(DeclHandler* const handler) = 0; /** * Allow an application to register a lexical event handler. * * If the application does not register a lexical handler, * all events reported by the SAX parser will be silently * ignored. (this is the default behaviour implemented by HandlerBase). * * Applications may register a new or different handler in the * middle of a parse, and the SAX parser must begin using the new * handler immediately. * * @param handler The error handler. * @see LexicalHandler#LexicalHandler * @see SAXException#SAXException * @see HandlerBase#HandlerBase */ virtual void setLexicalHandler(LexicalHandler* const handler) = 0; //@} // ----------------------------------------------------------------------- // Getter Methods // ----------------------------------------------------------------------- /** @name Getter Methods (Xerces-C specific) */ //@{ /** * This method is used to get the current validator. * * <b>SAX2XMLReader assumes responsibility for the validator. It will be * deleted when the XMLReader is destroyed.</b> * * @return A pointer to the validator. An application should not deleted * the object returned. * */ virtual XMLValidator* getValidator() const = 0; /** 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. */ virtual int getErrorCount() const = 0 ; /** * This method returns the state of the parser's * exit-on-First-Fatal-Error flag. * * <p>Or you can query the feature "http://apache.org/xml/features/continue-after-fatal-error" * which indicates the opposite state.</p> * * @return true, if the parser is currently configured to * exit on the first fatal error, false otherwise. * * @see #setExitOnFirstFatalError * @see #getFeature */ virtual bool getExitOnFirstFatalError() const = 0; /** * This method returns the state of the parser's * validation-constraint-fatal flag. * * <p>Or you can query the feature "http://apache.org/xml/features/validation-error-as-fatal" * which means the same thing. * * @return true, if the parser is currently configured to * set validation constraint errors as fatal, false * otherwise. * * @see #setValidationContraintFatal * @see #getFeature */ virtual bool getValidationConstraintFatal() const = 0; /** * Retrieve the grammar that is associated with the specified namespace key * * @param nameSpaceKey Namespace key * @return Grammar associated with the Namespace key. */ virtual Grammar* getGrammar(const XMLCh* const nameSpaceKey) = 0; /** * Retrieve the grammar where the root element is declared. * * @return Grammar where root element declared */ virtual Grammar* getRootGrammar() = 0; /** * Returns the string corresponding to a URI id from the URI string pool. * * @param uriId id of the string in the URI string pool. * @return URI string corresponding to the URI id. */ virtual const XMLCh* getURIText(unsigned int uriId) const = 0; /** * Returns the current src offset within the input source. * * @return offset within the input source */ virtual unsigned int getSrcOffset() const = 0; //@} // ----------------------------------------------------------------------- // Setter Methods // ----------------------------------------------------------------------- /** @name Setter Methods (Xerces-C specific) */ //@{ /** * This method is used to set a validator. * * <b>SAX2XMLReader assumes responsibility for the validator. It will be * deleted when the XMLReader is destroyed.</b> * * @param valueToAdopt A pointer to the validator that the reader should use. * */ virtual void setValidator(XMLValidator* valueToAdopt) = 0; /** * This method allows users to set the parser's behaviour when it * encounters the first fatal error. If set to true, the parser * will exit at the first fatal error. If false, then it will * report the error and continue processing. * * <p>The default value is 'true' and the parser exits on the * first fatal error.</p> * * <p>Or you can set the feature "http://apache.org/xml/features/continue-after-fatal-error" * which has the opposite behaviour.</p> * * <p>If both the feature above and this function are used, the latter takes effect.</p> * * @param newState The value specifying whether the parser should * continue or exit when it encounters the first * fatal error. * * @see #getExitOnFirstFatalError * @see #setFeature
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -