📄 domwriter.hpp
字号:
* @since DOM Level 3 */#include <xercesc/dom/DOMNode.hpp>#include <xercesc/dom/DOMWriterFilter.hpp>#include <xercesc/dom/DOMErrorHandler.hpp>#include <xercesc/framework/XMLFormatter.hpp>XERCES_CPP_NAMESPACE_BEGINclass CDOM_EXPORT DOMWriter {protected : // ----------------------------------------------------------------------- // Hidden constructors // ----------------------------------------------------------------------- /** @name Hidden constructors */ //@{ DOMWriter() {}; //@}private: // ----------------------------------------------------------------------- // Unimplemented constructors and operators // ----------------------------------------------------------------------- /** @name Unimplemented constructors and operators */ //@{ DOMWriter(const DOMWriter &); DOMWriter & operator = (const DOMWriter &); //@}public: // ----------------------------------------------------------------------- // All constructors are hidden, just the destructor is available // ----------------------------------------------------------------------- /** @name Destructor */ //@{ /** * Destructor * */ virtual ~DOMWriter() {}; //@} // ----------------------------------------------------------------------- // Virtual DOMWriter interface // ----------------------------------------------------------------------- /** @name Functions introduced in DOM Level 3 */ //@{ // ----------------------------------------------------------------------- // Feature methods // ----------------------------------------------------------------------- /** * Query whether setting a feature to a specific value is supported. * <br>The feature name has the same form as a DOM hasFeature string. * * <p><b>"Experimental - subject to change"</b></p> * * @param featName The feature name, which is a DOM has-feature style string. * @param state The requested state of the feature (<code>true</code> or * <code>false</code>). * @return <code>true</code> if the feature could be successfully set to * the specified value, or <code>false</code> if the feature is not * recognized or the requested value is not supported. The value of * the feature itself is not changed. * @since DOM Level 3 */ virtual bool canSetFeature(const XMLCh* const featName , bool state) const = 0; /** * Set the state of a feature. * <br>The feature name has the same form as a DOM hasFeature string. * <br>It is possible for a <code>DOMWriter</code> to recognize a feature * name but to be unable to set its value. * * <p><b>"Experimental - subject to change"</b></p> * * @param featName The feature name. * @param state The requested state of the feature (<code>true</code> or * <code>false</code>). * @exception DOMException * Raise a NOT_SUPPORTED_ERR exception when the <code>DOMWriter</code> * recognizes the feature name but cannot set the requested value. * <br>Raise a NOT_FOUND_ERR When the <code>DOMWriter</code> does not * recognize the feature name. * @see getFeature * @since DOM Level 3 */ virtual void setFeature(const XMLCh* const featName , bool state) = 0; /** * Look up the value of a feature. * <br>The feature name has the same form as a DOM hasFeature string * @param featName The feature name, which is a string with DOM has-feature * syntax. * @return The current state of the feature (<code>true</code> or * <code>false</code>). * @exception DOMException * Raise a NOT_FOUND_ERR When the <code>DOMWriter</code> does not * recognize the feature name. * * <p><b>"Experimental - subject to change"</b></p> * * @see setFeature * @since DOM Level 3 */ virtual bool getFeature(const XMLCh* const featName) const = 0; // ----------------------------------------------------------------------- // Setter methods // ----------------------------------------------------------------------- /** * The character encoding in which the output will be written. * <br> The encoding to use when writing is determined as follows: If the * encoding attribute has been set, that value will be used.If the * encoding attribute is <code>null</code> or empty, but the item to be * written includes an encoding declaration, that value will be used.If * neither of the above provides an encoding name, a default encoding of * "UTF-8" will be used. * <br>The default value is <code>null</code>. * * <p><b>"Experimental - subject to change"</b></p> * * @param encoding The character encoding in which the output will be written. * @see getEncoding * @since DOM Level 3 */ virtual void setEncoding(const XMLCh* const encoding) = 0; /** * The end-of-line sequence of characters to be used in the XML being * written out. The only permitted values are these: * <dl> * <dt><code>null</code></dt> * <dd> * Use a default end-of-line sequence. DOM implementations should choose * the default to match the usual convention for text files in the * environment being used. Implementations must choose a default * sequence that matches one of those allowed by 2.11 "End-of-Line * Handling". </dd> * <dt>CR</dt> * <dd>The carriage-return character (#xD).</dd> * <dt>CR-LF</dt> * <dd> The * carriage-return and line-feed characters (#xD #xA). </dd> * <dt>LF</dt> * <dd> The line-feed * character (#xA). </dd> * </dl> * <br>The default value for this attribute is <code>null</code>. * * <p><b>"Experimental - subject to change"</b></p> * * @param newLine The end-of-line sequence of characters to be used. * @see getNewLine * @since DOM Level 3 */ virtual void setNewLine(const XMLCh* const newLine) = 0; /** * The error handler that will receive error notifications during * serialization. The node where the error occured is passed to this * error handler, any modification to nodes from within an error * callback should be avoided since this will result in undefined, * implementation dependent behavior. * * <p><b>"Experimental - subject to change"</b></p> * * @param errorHandler The error handler to be used. * @see getErrorHandler * @since DOM Level 3 */ virtual void setErrorHandler(DOMErrorHandler *errorHandler) = 0; /** * When the application provides a filter, the serializer will call out * to the filter before serializing each Node. Attribute nodes are never * passed to the filter. The filter implementation can choose to remove * the node from the stream or to terminate the serialization early. * * <p><b>"Experimental - subject to change"</b></p> * * @param filter The writer filter to be used. * @see getFilter * @since DOM Level 3 */ virtual void setFilter(DOMWriterFilter *filter) = 0; // ----------------------------------------------------------------------- // Getter methods // ----------------------------------------------------------------------- /** * Return the character encoding in which the output will be written. * * <p><b>"Experimental - subject to change"</b></p> * * @return The character encoding used. * @see setEncoding * @since DOM Level 3 */ virtual const XMLCh* getEncoding() const = 0; /** * Return the end-of-line sequence of characters to be used in the XML being * written out. * * <p><b>"Experimental - subject to change"</b></p> * * @return The end-of-line sequence of characters to be used. * @see setNewLine * @since DOM Level 3 */ virtual const XMLCh* getNewLine() const = 0; /** * Return the error handler that will receive error notifications during * serialization. * * <p><b>"Experimental - subject to change"</b></p> * * @return The error handler to be used. * @see setErrorHandler * @since DOM Level 3 */ virtual DOMErrorHandler* getErrorHandler() const = 0; /** * Return the WriterFilter used. * * <p><b>"Experimental - subject to change"</b></p> * * @return The writer filter used. * @see setFilter * @since DOM Level 3 */ virtual DOMWriterFilter* getFilter() const = 0; // ----------------------------------------------------------------------- // Write methods // ----------------------------------------------------------------------- /** * Write out the specified node as described above in the description of * <code>DOMWriter</code>. Writing a Document or Entity node produces a * serialized form that is well formed XML. Writing other node types * produces a fragment of text in a form that is not fully defined by * this document, but that should be useful to a human for debugging or * diagnostic purposes. * * <p><b>"Experimental - subject to change"</b></p> * * @param destination The destination for the data to be written. * @param nodeToWrite The <code>Document</code> or <code>Entity</code> node to * be written. For other node types, something sensible should be * written, but the exact serialized form is not specified. * @return Returns <code>true</code> if <code>node</code> was * successfully serialized and <code>false</code> in case a failure * occured and the failure wasn't canceled by the error handler. * @exception DOMSystemException * This exception will be raised in response to any sort of IO or system * error that occurs while writing to the destination. It may wrap an * underlying system exception. * @since DOM Level 3 */ virtual bool writeNode(XMLFormatTarget* const destination , const DOMNode &nodeToWrite) = 0; /** * Serialize the specified node as described above in the description of * <code>DOMWriter</code>. The result of serializing the node is * returned as a string. Writing a Document or Entity node produces a * serialized form that is well formed XML. Writing other node types * produces a fragment of text in a form that is not fully defined by * this document, but that should be useful to a human for debugging or * diagnostic purposes. * * <p><b>"Experimental - subject to change"</b></p> * * @param nodeToWrite The node to be written. * @return Returns the serialized data, or <code>null</code> in case a * failure occured and the failure wasn't canceled by the error * handler. The returned string is always in UTF-16. * The encoding information available in DOMWriter is ignored in writeToString(). * @since DOM Level 3 */ virtual XMLCh* writeToString(const DOMNode &nodeToWrite) = 0; //@} // ----------------------------------------------------------------------- // Non-standard Extension // ----------------------------------------------------------------------- /** @name Non-standard Extension */ //@{ /** * Called to indicate that this Writer is no longer in use * and that the implementation may relinquish any resources associated with it. * * Access to a released object will lead to unexpected result. */ virtual void release() = 0; //@}};XERCES_CPP_NAMESPACE_END#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -