+
+XERCES_CPP_NAMESPACE_BEGIN
+
+class DOMElement;
+class DOMTypeInfo;
+
+/**
+ * The DOMAttr class refers to an attribute of an XML element.
+ *
+ * Typically the allowable values for the
+ * attribute are defined in a documenttype definition.
+ * DOMAttr objects inherit the DOMNode interface, but
+ * since attributes are not actually child nodes of the elements they are associated with, the
+ * DOM does not consider them part of the document tree. Thus, the
+ * DOMNode attributes parentNode,
+ * previousSibling, and nextSibling have a null
+ * value for DOMAttr objects. The DOM takes the view that
+ * attributes are properties of elements rather than having a separate
+ * identity from the elements they are associated with; this should make it
+ * more efficient to implement such features as default attributes associated
+ * with all elements of a given type. Furthermore, attribute nodes
+ * may not be immediate children of a DOMDocumentFragment. However,
+ * they can be associated with DOMElement nodes contained within a
+ * DOMDocumentFragment. In short, users of the DOM
+ * need to be aware that DOMAttr nodes have some things in common
+ * with other objects inheriting the DOMNode interface, but they
+ * also are quite distinct.
+ *
+ * @since DOM Level 1
+ */
+class CDOM_EXPORT DOMAttr: public DOMNode {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMAttr() {}
+ DOMAttr(const DOMAttr &other) : DOMNode(other) {}
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented operators */
+ //@{
+ DOMAttr & operator = (const DOMAttr &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMAttr() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMAttr interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 1 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Returns the name of this attribute.
+ * @since DOM Level 1
+ */
+ virtual const XMLCh * getName() const = 0;
+
+ /**
+ *
+ * Returns true if the attribute received its value explicitly in the
+ * XML document, or if a value was assigned programatically with
+ * the setValue function. Returns false if the attribute value
+ * came from the default value declared in the document's DTD.
+ * @since DOM Level 1
+ */
+ virtual bool getSpecified() const = 0;
+
+ /**
+ * Returns the value of the attribute.
+ *
+ * The value of the attribute is returned as a string.
+ * Character and general entity references are replaced with their values.
+ * @since DOM Level 1
+ */
+ virtual const XMLCh * getValue() const = 0;
+
+ // -----------------------------------------------------------------------
+ // Setter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Sets the value of the attribute. A text node with the unparsed contents
+ * of the string will be created.
+ *
+ * @param value The value of the DOM attribute to be set
+ * @since DOM Level 1
+ */
+ virtual void setValue(const XMLCh *value) = 0;
+ //@}
+
+ /** @name Functions introduced in DOM Level 2. */
+ //@{
+ /**
+ * The DOMElement node this attribute is attached to or
+ * null if this attribute is not in use.
+ *
+ * @since DOM Level 2
+ */
+ virtual DOMElement *getOwnerElement() const = 0;
+ //@}
+
+ /** @name Functions introduced in DOM Level 3. */
+ //@{
+ /**
+ * Returns whether this attribute is known to be of type ID or not.
+ * When it is and its value is unique, the ownerElement of this attribute
+ * can be retrieved using getElementById on DOMDocument.
+ *
+ * @return bool stating if this DOMAttr is an ID
+ * @since DOM level 3
+ */
+ virtual bool isId() const = 0;
+
+
+ /**
+ * Returns the type information associated with this attribute.
+ *
+ * @return the DOMTypeInfo associated with this attribute
+ * @since DOM level 3
+ */
+ virtual const DOMTypeInfo * getSchemaTypeInfo() const = 0;
+
+ //@}
+
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
+
diff --git a/include/xercesc/dom/DOMCDATASection.hpp b/include/xercesc/dom/DOMCDATASection.hpp
new file mode 100644
index 0000000..624c6c2
--- /dev/null
+++ b/include/xercesc/dom/DOMCDATASection.hpp
@@ -0,0 +1,104 @@
+/*
+ * 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: DOMCDATASection.hpp 527149 2007-04-10 14:56:39Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMCDATASECTION_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMCDATASECTION_HPP
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+/**
+ * CDATA sections are used to escape blocks of text containing characters that
+ * would otherwise be regarded as markup. The only delimiter that is
+ * recognized in a CDATA section is the "]]>" string that ends the CDATA
+ * section. CDATA sections cannot be nested. Their primary purpose is for
+ * including material such as XML fragments, without needing to escape all
+ * the delimiters.
+ * The data attribute of the DOMText node holds
+ * the text that is contained by the CDATA section. Note that this may
+ * contain characters that need to be escaped outside of CDATA sections and
+ * that, depending on the character encoding ("charset") chosen for
+ * serialization, it may be impossible to write out some characters as part
+ * of a CDATA section.
+ *
The DOMCDATASection interface inherits from the
+ * DOMCharacterData interface through the DOMText
+ * interface. Adjacent DOMCDATASection nodes are not merged by use
+ * of the normalize method of the DOMNode interface.
+ * Because no markup is recognized within a DOMCDATASection,
+ * character numeric references cannot be used as an escape mechanism when
+ * serializing. Therefore, action needs to be taken when serializing a
+ * DOMCDATASection with a character encoding where some of the
+ * contained characters cannot be represented. Failure to do so would not
+ * produce well-formed XML.One potential solution in the serialization
+ * process is to end the CDATA section before the character, output the
+ * character using a character reference or entity reference, and open a new
+ * CDATA section for any further characters in the text node. Note, however,
+ * that some code conversion libraries at the time of writing do not return
+ * an error or exception when a character is missing from the encoding,
+ * making the task of ensuring that data is not corrupted on serialization
+ * more difficult.
+ *
See also the Document Object Model (DOM) Level 2 Core Specification.
+ *
+ * @since DOM Level 1
+ */
+class CDOM_EXPORT DOMCDATASection: public DOMText {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMCDATASection() {}
+ DOMCDATASection(const DOMCDATASection &other) : DOMText(other) {}
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented operators */
+ //@{
+ DOMCDATASection & operator = (const DOMCDATASection &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMCDATASection() {};
+ //@}
+
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
+
diff --git a/include/xercesc/dom/DOMCharacterData.hpp b/include/xercesc/dom/DOMCharacterData.hpp
new file mode 100644
index 0000000..9dc4f1c
--- /dev/null
+++ b/include/xercesc/dom/DOMCharacterData.hpp
@@ -0,0 +1,215 @@
+/*
+ * 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: DOMCharacterData.hpp 527149 2007-04-10 14:56:39Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMCHARACTERDATA_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMCHARACTERDATA_HPP
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+/**
+ * The DOMCharacterData interface extends DOMNode with a set of
+ * attributes and methods for accessing character data in the DOM. For
+ * clarity this set is defined here rather than on each object that uses
+ * these attributes and methods. No DOM objects correspond directly to
+ * DOMCharacterData, though DOMText and others do
+ * inherit the interface from it. All offsets in this interface
+ * start from 0.
+ * As explained in the DOM spec, text strings in
+ * the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In
+ * the following, the term 16-bit units is used whenever necessary to
+ * indicate that indexing on DOMCharacterData is done in 16-bit units.
+ *
See also the Document Object Model (DOM) Level 2 Core Specification.
+ * @since DOM Level 1
+ */
+class CDOM_EXPORT DOMCharacterData: public DOMNode {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMCharacterData() {}
+ DOMCharacterData(const DOMCharacterData &other) : DOMNode(other) {}
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented operators */
+ //@{
+ DOMCharacterData & operator = (const DOMCharacterData &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMCharacterData() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMCharacterData interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 1 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Returns the character data of the node that implements this interface.
+ *
+ * The DOM implementation may not put arbitrary limits on the amount of data that
+ * may be stored in a DOMCharacterData node. However,
+ * implementation limits may mean that the entirety of a node's data may
+ * not fit into a single XMLCh* String. In such cases, the user
+ * may call substringData to retrieve the data in
+ * appropriately sized pieces.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
+ * @since DOM Level 1
+ */
+ virtual const XMLCh * getData() const = 0;
+
+ /**
+ * Returns the number of characters that are available through data and
+ * the substringData method below.
+ *
+ * This may have the value
+ * zero, i.e., CharacterData nodes may be empty.
+ * @since DOM Level 1
+ */
+ virtual XMLSize_t getLength() const = 0;
+
+ /**
+ * Extracts a range of data from the node.
+ *
+ * @param offset Start offset of substring to extract.
+ * @param count The number of characters to extract.
+ * @return The specified substring. If the sum of offset and
+ * count exceeds the length, then all
+ * characters to the end of the data are returned.
+ * @exception DOMException
+ * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
+ * than the number of characters in data, or if the
+ * specified count is negative.
+ * @since DOM Level 1
+ */
+ virtual const XMLCh * substringData(XMLSize_t offset,
+ XMLSize_t count) const = 0;
+
+ // -----------------------------------------------------------------------
+ // String methods
+ // -----------------------------------------------------------------------
+ /**
+ * Append the string to the end of the character data of the node.
+ *
+ * Upon success, data provides access to the concatenation of
+ * data and the XMLCh* String specified.
+ * @param arg The XMLCh* String to append.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * @since DOM Level 1
+ */
+ virtual void appendData(const XMLCh *arg) = 0;
+
+ /**
+ * Insert a string at the specified character offset.
+ *
+ * @param offset The character offset at which to insert.
+ * @param arg The XMLCh* String to insert.
+ * @exception DOMException
+ * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
+ * than the number of characters in data.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * @since DOM Level 1
+ */
+ virtual void insertData(XMLSize_t offset, const XMLCh *arg) = 0;
+
+ /**
+ * Remove a range of characters from the node.
+ *
+ * Upon success,
+ * data and length reflect the change.
+ * @param offset The offset from which to remove characters.
+ * @param count The number of characters to delete. If the sum of
+ * offset and count exceeds length
+ * then all characters from offset to the end of the data
+ * are deleted.
+ * @exception DOMException
+ * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
+ * than the number of characters in data, or if the
+ * specified count is negative.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * @since DOM Level 1
+ */
+ virtual void deleteData(XMLSize_t offset,
+ XMLSize_t count) = 0;
+
+ /**
+ * Replace the characters starting at the specified character offset with
+ * the specified string.
+ *
+ * @param offset The offset from which to start replacing.
+ * @param count The number of characters to replace. If the sum of
+ * offset and count exceeds length
+ * , then all characters to the end of the data are replaced (i.e., the
+ * effect is the same as a remove method call with the same
+ * range, followed by an append method invocation).
+ * @param arg The XMLCh* String with which the range must be
+ * replaced.
+ * @exception DOMException
+ * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
+ * than the number of characters in data, or if the
+ * specified count is negative.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * @since DOM Level 1
+ */
+ virtual void replaceData(XMLSize_t offset,
+ XMLSize_t count,
+ const XMLCh *arg) = 0;
+
+ /**
+ * Sets the character data of the node that implements this interface.
+ *
+ * @param data The XMLCh* String to set.
+ * @since DOM Level 1
+ */
+ virtual void setData(const XMLCh *data) = 0;
+ //@}
+
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
+
diff --git a/include/xercesc/dom/DOMComment.hpp b/include/xercesc/dom/DOMComment.hpp
new file mode 100644
index 0000000..96d197d
--- /dev/null
+++ b/include/xercesc/dom/DOMComment.hpp
@@ -0,0 +1,76 @@
+/*
+ * 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: DOMComment.hpp 527149 2007-04-10 14:56:39Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMCOMMENT_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMCOMMENT_HPP
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+/**
+ * This interface inherits from CharacterData and represents the
+ * content of a comment, i.e., all the characters between the starting '
+ * <!--' and ending '-->'.
+ * See also the Document Object Model (DOM) Level 2 Core Specification.
+ *
+ * @since DOM Level 1
+ */
+class CDOM_EXPORT DOMComment: public DOMCharacterData {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMComment() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMComment(const DOMComment &);
+ DOMComment & operator = (const DOMComment &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMComment() {};
+ //@}
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
diff --git a/include/xercesc/dom/DOMConfiguration.hpp b/include/xercesc/dom/DOMConfiguration.hpp
new file mode 100644
index 0000000..bbd8809
--- /dev/null
+++ b/include/xercesc/dom/DOMConfiguration.hpp
@@ -0,0 +1,454 @@
+/*
+ * 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.
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMCONFIGURATION_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMCONFIGURATION_HPP
+
+//------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------
+
+#include
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+/**
+ * The DOMConfiguration interface represents the configuration of
+ * a document and maintains a table of recognized parameters.
+ * Using the configuration, it is possible to change
+ * Document.normalizeDocument behavior, such as replacing
+ * CDATASection nodes with Text nodes or
+ * specifying the type of the schema that must be used when the
+ * validation of the Document is requested. DOMConfiguration
+ * objects are also used in [DOM Level 3 Load and Save] in
+ * the DOMLSParser and DOMLSSerializer interfaces.
+ *
+ * The DOMConfiguration distinguish two types of parameters:
+ * boolean (boolean parameters) and DOMUserData
+ * (parameters). The names used by the DOMConfiguration object are
+ * defined throughout the DOM Level 3 specifications. Names are
+ * case-insensitive. To avoid possible conflicts, as a
+ * convention, names referring to boolean parameters and
+ * parameters defined outside the DOM specification should be made
+ * unique. Names are recommended to follow the XML name
+ * production rule but it is not enforced by the DOM
+ * implementation. DOM Level 3 Core Implementations are required
+ * to recognize all boolean parameters and parameters defined in
+ * this specification. Each boolean parameter state or parameter
+ * value may then be supported or not by the implementation. Refer
+ * to their definition to know if a state or a value must be
+ * supported or not.
+ *
+ * Note: Parameters are similar to features and properties used in
+ * SAX2 [SAX].
+ *
+ * The following list of parameters defined in the DOM:
+ *
+ * "error-handler"
+ * [required]
+ * A DOMErrorHandler object. If an error is
+ * encountered in the document, the implementation will call
+ * back the DOMErrorHandler registered using this
+ * parameter.
+ * When called, DOMError.relatedData will contain the
+ * closest node to where the error occured. If the
+ * implementation is unable to determine the node where the
+ * error occurs, DOMError.relatedData will contain the
+ * Document node. Mutations to the document from
+ * within an error handler will result in implementation
+ * dependent behaviour.
+ *
+ * "schema-type"
+ * [optional]
+ * A DOMString object containing an absolute URI and
+ * representing the type of the schema language used to
+ * validate a document against. Note that no lexical
+ * checking is done on the absolute URI.
+ * If this parameter is not set, a default value may be
+ * provided by the implementation, based on the schema
+ * languages supported and on the schema language used at
+ * load time.
+ *
+ * Note: For XML Schema [XML Schema Part 1],
+ * applications must use the value
+ * "http://www.w3.org/2001/XMLSchema". For XML DTD
+ * [XML 1.0], applications must use the value
+ * "http://www.w3.org/TR/REC-xml". Other schema languages
+ * are outside the scope of the W3C and therefore should
+ * recommend an absolute URI in order to use this method.
+ *
+ * "schema-location"
+ * [optional]
+ * A DOMString object containing a list of URIs,
+ * separated by white spaces (characters matching the
+ * nonterminal production S defined in section 2.3
+ * [XML 1.0]), that represents the schemas against
+ * which validation should occur. The types of schemas
+ * referenced in this list must match the type specified
+ * with schema-type, otherwise the behaviour of an
+ * implementation is undefined. If the schema type is XML
+ * Schema [XML Schema Part 1], only one of the XML
+ * Schemas in the list can be with no namespace.
+ * If validation occurs against a namespace aware schema,
+ * i.e. XML Schema, and the targetNamespace of a schema
+ * (specified using this property) matches the
+ * targetNamespace of a schema occurring in the instance
+ * document, i.e in schemaLocation attribute, the schema
+ * specified by the user using this property will be used
+ * (i.e., in XML Schema the schemaLocation attribute in the
+ * instance document or on the import element will be
+ * effectively ignored).
+ *
+ * Note: It is illegal to set the schema-location parameter
+ * if the schema-type parameter value is not set. It is
+ * strongly recommended that DOMInputSource.baseURI will be
+ * set, so that an implementation can successfully resolve
+ * any external entities referenced.
+ *
+ * The following list of boolean parameters (features) defined in
+ * the DOM:
+ *
+ * "canonical-form"
+ *
+ * true
+ * [optional]
+ * Canonicalize the document according to the rules
+ * specified in [Canonical XML]. Note that this
+ * is limited to what can be represented in the DOM.
+ * In particular, there is no way to specify the order
+ * of the attributes in the DOM.
+ *
+ * false
+ * [required] (default)
+ * Do not canonicalize the document.
+ *
+ * "cdata-sections"
+ *
+ * true
+ * [required] (default)
+ * Keep CDATASection nodes in the document.
+ *
+ * false
+ * [required]
+ * Transform CDATASection nodes in the document
+ * into Text nodes. The new Text node is
+ * then combined with any adjacent Text node.
+ *
+ * "comments"
+ *
+ * true
+ * [required] (default)
+ * Keep Comment nodes in the document.
+ *
+ * false
+ * [required]
+ * Discard Comment nodes in the Document.
+ *
+ * "datatype-normalization"
+ *
+ * true
+ * [required]
+ * Exposed normalized values in the tree.
+ *
+ * false
+ * [required] (default)
+ * Do not perform normalization on the tree.
+ *
+ * "discard-default-content"
+ *
+ * true
+ * [required] (default)
+ * Use whatever information available to the
+ * implementation (i.e. XML schema, DTD, the specified
+ * flag on Attr nodes, and so on) to decide what
+ * attributes and content should be discarded or not.
+ * Note that the specified flag on Attr nodes in
+ * itself is not always reliable, it is only reliable
+ * when it is set to false since the only case where
+ * it can be set to false is if the attribute was
+ * created by the implementation. The default content
+ * won't be removed if an implementation does not have
+ * any information available.
+ *
+ * false
+ * [required]
+ * Keep all attributes and all content.
+ *
+ * "entities"
+ *
+ * true
+ * [required]
+ * Keep EntityReference and Entity nodes
+ * in the document.
+ *
+ * false
+ * [required] (default)
+ * Remove all EntityReference and Entity
+ * nodes from the document, putting the entity
+ * expansions directly in their place. Text
+ * nodes are into "normal" form. Only
+ * EntityReference nodes to non-defined entities
+ * are kept in the document.
+ *
+ * "infoset"
+ *
+ * true
+ * [required]
+ * Only keep in the document the information defined
+ * in the XML Information Set [XML Information
+ * set].
+ * This forces the following features to false:
+ * namespace-declarations, validate-if-schema,
+ * entities, datatype-normalization, cdata-sections.
+ * This forces the following features to true:
+ * whitespace-in-element-content, comments,
+ * namespaces.
+ * Other features are not changed unless explicitly
+ * specified in the description of the features.
+ * Note that querying this feature with getFeature
+ * returns true only if the individual features
+ * specified above are appropriately set.
+ *
+ * false
+ * Setting infoset to false has no effect.
+ *
+ * "namespaces"
+ *
+ * true
+ * [required] (default)
+ * Perform the namespace processing as defined in
+ * [XML Namespaces].
+ *
+ * false
+ * [optional]
+ * Do not perform the namespace processing.
+ *
+ * "namespace-declarations"
+ *
+ * true
+ * [required] (default)
+ * Include namespace declaration attributes, specified
+ * or defaulted from the schema or the DTD, in the
+ * document. See also the section Declaring
+ * Namespaces in [XML Namespaces].
+ *
+ * false
+ * [required]
+ * Discard all namespace declaration attributes. The
+ * Namespace prefixes are retained even if this
+ * feature is set to false.
+ *
+ * "normalize-characters"
+ *
+ * true
+ * [optional]
+ * Perform the W3C Text Normalization of the
+ * characters [CharModel] in the document.
+ *
+ * false
+ * [required] (default)
+ * Do not perform character normalization.
+ *
+ * "split-cdata-sections"
+ *
+ * true
+ * [required] (default)
+ * Split CDATA sections containing the CDATA section
+ * termination marker ']]>'. When a CDATA section is
+ * split a warning is issued.
+ *
+ * false
+ * [required]
+ * Signal an error if a CDATASection contains an
+ * unrepresentable character.
+ *
+ * "validate"
+ *
+ * true
+ * [optional]
+ * Require the validation against a schema (i.e. XML
+ * schema, DTD, any other type or representation of
+ * schema) of the document as it is being normalized
+ * as defined by [XML 1.0]. If validation errors
+ * are found, or no schema was found, the error
+ * handler is notified. Note also that normalized
+ * values will not be exposed to the schema in used
+ * unless the feature datatype-normalization is true.
+ *
+ * Note: validate-if-schema and validate are mutually
+ * exclusive, setting one of them to true will set the
+ * other one to false.
+ *
+ * false
+ * [required] (default)
+ * Only XML 1.0 non-validating processing must be
+ * done. Note that validation might still happen if
+ * validate-if-schema is true.
+ *
+ * "validate-if-schema"
+ *
+ * true
+ * [optional]
+ * Enable validation only if a declaration for the
+ * document element can be found (independently of
+ * where it is found, i.e. XML schema, DTD, or any
+ * other type or representation of schema). If
+ * validation errors are found, the error handler is
+ * notified. Note also that normalized values will not
+ * be exposed to the schema in used unless the feature
+ * datatype-normalization is true.
+ *
+ * Note: validate-if-schema and validate are mutually
+ * exclusive, setting one of them to true will set the
+ * other one to false.
+ *
+ * false
+ * [required] (default)
+ * No validation should be performed if the document
+ * has a schema. Note that validation must still
+ * happen if validate is true.
+ *
+ * "element-content-whitespace"
+ *
+ * true
+ * [required] (default)
+ * Keep all white spaces in the document.
+ *
+ * false
+ * [optional]
+ * Discard white space in element content while
+ * normalizing. The implementation is expected to use
+ * the isWhitespaceInElementContent flag on Text
+ * nodes to determine if a text node should be written
+ * out or not.
+ *
+ * The resolutions of entities is done using Document.baseURI.
+ * However, when the features "LS-Load" or "LS-Save" defined in
+ * [DOM Level 3 Load and Save] are supported by the DOM
+ * implementation, the parameter "entity-resolver" can also be
+ * used on DOMConfiguration objects attached to Document
+ * nodes. If this parameter is set,
+ * Document.normalizeDocument will invoke the entity
+ * resolver instead of using Document.baseURI.
+ */
+class CDOM_EXPORT DOMConfiguration
+{
+protected:
+ //-----------------------------------------------------------------------------------
+ // Constructor
+ //-----------------------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMConfiguration() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMConfiguration(const DOMConfiguration &);
+ DOMConfiguration & operator = (const DOMConfiguration &);
+ //@}
+
+public:
+
+ // -----------------------------------------------------------------------
+ // Setter methods
+ // -----------------------------------------------------------------------
+
+ /** Set the value of a parameter.
+ * @param name The name of the parameter to set.
+ * @param value The new value or null if the user wishes to unset the
+ * parameter. While the type of the value parameter is defined as
+ * DOMUserData, the object type must match the type defined
+ * by the definition of the parameter. For example, if the parameter is
+ * "error-handler", the value must be of type DOMErrorHandler
+ * @exception DOMException (NOT_SUPPORTED_ERR) Raised when the
+ * parameter name is recognized but the requested value cannot be set.
+ * @exception DOMException (NOT_FOUND_ERR) Raised when the
+ * parameter name is not recognized.
+ * @since DOM level 3
+ **/
+ virtual void setParameter(const XMLCh* name, const void* value) = 0;
+ virtual void setParameter(const XMLCh* name, bool value) = 0;
+
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /** Return the value of a parameter if known.
+ * @param name The name of the parameter.
+ * @return The current object associated with the specified parameter or
+ * null if no object has been associated or if the parameter is not
+ * supported.
+ * @exception DOMException (NOT_FOUND_ERR) Raised when the i
+ * boolean parameter
+ * name is not recognized.
+ * @since DOM level 3
+ **/
+ virtual const void* getParameter(const XMLCh* name) const = 0;
+
+
+ // -----------------------------------------------------------------------
+ // Query methods
+ // -----------------------------------------------------------------------
+
+ /** Check if setting a parameter to a specific value is supported.
+ * @param name The name of the parameter to check.
+ * @param value An object. if null, the returned value is true.
+ * @return true if the parameter could be successfully set to the specified
+ * value, or false if the parameter is not recognized or the requested value
+ * is not supported. This does not change the current value of the parameter
+ * itself.
+ * @since DOM level 3
+ **/
+ virtual bool canSetParameter(const XMLCh* name, const void* value) const = 0;
+ virtual bool canSetParameter(const XMLCh* name, bool value) const = 0;
+
+ /**
+ * The list of the parameters supported by this DOMConfiguration object and
+ * for which at least one value can be set by the application.
+ * Note that this list can also contain parameter names defined outside this specification.
+ *
+ * @return The list of parameters that can be used with setParameter/getParameter
+ * @since DOM level 3
+ **/
+ virtual const DOMStringList* getParameterNames() const = 0;
+
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMConfiguration() {};
+ //@}
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
+/**
+ * End of file DOMConfiguration.hpp
+ */
diff --git a/include/xercesc/dom/DOMDocument.hpp b/include/xercesc/dom/DOMDocument.hpp
new file mode 100644
index 0000000..1505b7d
--- /dev/null
+++ b/include/xercesc/dom/DOMDocument.hpp
@@ -0,0 +1,819 @@
+/*
+ * 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: DOMDocument.hpp 932887 2010-04-11 13:04:59Z borisk $
+*/
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENT_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMDOCUMENT_HPP
+
+#include
+#include
+#include
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+class DOMConfiguration;
+class DOMDocumentType;
+class DOMElement;
+class DOMDocumentFragment;
+class DOMComment;
+class DOMCDATASection;
+class DOMProcessingInstruction;
+class DOMAttr;
+class DOMEntity;
+class DOMEntityReference;
+class DOMImplementation;
+class DOMNodeFilter;
+class DOMNodeList;
+class DOMNotation;
+class DOMText;
+class DOMNode;
+
+
+/**
+ * The DOMDocument interface represents the entire XML
+ * document. Conceptually, it is the root of the document tree, and provides
+ * the primary access to the document's data.
+ * Since elements, text nodes, comments, processing instructions, etc.
+ * cannot exist outside the context of a DOMDocument, the
+ * DOMDocument interface also contains the factory methods needed
+ * to create these objects. The DOMNode objects created have a
+ * ownerDocument attribute which associates them with the
+ * DOMDocument within whose context they were created.
+ *
See also the Document Object Model (DOM) Level 2 Core Specification.
+ */
+
+class CDOM_EXPORT DOMDocument: public DOMDocumentRange,
+ public DOMXPathEvaluator,
+ public DOMDocumentTraversal,
+ public DOMNode {
+
+
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMDocument() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMDocument(const DOMDocument &);
+ DOMDocument & operator = (const DOMDocument &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMDocument() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMDocument interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 1 */
+ //@{
+ /**
+ * Creates an element of the type specified. Note that the instance
+ * returned implements the DOMElement interface, so attributes
+ * can be specified directly on the returned object.
+ *
In addition, if there are known attributes with default values,
+ * DOMAttr nodes representing them are automatically created
+ * and attached to the element.
+ *
To create an element with a qualified name and namespace URI, use
+ * the createElementNS method.
+ * @param tagName The name of the element type to instantiate. For XML,
+ * this is case-sensitive.
+ * @return A new DOMElement object with the
+ * nodeName attribute set to tagName, and
+ * localName, prefix, and
+ * namespaceURI set to null.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified name contains an
+ * illegal character.
+ * @since DOM Level 1
+ */
+ virtual DOMElement *createElement(const XMLCh *tagName) = 0;
+
+ /**
+ * Creates an empty DOMDocumentFragment object.
+ * @return A new DOMDocumentFragment.
+ * @since DOM Level 1
+ */
+ virtual DOMDocumentFragment *createDocumentFragment() = 0;
+
+ /**
+ * Creates a DOMText node given the specified string.
+ * @param data The data for the node.
+ * @return The new DOMText object.
+ * @since DOM Level 1
+ */
+ virtual DOMText *createTextNode(const XMLCh *data) = 0;
+
+ /**
+ * Creates a DOMComment node given the specified string.
+ * @param data The data for the node.
+ * @return The new DOMComment object.
+ * @since DOM Level 1
+ */
+ virtual DOMComment *createComment(const XMLCh *data) = 0;
+
+ /**
+ * Creates a DOMCDATASection node whose value is the specified
+ * string.
+ * @param data The data for the DOMCDATASection contents.
+ * @return The new DOMCDATASection object.
+ * @since DOM Level 1
+ */
+ virtual DOMCDATASection *createCDATASection(const XMLCh *data) = 0;
+
+ /**
+ * Creates a DOMProcessingInstruction node given the specified
+ * name and data strings.
+ * @param target The target part of the processing instruction.
+ * @param data The data for the node.
+ * @return The new DOMProcessingInstruction object.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified target contains an
+ * illegal character.
+ * @since DOM Level 1
+ */
+ virtual DOMProcessingInstruction *createProcessingInstruction(const XMLCh *target,
+ const XMLCh *data) = 0;
+
+
+ /**
+ * Creates an DOMAttr of the given name. Note that the
+ * DOMAttr instance can then be set on an DOMElement
+ * using the setAttributeNode method.
+ *
To create an attribute with a qualified name and namespace URI, use
+ * the createAttributeNS method.
+ * @param name The name of the attribute.
+ * @return A new DOMAttr object with the nodeName
+ * attribute set to name, and localName,
+ * prefix, and namespaceURI set to
+ * null. The value of the attribute is the empty string.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified name contains an
+ * illegal character.
+ * @since DOM Level 1
+ */
+ virtual DOMAttr *createAttribute(const XMLCh *name) = 0;
+
+
+ /**
+ * Creates an DOMEntityReference object. In addition, if the
+ * referenced entity is known, the child list of the
+ * DOMEntityReference node is made the same as that of the
+ * corresponding DOMEntity node.If any descendant of the
+ * DOMEntity node has an unbound namespace prefix, the
+ * corresponding descendant of the created DOMEntityReference
+ * node is also unbound; (its namespaceURI is
+ * null). The DOM Level 2 does not support any mechanism to
+ * resolve namespace prefixes.
+ * @param name The name of the entity to reference.
+ * @return The new DOMEntityReference object.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified name contains an
+ * illegal character.
+ * @since DOM Level 1
+ */
+ virtual DOMEntityReference *createEntityReference(const XMLCh *name) = 0;
+
+ /**
+ * The Document Type Declaration (see DOMDocumentType)
+ * associated with this document. For XML
+ * documents without a document type declaration this returns
+ * null. The DOM Level 2 does not support editing the
+ * Document Type Declaration. docType cannot be altered in
+ * any way, including through the use of methods inherited from the
+ * DOMNode interface, such as insertNode or
+ * removeNode.
+ * @since DOM Level 1
+ */
+ virtual DOMDocumentType *getDoctype() const = 0;
+
+ /**
+ * The DOMImplementation object that handles this document. A
+ * DOM application may use objects from multiple implementations.
+ * @since DOM Level 1
+ */
+ virtual DOMImplementation *getImplementation() const = 0;
+
+ /**
+ * This is a convenience attribute that allows direct access to the child
+ * node that is the root element of the document.
+ * @since DOM Level 1
+ */
+ virtual DOMElement *getDocumentElement() const = 0;
+
+ /**
+ * Returns a DOMNodeList of all the DOMElement(s) with a
+ * given tag name in the order in which they are encountered in a
+ * preorder traversal of the DOMDocument tree.
+ *
+ * The returned node list is "live", in that changes
+ * to the document tree made after a nodelist was initially
+ * returned will be immediately reflected in the node list.
+ * @param tagname The name of the tag to match on. The special value "*"
+ * matches all tags.
+ * @return A new DOMNodeList object containing all the matched
+ * DOMElement(s).
+ * @since DOM Level 1
+ */
+ virtual DOMNodeList *getElementsByTagName(const XMLCh *tagname) const = 0;
+
+ //@}
+
+ /** @name Functions introduced in DOM Level 2. */
+ //@{
+
+ /**
+ * Imports a node from another document to this document. The returned
+ * node has no parent; (parentNode is null).
+ * The source node is not altered or removed from the original document;
+ * this method creates a new copy of the source node.
+ *
For all nodes, importing a node creates a node object owned by the
+ * importing document, with attribute values identical to the source
+ * node's nodeName and nodeType, plus the
+ * attributes related to namespaces (prefix,
+ * localName, and namespaceURI). As in the
+ * cloneNode operation on a DOMNode, the source
+ * node is not altered.
+ *
Additional information is copied as appropriate to the
+ * nodeType, attempting to mirror the behavior expected if
+ * a fragment of XML source was copied from one document to
+ * another, recognizing that the two documents may have different DTDs
+ * in the XML case. The following list describes the specifics for each
+ * type of node.
+ *
+ * - ATTRIBUTE_NODE
+ * - The
ownerElement attribute
+ * is set to null and the specified flag is
+ * set to true on the generated DOMAttr. The
+ * descendants of the source DOMAttr are recursively imported
+ * and the resulting nodes reassembled to form the corresponding subtree.
+ * Note that the deep parameter has no effect on
+ * DOMAttr nodes; they always carry their children with them
+ * when imported.
+ * - DOCUMENT_FRAGMENT_NODE
+ * - If the
deep option
+ * was set to true, the descendants of the source element
+ * are recursively imported and the resulting nodes reassembled to form
+ * the corresponding subtree. Otherwise, this simply generates an empty
+ * DOMDocumentFragment.
+ * - DOCUMENT_NODE
+ * DOMDocument
+ * nodes cannot be imported.
+ * - DOCUMENT_TYPE_NODE
+ * DOMDocumentType
+ * nodes cannot be imported.
+ * - ELEMENT_NODE
+ * - Specified attribute nodes of the
+ * source element are imported, and the generated
DOMAttr
+ * nodes are attached to the generated DOMElement. Default
+ * attributes are not copied, though if the document being imported into
+ * defines default attributes for this element name, those are assigned.
+ * If the importNode deep parameter was set to
+ * true, the descendants of the source element are
+ * recursively imported and the resulting nodes reassembled to form the
+ * corresponding subtree.
+ * - ENTITY_NODE
+ * DOMEntity nodes can be
+ * imported, however in the current release of the DOM the
+ * DOMDocumentType is readonly. Ability to add these imported
+ * nodes to a DOMDocumentType will be considered for addition
+ * to a future release of the DOM.On import, the publicId,
+ * systemId, and notationName attributes are
+ * copied. If a deep import is requested, the descendants
+ * of the the source DOMEntity are recursively imported and
+ * the resulting nodes reassembled to form the corresponding subtree.
+ * -
+ * ENTITY_REFERENCE_NODE
+ * - Only the
DOMEntityReference itself is
+ * copied, even if a deep import is requested, since the
+ * source and destination documents might have defined the entity
+ * differently. If the document being imported into provides a
+ * definition for this entity name, its value is assigned.
+ * - NOTATION_NODE
+ * -
+ *
DOMNotation nodes can be imported, however in the current
+ * release of the DOM the DOMDocumentType is readonly. Ability
+ * to add these imported nodes to a DOMDocumentType will be
+ * considered for addition to a future release of the DOM.On import, the
+ * publicId and systemId attributes are copied.
+ * Note that the deep parameter has no effect on
+ * DOMNotation nodes since they never have any children.
+ * -
+ * PROCESSING_INSTRUCTION_NODE
+ * - The imported node copies its
+ *
target and data values from those of the
+ * source node.
+ * - TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE
+ * - These three
+ * types of nodes inheriting from
DOMCharacterData copy their
+ * data and length attributes from those of
+ * the source node.
+ *
+ * @param importedNode The node to import.
+ * @param deep If true, recursively import the subtree under
+ * the specified node; if false, import only the node
+ * itself, as explained above. This has no effect on DOMAttr
+ * , DOMEntityReference, and DOMNotation nodes.
+ * @return The imported node that belongs to this DOMDocument.
+ * @exception DOMException
+ * NOT_SUPPORTED_ERR: Raised if the type of node being imported is not
+ * supported.
+ * @since DOM Level 2
+ */
+ virtual DOMNode *importNode(const DOMNode *importedNode, bool deep) = 0;
+
+ /**
+ * Creates an element of the given qualified name and namespace URI.
+ * @param namespaceURI The namespace URI of the element to create.
+ * @param qualifiedName The qualified name of the element type to
+ * instantiate.
+ * @return A new DOMElement object with the following
+ * attributes:
+ *
+ *
+ * Attribute |
+ *
+ * Value |
+ *
+ *
+ * DOMNode.nodeName |
+ *
+ * qualifiedName |
+ *
+ *
+ * DOMNode.namespaceURI |
+ *
+ * namespaceURI |
+ *
+ *
+ * DOMNode.prefix |
+ * prefix, extracted
+ * from qualifiedName, or null if there is
+ * no prefix |
+ *
+ *
+ * DOMNode.localName |
+ * local name, extracted from
+ * qualifiedName |
+ *
+ *
+ * DOMElement.tagName |
+ *
+ * qualifiedName |
+ *
+ *
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified qualified name
+ * contains an illegal character, per the XML 1.0 specification .
+ *
NAMESPACE_ERR: Raised if the qualifiedName is
+ * malformed per the Namespaces in XML specification, if the
+ * qualifiedName has a prefix and the
+ * namespaceURI is null, or if the
+ * qualifiedName has a prefix that is "xml" and the
+ * namespaceURI is different from "
+ * http://www.w3.org/XML/1998/namespace" .
+ *
NOT_SUPPORTED_ERR: Always thrown if the current document does not
+ * support the "XML" feature, since namespaces were
+ * defined by XML.
+ * @since DOM Level 2
+ */
+ virtual DOMElement *createElementNS(const XMLCh *namespaceURI,
+ const XMLCh *qualifiedName) = 0;
+
+ /**
+ * Creates an attribute of the given qualified name and namespace URI.
+ * @param namespaceURI The namespace URI of the attribute to create.
+ * @param qualifiedName The qualified name of the attribute to
+ * instantiate.
+ * @return A new DOMAttr object with the following attributes:
+ *
+ *
+ * Attribute |
+ *
+ * Value |
+ *
+ *
+ * DOMNode.nodeName |
+ * qualifiedName |
+ *
+ *
+ *
+ * DOMNode.namespaceURI |
+ * namespaceURI |
+ *
+ *
+ *
+ * DOMNode.prefix |
+ * prefix, extracted from
+ * qualifiedName, or null if there is no
+ * prefix |
+ *
+ *
+ * DOMNode.localName |
+ * local name, extracted from
+ * qualifiedName |
+ *
+ *
+ * DOMAttr.name |
+ *
+ * qualifiedName |
+ *
+ *
+ * DOMNode.nodeValue |
+ * the empty
+ * string |
+ *
+ *
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified qualified name
+ * contains an illegal character, per the XML 1.0 specification .
+ *
NAMESPACE_ERR: Raised if the qualifiedName is
+ * malformed per the Namespaces in XML specification, if the
+ * qualifiedName has a prefix and the
+ * namespaceURI is null, if the
+ * qualifiedName has a prefix that is "xml" and the
+ * namespaceURI is different from "
+ * http://www.w3.org/XML/1998/namespace", or if the
+ * qualifiedName, or its prefix, is "xmlns" and the
+ * namespaceURI is different from "
+ * http://www.w3.org/2000/xmlns/".
+ *
NOT_SUPPORTED_ERR: Always thrown if the current document does not
+ * support the "XML" feature, since namespaces were
+ * defined by XML.
+ * @since DOM Level 2
+ */
+ virtual DOMAttr *createAttributeNS(const XMLCh *namespaceURI,
+ const XMLCh *qualifiedName) = 0;
+
+ /**
+ * Returns a DOMNodeList of all the DOMElement(s) with a
+ * given local name and namespace URI in the order in which they are
+ * encountered in a preorder traversal of the DOMDocument tree.
+ * @param namespaceURI The namespace URI of the elements to match on. The
+ * special value "*" matches all namespaces.
+ * @param localName The local name of the elements to match on. The
+ * special value "*" matches all local names.
+ * @return A new DOMNodeList object containing all the matched
+ * DOMElement(s).
+ * @since DOM Level 2
+ */
+ virtual DOMNodeList *getElementsByTagNameNS(const XMLCh *namespaceURI,
+ const XMLCh *localName) const = 0;
+
+ /**
+ * Returns the DOMElement whose ID is given by
+ * elementId. If no such element exists, returns
+ * null. Behavior is not defined if more than one element
+ * has this ID. The DOM implementation must have
+ * information that says which attributes are of type ID. Attributes
+ * with the name "ID" are not of type ID unless so defined.
+ * Implementations that do not know whether attributes are of type ID or
+ * not are expected to return null.
+ * @param elementId The unique id value for an element.
+ * @return The matching element.
+ * @since DOM Level 2
+ */
+ virtual DOMElement * getElementById(const XMLCh *elementId) const = 0;
+ //@}
+
+ /** @name Functions introduced in DOM Level 3. */
+ //@{
+
+ /**
+ * An attribute specifying the encoding used for this document at the time of the parsing.
+ * This is null when it is not known, such as when the DOMDocument was created in memory.
+ *
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getInputEncoding() const = 0;
+
+ /**
+ * An attribute specifying, as part of the XML declaration, the encoding of this document.
+ * This is null when unspecified or when it is not known, such as when the
+ * DOMDocument was created in memory.
+ *
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getXmlEncoding() const = 0;
+
+ /**
+ * An attribute specifying, as part of the XML declaration, whether this document is standalone.
+ * This is false when unspecified.
+ *
+ * @since DOM Level 3
+ */
+ virtual bool getXmlStandalone() const = 0;
+
+ /**
+ * An attribute specifying, as part of the XML declaration, whether this
+ * document is standalone.
+ *
This attribute represents the property [standalone] defined in .
+ *
+ * @since DOM Level 3
+ */
+ virtual void setXmlStandalone(bool standalone) = 0;
+
+ /**
+ * An attribute specifying, as part of the XML declaration, the version
+ * number of this document. This is null when unspecified.
+ *
This attribute represents the property [version] defined in .
+ *
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getXmlVersion() const = 0;
+
+ /**
+ * An attribute specifying, as part of the XML declaration, the version
+ * number of this document. This is null when unspecified.
+ *
This attribute represents the property [version] defined in .
+ *
+ * @since DOM Level 3
+ */
+ virtual void setXmlVersion(const XMLCh* version) = 0;
+
+ /**
+ * The location of the document or null if undefined.
+ *
Beware that when the DOMDocument supports the feature
+ * "HTML" , the href attribute of the HTML BASE element takes precedence
+ * over this attribute.
+ *
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getDocumentURI() const = 0;
+ /**
+ * The location of the document or null if undefined.
+ *
Beware that when the DOMDocument supports the feature
+ * "HTML" , the href attribute of the HTML BASE element takes precedence
+ * over this attribute.
+ *
+ * @since DOM Level 3
+ */
+ virtual void setDocumentURI(const XMLCh* documentURI) = 0;
+
+ /**
+ * An attribute specifying whether errors checking is enforced or not.
+ * When set to false, the implementation is free to not
+ * test every possible error case normally defined on DOM operations,
+ * and not raise any DOMException. In case of error, the
+ * behavior is undefined. This attribute is true by
+ * defaults.
+ *
+ * @since DOM Level 3
+ */
+ virtual bool getStrictErrorChecking() const = 0;
+ /**
+ * An attribute specifying whether errors checking is enforced or not.
+ * When set to false, the implementation is free to not
+ * test every possible error case normally defined on DOM operations,
+ * and not raise any DOMException. In case of error, the
+ * behavior is undefined. This attribute is true by
+ * defaults.
+ *
+ * @since DOM Level 3
+ */
+ virtual void setStrictErrorChecking(bool strictErrorChecking) = 0;
+
+ /**
+ * Rename an existing node. When possible this simply changes the name of
+ * the given node, otherwise this creates a new node with the specified
+ * name and replaces the existing node with the new node as described
+ * below. This only applies to nodes of type ELEMENT_NODE
+ * and ATTRIBUTE_NODE.
+ *
When a new node is created, the following operations are performed:
+ * the new node is created, any registered event listener is registered
+ * on the new node, any user data attached to the old node is removed
+ * from that node, the old node is removed from its parent if it has
+ * one, the children are moved to the new node, if the renamed node is
+ * an DOMElement its attributes are moved to the new node, the
+ * new node is inserted at the position the old node used to have in its
+ * parent's child nodes list if it has one, the user data that was
+ * attached to the old node is attach to the new node, the user data
+ * event NODE_RENAMED is fired.
+ *
When the node being renamed is an DOMAttr that is
+ * attached to an DOMElement, the node is first removed from
+ * the DOMElement attributes map. Then, once renamed, either
+ * by modifying the existing node or creating a new one as described
+ * above, it is put back.
+ *
+ * @param n The node to rename.
+ * @param namespaceURI The new namespaceURI.
+ * @param qualifiedName The new qualified name.
+ * @return The renamed node. This is either the specified node or the new
+ * node that was created to replace the specified node.
+ * @exception DOMException
+ * NOT_SUPPORTED_ERR: Raised when the type of the specified node is
+ * neither ELEMENT_NODE nor ATTRIBUTE_NODE.
+ *
WRONG_DOCUMENT_ERR: Raised when the specified node was created
+ * from a different document than this document.
+ *
NAMESPACE_ERR: Raised if the qualifiedName is
+ * malformed per the Namespaces in XML specification, if the
+ * qualifiedName has a prefix and the
+ * namespaceURI is null, or if the
+ * qualifiedName has a prefix that is "xml" and the
+ * namespaceURI is different from "
+ * http://www.w3.org/XML/1998/namespace" . Also raised, when the node
+ * being renamed is an attribute, if the qualifiedName,
+ * or its prefix, is "xmlns" and the namespaceURI is
+ * different from "http://www.w3.org/2000/xmlns/".
+ * @since DOM Level 3
+ */
+ virtual DOMNode* renameNode(DOMNode* n, const XMLCh* namespaceURI, const XMLCh* qualifiedName) = 0;
+
+
+ /**
+ * Changes the ownerDocument of a node, its children, as well
+ * as the attached attribute nodes if there are any. If the node has a
+ * parent it is first removed from its parent child list. This
+ * effectively allows moving a subtree from one document to another. The
+ * following list describes the specifics for each type of node.
+ *
+ *
+ * -
+ * ATTRIBUTE_NODE
+ * - The
ownerElement attribute is set to
+ * null and the specified flag is set to
+ * true on the adopted DOMAttr. The descendants
+ * of the source DOMAttr are recursively adopted.
+ * -
+ * DOCUMENT_FRAGMENT_NODE
+ * - The descendants of the source node are
+ * recursively adopted.
+ * - DOCUMENT_NODE
+ * DOMDocument nodes cannot
+ * be adopted.
+ * - DOCUMENT_TYPE_NODE
+ * DOMDocumentType nodes cannot
+ * be adopted.
+ * - ELEMENT_NODE
+ * - Specified attribute nodes of the source
+ * element are adopted, and the generated
DOMAttr nodes.
+ * Default attributes are discarded, though if the document being
+ * adopted into defines default attributes for this element name, those
+ * are assigned. The descendants of the source element are recursively
+ * adopted.
+ * - ENTITY_NODE
+ * DOMEntity nodes cannot be adopted.
+ * -
+ * ENTITY_REFERENCE_NODE
+ * - Only the
DOMEntityReference node
+ * itself is adopted, the descendants are discarded, since the source
+ * and destination documents might have defined the entity differently.
+ * If the document being imported into provides a definition for this
+ * entity name, its value is assigned.
+ * - NOTATION_NODE
+ * DOMNotation
+ * nodes cannot be adopted.
+ * - PROCESSING_INSTRUCTION_NODE, TEXT_NODE,
+ * CDATA_SECTION_NODE, COMMENT_NODE
+ * - These nodes can all be adopted. No
+ * specifics.
+ *
+ * @param source The node to move into this document.
+ * @return The adopted node, or null if this operation
+ * fails, such as when the source node comes from a different
+ * implementation.
+ * @exception DOMException
+ * NOT_SUPPORTED_ERR: Raised if the source node is of type
+ * DOCUMENT, DOCUMENT_TYPE.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is
+ * readonly.
+ * @since DOM Level 3
+ */
+ virtual DOMNode* adoptNode(DOMNode* source) = 0;
+
+ /**
+ * This method acts as if the document was going through a save and load
+ * cycle, putting the document in a "normal" form. The actual result
+ * depends on the features being set. See DOMConfiguration for
+ * details.
+ *
+ *
Noticeably this method normalizes DOMText nodes, makes
+ * the document "namespace wellformed", according to the algorithm
+ * described below in pseudo code, by adding missing namespace
+ * declaration attributes and adding or changing namespace prefixes,
+ * updates the replacement tree of DOMEntityReference nodes,
+ * normalizes attribute values, etc.
+ *
Mutation events, when supported, are generated to reflect the
+ * changes occurring on the document.
+ * Note that this is a partial implementation. Not all the required features are implemented.
+ * Currently DOMAttr and DOMText nodes are normalized.
+ * Features to remove DOMComment and DOMCDATASection work.
+ * @since DOM Level 3
+ *
+ */
+ virtual void normalizeDocument() = 0;
+
+
+ /**
+ * The configuration used when DOMDocument::normalizeDocument is invoked.
+ *
+ * @return The DOMConfiguration from this DOMDocument
+ *
+ * @since DOM Level 3
+ */
+ virtual DOMConfiguration* getDOMConfig() const = 0;
+
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Non-standard extension
+ // -----------------------------------------------------------------------
+ /** @name Non-standard extension */
+ //@{
+ /**
+ * Non-standard extension
+ *
+ * Create a new entity.
+ * @param name The name of the entity to instantiate
+ *
+ */
+ virtual DOMEntity *createEntity(const XMLCh *name) = 0;
+
+ /**
+ * Non-standard extension
+ *
+ * Create a DOMDocumentType node.
+ * @return A DOMDocumentType that references the newly
+ * created DOMDocumentType node.
+ *
+ */
+ virtual DOMDocumentType *createDocumentType(const XMLCh *name) = 0;
+
+ /***
+ * Provide default implementation to maintain source code compatibility
+ ***/
+ virtual DOMDocumentType* createDocumentType(const XMLCh *qName,
+ const XMLCh*, //publicId,
+ const XMLCh* //systemId
+ )
+ {
+ return createDocumentType(qName);
+ }
+
+ /**
+ * Non-standard extension.
+ *
+ * Create a Notation.
+ * @param name The name of the notation to instantiate
+ * @return A DOMNotation that references the newly
+ * created DOMNotation node.
+ */
+ virtual DOMNotation *createNotation(const XMLCh *name) = 0;
+
+ /**
+ * Non-standard extension.
+ *
+ * Creates an element of the given qualified name and
+ * namespace URI, and also stores line/column number info.
+ * Used by internally XSDXercesDOMParser during schema traversal.
+ *
+ * @see createElementNS(const XMLCh *namespaceURI, const XMLCh *qualifiedName)
+ */
+ virtual DOMElement *createElementNS(const XMLCh *namespaceURI,
+ const XMLCh *qualifiedName,
+ const XMLFileLoc lineNum,
+ const XMLFileLoc columnNum) = 0;
+ //@}
+
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMDocumentFragment.hpp b/include/xercesc/dom/DOMDocumentFragment.hpp
new file mode 100644
index 0000000..6f0dceb
--- /dev/null
+++ b/include/xercesc/dom/DOMDocumentFragment.hpp
@@ -0,0 +1,108 @@
+/*
+ * 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: DOMDocumentFragment.hpp 932887 2010-04-11 13:04:59Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTFRAGMENT_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTFRAGMENT_HPP
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+/**
+ * DOMDocumentFragment is a "lightweight" or "minimal"
+ * DOMDocument object.
+ *
+ * It is very common to want to be able to
+ * extract a portion of a document's tree or to create a new fragment of a
+ * document. Imagine implementing a user command like cut or rearranging a
+ * document by moving fragments around. It is desirable to have an object
+ * which can hold such fragments and it is quite natural to use a DOMNode for
+ * this purpose. While it is true that a DOMDocument object could
+ * fulfill this role, a DOMDocument object can potentially be a
+ * heavyweight object, depending on the underlying implementation. What is
+ * really needed for this is a very lightweight object.
+ * DOMDocumentFragment is such an object.
+ * Furthermore, various operations -- such as inserting nodes as children
+ * of another DOMNode -- may take DOMDocumentFragment
+ * objects as arguments; this results in all the child nodes of the
+ * DOMDocumentFragment being moved to the child list of this node.
+ *
The children of a DOMDocumentFragment node are zero or more
+ * nodes representing the tops of any sub-trees defining the structure of the
+ * document. DOMDocumentFragment nodes do not need to be
+ * well-formed XML documents (although they do need to follow the rules
+ * imposed upon well-formed XML parsed entities, which can have multiple top
+ * nodes). For example, a DOMDocumentFragment might have only one
+ * child and that child node could be a DOMText node. Such a
+ * structure model represents neither an HTML document nor a well-formed XML
+ * document.
+ *
When a DOMDocumentFragment is inserted into a
+ * DOMDocument (or indeed any other DOMNode that may take
+ * children) the children of the DOMDocumentFragment and not the
+ * DOMDocumentFragment itself are inserted into the
+ * DOMNode. This makes the DOMDocumentFragment very
+ * useful when the user wishes to create nodes that are siblings; the
+ * DOMDocumentFragment acts as the parent of these nodes so that the
+ * user can use the standard methods from the DOMNode interface,
+ * such as insertBefore() and appendChild().
+ *
+ * @since DOM Level 1
+ */
+
+class CDOM_EXPORT DOMDocumentFragment: public DOMNode {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMDocumentFragment() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMDocumentFragment(const DOMDocumentFragment &);
+ DOMDocumentFragment & operator = (const DOMDocumentFragment &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMDocumentFragment() {};
+ //@}
+
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMDocumentRange.hpp b/include/xercesc/dom/DOMDocumentRange.hpp
new file mode 100644
index 0000000..da94deb
--- /dev/null
+++ b/include/xercesc/dom/DOMDocumentRange.hpp
@@ -0,0 +1,95 @@
+/*
+ * 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: DOMDocumentRange.hpp 527149 2007-04-10 14:56:39Z amassari $
+*/
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTRANGE_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTRANGE_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMRange;
+
+
+/**
+ * See also the Document Object Model (DOM) Level 2 Traversal and Range Specification.
+ * @since DOM Level 2
+ */
+class CDOM_EXPORT DOMDocumentRange {
+
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMDocumentRange() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMDocumentRange(const DOMDocumentRange &);
+ DOMDocumentRange & operator = (const DOMDocumentRange &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMDocumentRange() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMDocumentRange interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 2 */
+ //@{
+ /**
+ * To create the range consisting of boundary-points and offset of the
+ * selected contents
+ *
+ * @return The initial state of the Range such that both the boundary-points
+ * are positioned at the beginning of the corresponding DOMDOcument, before
+ * any content. The range returned can only be used to select content
+ * associated with this document, or with documentFragments and Attrs for
+ * which this document is the ownerdocument
+ * @since DOM Level 2
+ */
+ virtual DOMRange *createRange() = 0;
+
+ //@}
+};
+
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMDocumentTraversal.hpp b/include/xercesc/dom/DOMDocumentTraversal.hpp
new file mode 100644
index 0000000..f2897a7
--- /dev/null
+++ b/include/xercesc/dom/DOMDocumentTraversal.hpp
@@ -0,0 +1,155 @@
+/*
+ * 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: DOMDocumentTraversal.hpp 671894 2008-06-26 13:29:21Z borisk $
+*/
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTTRAVERSAL_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTTRAVERSAL_HPP
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMNode;
+class DOMNodeIterator;
+class DOMTreeWalker;
+
+
+/**
+ * DOMDocumentTraversal contains methods that create
+ * DOMNodeIterators and DOMTreeWalkers to traverse a
+ * node and its children in document order (depth first, pre-order
+ * traversal, which is equivalent to the order in which the start tags occur
+ * in the text representation of the document). In DOMs which support the
+ * Traversal feature, DOMDocumentTraversal will be implemented by
+ * the same objects that implement the DOMDocument interface.
+ * See also the Document Object Model (DOM) Level 2 Traversal and Range Specification.
+ * @since DOM Level 2
+ */
+class CDOM_EXPORT DOMDocumentTraversal {
+
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMDocumentTraversal() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMDocumentTraversal(const DOMDocumentTraversal &);
+ DOMDocumentTraversal & operator = (const DOMDocumentTraversal &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMDocumentTraversal() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMDocumentRange interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 2 */
+ //@{
+ /**
+ * Creates a NodeIterator object. (DOM2)
+ *
+ * NodeIterators are used to step through a set of nodes, e.g. the set of nodes in a NodeList, the
+ * document subtree governed by a particular node, the results of a query, or any other set of nodes.
+ * The set of nodes to be iterated is determined by the implementation of the NodeIterator. DOM Level 2
+ * specifies a single NodeIterator implementation for document-order traversal of a document subtree.
+ * Instances of these iterators are created by calling DOMDocumentTraversal.createNodeIterator().
+ *
+ * To produce a view of the document that has entity references expanded and does not
+ * expose the entity reference node itself, use the whatToShow flags to hide the entity
+ * reference node and set expandEntityReferences to true when creating the iterator. To
+ * produce a view of the document that has entity reference nodes but no entity expansion,
+ * use the whatToShow flags to show the entity reference node and set
+ * expandEntityReferences to false.
+ *
+ * @param root The root node of the DOM tree
+ * @param whatToShow This attribute determines which node types are presented via the iterator.
+ * @param filter The filter used to screen nodes
+ * @param entityReferenceExpansion The value of this flag determines whether the children of entity reference nodes are
+ * visible to the iterator. If false, they will be skipped over.
+ * @since DOM Level 2
+ */
+
+ virtual DOMNodeIterator *createNodeIterator(DOMNode* root,
+ DOMNodeFilter::ShowType whatToShow,
+ DOMNodeFilter* filter,
+ bool entityReferenceExpansion) = 0;
+ /**
+ * Creates a TreeWalker object. (DOM2)
+ *
+ * TreeWalker objects are used to navigate a document tree or subtree using the view of the document defined
+ * by its whatToShow flags and any filters that are defined for the TreeWalker. Any function which performs
+ * navigation using a TreeWalker will automatically support any view defined by a TreeWalker.
+ *
+ * Omitting nodes from the logical view of a subtree can result in a structure that is substantially different from
+ * the same subtree in the complete, unfiltered document. Nodes that are siblings in the TreeWalker view may
+ * be children of different, widely separated nodes in the original view. For instance, consider a Filter that skips
+ * all nodes except for DOMText nodes and the root node of a document. In the logical view that results, all text
+ * nodes will be siblings and appear as direct children of the root node, no matter how deeply nested the
+ * structure of the original document.
+ *
+ * To produce a view of the document that has entity references expanded
+ * and does not expose the entity reference node itself, use the whatToShow
+ * flags to hide the entity reference node and set expandEntityReferences to
+ * true when creating the TreeWalker. To produce a view of the document
+ * that has entity reference nodes but no entity expansion, use the
+ * whatToShow flags to show the entity reference node and set
+ * expandEntityReferences to false
+ *
+ * @param root The root node of the DOM tree
+ * @param whatToShow This attribute determines which node types are presented via the tree-walker.
+ * @param filter The filter used to screen nodes
+ * @param entityReferenceExpansion The value of this flag determines whether the children of entity reference nodes are
+ * visible to the tree-walker. If false, they will be skipped over.
+ * @since DOM Level 2
+ */
+
+ virtual DOMTreeWalker *createTreeWalker(DOMNode* root,
+ DOMNodeFilter::ShowType whatToShow,
+ DOMNodeFilter* filter,
+ bool entityReferenceExpansion) = 0;
+
+ //@}
+};
+
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMDocumentType.hpp b/include/xercesc/dom/DOMDocumentType.hpp
new file mode 100644
index 0000000..29fe50c
--- /dev/null
+++ b/include/xercesc/dom/DOMDocumentType.hpp
@@ -0,0 +1,160 @@
+/*
+ * 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: DOMDocumentType.hpp 527149 2007-04-10 14:56:39Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMDOCUMENTTYPE_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMDOCUMENTTYPE_HPP
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMNamedNodeMap;
+
+/**
+ * Each DOMDocument has a doctype attribute whose value
+ * is either null or a DOMDocumentType object. The
+ * DOMDocumentType interface in the DOM Core provides an interface
+ * to the list of entities that are defined for the document, and little
+ * else because the effect of namespaces and the various XML schema efforts
+ * on DTD representation are not clearly understood as of this writing.
+ * The DOM Level 2 doesn't support editing DOMDocumentType nodes.
+ *
See also the Document Object Model (DOM) Level 2 Core Specification.
+ *
+ * @since DOM Level 1
+ */
+class CDOM_EXPORT DOMDocumentType: public DOMNode {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMDocumentType() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMDocumentType(const DOMDocumentType &);
+ DOMDocumentType & operator = (const DOMDocumentType &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMDocumentType() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMDocumentType interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 1 */
+ //@{
+ /**
+ * The name of DTD; i.e., the name immediately following the
+ * DOCTYPE keyword.
+ *
+ * @since DOM Level 1
+ */
+ virtual const XMLCh * getName() const = 0;
+
+ /**
+ * A DOMNamedNodeMap containing the general entities, both
+ * external and internal, declared in the DTD. Parameter entities are
+ * not contained. Duplicates are discarded. For example in:
+ * <!DOCTYPE
+ * ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar
+ * "bar"> <!ENTITY bar "bar2"> <!ENTITY % baz "baz">
+ * ]> <ex/>
+ * the interface provides access to foo
+ * and the first declaration of bar but not the second
+ * declaration of bar or baz. Every node in
+ * this map also implements the DOMEntity interface.
+ *
The DOM Level 2 does not support editing entities, therefore
+ * entities cannot be altered in any way.
+ *
+ * @since DOM Level 1
+ */
+ virtual DOMNamedNodeMap *getEntities() const = 0;
+
+
+ /**
+ * A DOMNamedNodeMap containing the notations declared in the
+ * DTD. Duplicates are discarded. Every node in this map also implements
+ * the DOMNotation interface.
+ *
The DOM Level 2 does not support editing notations, therefore
+ * notations cannot be altered in any way.
+ *
+ * @since DOM Level 1
+ */
+ virtual DOMNamedNodeMap *getNotations() const = 0;
+ //@}
+
+ /** @name Functions introduced in DOM Level 2. */
+ //@{
+ /**
+ * Get the public identifier of the external subset.
+ *
+ * @return The public identifier of the external subset.
+ * @since DOM Level 2
+ */
+ virtual const XMLCh * getPublicId() const = 0;
+
+ /**
+ * Get the system identifier of the external subset.
+ *
+ * @return The system identifier of the external subset.
+ * @since DOM Level 2
+ */
+ virtual const XMLCh * getSystemId() const = 0;
+
+ /**
+ * The internal subset as a string, or null if there is none.
+ * This is does not contain the delimiting square brackets.The actual
+ * content returned depends on how much information is available to the
+ * implementation. This may vary depending on various parameters,
+ * including the XML processor used to build the document.
+ *
+ * @return The internal subset as a string.
+ * @since DOM Level 2
+ */
+ virtual const XMLCh * getInternalSubset() const = 0;
+ //@}
+
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
+
diff --git a/include/xercesc/dom/DOMElement.hpp b/include/xercesc/dom/DOMElement.hpp
new file mode 100644
index 0000000..e158626
--- /dev/null
+++ b/include/xercesc/dom/DOMElement.hpp
@@ -0,0 +1,528 @@
+/*
+ * 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: DOMElement.hpp 792236 2009-07-08 17:22:35Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMELEMENT_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMELEMENT_HPP
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMAttr;
+class DOMNodeList;
+class DOMTypeInfo;
+
+
+/**
+ * By far the vast majority of objects (apart from text) that authors
+ * encounter when traversing a document are DOMElement nodes.
+ *
+ * Assume the following XML document:<elementExample id="demo">
+ * <subelement1/>
+ * <subelement2><subsubelement/></subelement2>
+ * </elementExample>
+ * When represented using DOM, the top node is an DOMElement node
+ * for "elementExample", which contains two child DOMElement nodes,
+ * one for "subelement1" and one for "subelement2". "subelement1" contains no
+ * child nodes.
+ *
Elements may have attributes associated with them; since the
+ * DOMElement interface inherits from DOMNode, the generic
+ * DOMNode interface method getAttributes may be used
+ * to retrieve the set of all attributes for an element. There are methods on
+ * the DOMElement interface to retrieve either an DOMAttr
+ * object by name or an attribute value by name. In XML, where an attribute
+ * value may contain entity references, an DOMAttr object should be
+ * retrieved to examine the possibly fairly complex sub-tree representing the
+ * attribute value. On the other hand, in HTML, where all attributes have
+ * simple string values, methods to directly access an attribute value can
+ * safely be used as a convenience.
+ *
+ * @since DOM Level 1
+ *
+ * It also defines the ElementTraversal helper interface defined by http://www.w3.org/TR/2008/REC-ElementTraversal-20081222/
+ *
+ */
+
+class CDOM_EXPORT DOMElement: public DOMNode {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMElement() {}
+ DOMElement(const DOMElement &other) : DOMNode(other) {}
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented operators */
+ //@{
+ DOMElement & operator = (const DOMElement &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMElement() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMElement interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 1 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * The name of the element.
+ *
+ * For example, in: <elementExample
+ * id="demo"> ... </elementExample> , tagName has
+ * the value "elementExample". Note that this is
+ * case-preserving in XML, as are all of the operations of the DOM.
+ * @since DOM Level 1
+ */
+ virtual const XMLCh * getTagName() const = 0;
+
+ /**
+ * Retrieves an attribute value by name.
+ *
+ * @param name The name of the attribute to retrieve.
+ * @return The DOMAttr value as a string, or the empty string if
+ * that attribute does not have a specified or default value.
+ * @since DOM Level 1
+ */
+ virtual const XMLCh * getAttribute(const XMLCh *name) const = 0;
+
+ /**
+ * Retrieves an DOMAttr node by name.
+ *
+ * @param name The name (nodeName) of the attribute to retrieve.
+ * @return The DOMAttr node with the specified name (nodeName) or
+ * null if there is no such attribute.
+ * @since DOM Level 1
+ */
+ virtual DOMAttr * getAttributeNode(const XMLCh *name) const = 0;
+
+ /**
+ * Returns a DOMNodeList of all descendant elements with a given
+ * tag name, in the order in which they would be encountered in a preorder
+ * traversal of the DOMElement tree.
+ *
+ * @param name The name of the tag to match on. The special value "*"
+ * matches all tags.
+ * @return A list of matching DOMElement nodes.
+ * @since DOM Level 1
+ */
+ virtual DOMNodeList * getElementsByTagName(const XMLCh *name) const = 0;
+
+ // -----------------------------------------------------------------------
+ // Setter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Adds a new attribute.
+ *
+ * If an attribute with that name is already present
+ * in the element, its value is changed to be that of the value parameter.
+ * This value is a simple string, it is not parsed as it is being set. So
+ * any markup (such as syntax to be recognized as an entity reference) is
+ * treated as literal text, and needs to be appropriately escaped by the
+ * implementation when it is written out. In order to assign an attribute
+ * value that contains entity references, the user must create an
+ * DOMAttr node plus any DOMText and
+ * DOMEntityReference nodes, build the appropriate subtree, and
+ * use setAttributeNode to assign it as the value of an
+ * attribute.
+ * @param name The name of the attribute to create or alter.
+ * @param value Value to set in string form.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified name contains an
+ * illegal character.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * @since DOM Level 1
+ */
+ virtual void setAttribute(const XMLCh *name,
+ const XMLCh *value) = 0;
+ /**
+ * Adds a new attribute.
+ *
+ * If an attribute with that name (nodeName) is already present
+ * in the element, it is replaced by the new one.
+ * @param newAttr The DOMAttr node to add to the attribute list.
+ * @return If the newAttr attribute replaces an existing
+ * attribute, the replaced
+ * DOMAttr node is returned, otherwise null is
+ * returned.
+ * @exception DOMException
+ * WRONG_DOCUMENT_ERR: Raised if newAttr was created from a
+ * different document than the one that created the element.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ *
INUSE_ATTRIBUTE_ERR: Raised if newAttr is already an
+ * attribute of another DOMElement object. The DOM user must
+ * explicitly clone DOMAttr nodes to re-use them in other
+ * elements.
+ * @since DOM Level 1
+ */
+ virtual DOMAttr * setAttributeNode(DOMAttr *newAttr) = 0;
+
+ /**
+ * Removes the specified attribute node.
+ * If the removed DOMAttr
+ * has a default value it is immediately replaced. The replacing attribute
+ * has the same namespace URI and local name, as well as the original prefix,
+ * when applicable.
+ *
+ * @param oldAttr The DOMAttr node to remove from the attribute
+ * list.
+ * @return The DOMAttr node that was removed.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ *
NOT_FOUND_ERR: Raised if oldAttr is not an attribute
+ * of the element.
+ * @since DOM Level 1
+ */
+ virtual DOMAttr * removeAttributeNode(DOMAttr *oldAttr) = 0;
+
+ /**
+ * Removes an attribute by name.
+ *
+ * If the removed attribute
+ * is known to have a default value, an attribute immediately appears
+ * containing the default value as well as the corresponding namespace URI,
+ * local name, and prefix when applicable.
To remove an attribute by local
+ * name and namespace URI, use the removeAttributeNS method.
+ * @param name The name of the attribute to remove.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * @since DOM Level 1
+ */
+ virtual void removeAttribute(const XMLCh *name) = 0;
+ //@}
+
+ /** @name Functions introduced in DOM Level 2. */
+ //@{
+ /**
+ * Retrieves an attribute value by local name and namespace URI.
+ *
+ * @param namespaceURI The namespace URI of
+ * the attribute to retrieve.
+ * @param localName The local name of the
+ * attribute to retrieve.
+ * @return The DOMAttr value as a string, or an null if
+ * that attribute does not have a specified or default value.
+ * @since DOM Level 2
+ */
+ virtual const XMLCh * getAttributeNS(const XMLCh *namespaceURI,
+ const XMLCh *localName) const = 0;
+
+ /**
+ * Adds a new attribute. If an attribute with the same
+ * local name and namespace URI is already present on the element, its prefix
+ * is changed to be the prefix part of the qualifiedName, and
+ * its value is changed to be the value parameter. This value is
+ * a simple string, it is not parsed as it is being set. So any markup (such
+ * as syntax to be recognized as an entity reference) is treated as literal
+ * text, and needs to be appropriately escaped by the implementation when it
+ * is written out. In order to assign an attribute value that contains entity
+ * references, the user must create an DOMAttr
+ * node plus any DOMText and DOMEntityReference
+ * nodes, build the appropriate subtree, and use
+ * setAttributeNodeNS or setAttributeNode to assign
+ * it as the value of an attribute.
+ *
+ * @param namespaceURI The namespace URI of
+ * the attribute to create or alter.
+ * @param qualifiedName The qualified name of the
+ * attribute to create or alter.
+ * @param value The value to set in string form.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an
+ * illegal character.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ *
+ * NAMESPACE_ERR: Raised if the qualifiedName is
+ * malformed, if the qualifiedName has a prefix and the
+ * namespaceURI is null or an empty string,
+ * if the qualifiedName has a prefix that is "xml" and the
+ * namespaceURI is different from
+ * "http://www.w3.org/XML/1998/namespace", if the
+ * qualifiedName has a prefix that is "xmlns" and the
+ * namespaceURI is different from
+ * "http://www.w3.org/2000/xmlns/", or if the
+ * qualifiedName is "xmlns" and the
+ * namespaceURI is different from
+ * "http://www.w3.org/2000/xmlns/".
+ * @since DOM Level 2
+ */
+ virtual void setAttributeNS(const XMLCh *namespaceURI,
+ const XMLCh *qualifiedName, const XMLCh *value) = 0;
+
+ /**
+ * Removes an attribute by local name and namespace URI. If the
+ * removed attribute has a default value it is immediately replaced.
+ * The replacing attribute has the same namespace URI and local name, as well as
+ * the original prefix.
+ *
+ * @param namespaceURI The namespace URI of
+ * the attribute to remove.
+ * @param localName The local name of the
+ * attribute to remove.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * @since DOM Level 2
+ */
+ virtual void removeAttributeNS(const XMLCh *namespaceURI,
+ const XMLCh *localName) = 0;
+
+ /**
+ * Retrieves an DOMAttr node by local name and namespace URI.
+ *
+ * @param namespaceURI The namespace URI of
+ * the attribute to retrieve.
+ * @param localName The local name of the
+ * attribute to retrieve.
+ * @return The DOMAttr node with the specified attribute local
+ * name and namespace URI or null if there is no such attribute.
+ * @since DOM Level 2
+ */
+ virtual DOMAttr * getAttributeNodeNS(const XMLCh *namespaceURI,
+ const XMLCh *localName) const = 0;
+
+ /**
+ * Adds a new attribute.
+ *
+ * If an attribute with that local name and namespace URI is already present
+ * in the element, it is replaced by the new one.
+ *
+ * @param newAttr The DOMAttr node to add to the attribute list.
+ * @return If the newAttr attribute replaces an existing
+ * attribute with the same local name and namespace URI,
+ * the replaced DOMAttr node is
+ * returned, otherwise null is returned.
+ * @exception DOMException
+ * WRONG_DOCUMENT_ERR: Raised if newAttr was created from a
+ * different document than the one that created the element.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ *
INUSE_ATTRIBUTE_ERR: Raised if newAttr is already an
+ * attribute of another DOMElement object. The DOM user must
+ * explicitly clone DOMAttr nodes to re-use them in other
+ * elements.
+ * @since DOM Level 2
+ */
+ virtual DOMAttr * setAttributeNodeNS(DOMAttr *newAttr) = 0;
+
+ /**
+ * Returns a DOMNodeList of all the DOMElements
+ * with a given local name and namespace URI in the order in which they
+ * would be encountered in a preorder traversal of the
+ * DOMDocument tree, starting from this node.
+ *
+ * @param namespaceURI The namespace URI of
+ * the elements to match on. The special value "*" matches all
+ * namespaces.
+ * @param localName The local name of the
+ * elements to match on. The special value "*" matches all local names.
+ * @return A new DOMNodeList object containing all the matched
+ * DOMElements.
+ * @since DOM Level 2
+ */
+ virtual DOMNodeList * getElementsByTagNameNS(const XMLCh *namespaceURI,
+ const XMLCh *localName) const = 0;
+
+ /**
+ * Returns true when an attribute with a given name is
+ * specified on this element or has a default value, false
+ * otherwise.
+ * @param name The name of the attribute to look for.
+ * @return true if an attribute with the given name is
+ * specified on this element or has a default value, false
+ * otherwise.
+ * @since DOM Level 2
+ */
+ virtual bool hasAttribute(const XMLCh *name) const = 0;
+
+ /**
+ * Returns true when an attribute with a given local name and
+ * namespace URI is specified on this element or has a default value,
+ * false otherwise. HTML-only DOM implementations do not
+ * need to implement this method.
+ * @param namespaceURI The namespace URI of the attribute to look for.
+ * @param localName The local name of the attribute to look for.
+ * @return true if an attribute with the given local name
+ * and namespace URI is specified or has a default value on this
+ * element, false otherwise.
+ * @since DOM Level 2
+ */
+ virtual bool hasAttributeNS(const XMLCh *namespaceURI,
+ const XMLCh *localName) const = 0;
+ //@}
+
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+
+ /**
+ * If the parameter isId is true, this method declares the specified
+ * attribute to be a user-determined ID attribute.
+ * This affects the value of DOMAttr::isId and the behavior of
+ * DOMDocument::getElementById, but does not change any schema that
+ * may be in use, in particular this does not affect the DOMAttr::getSchemaTypeInfo
+ * of the specified DOMAttr node. Use the value false for the parameter isId
+ * to undeclare an attribute for being a user-determined ID attribute.
+ * To specify an DOMAttr by local name and namespace URI, use the
+ * setIdAttributeNS method.
+ *
+ * @param name The name of the DOMAttr.
+ * @param isId Whether the attribute is of type ID.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * NOT_FOUND_ERR: Raised if the specified node is not an DOMAttr
+ * of this element.
+ *
+ * @since DOM Level 3
+ */
+ virtual void setIdAttribute(const XMLCh* name, bool isId) = 0;
+
+
+ /**
+ * If the parameter isId is true, this method declares the specified
+ * attribute to be a user-determined ID attribute.
+ * This affects the value of DOMAttr::isId and the behavior of
+ * DOMDocument::getElementById, but does not change any schema that
+ * may be in use, in particular this does not affect the DOMAttr::getSchemaTypeInfo
+ * of the specified DOMAttr node. Use the value false for the parameter isId
+ * to undeclare an attribute for being a user-determined ID attribute.
+ *
+ * @param namespaceURI The namespace URI of the DOMAttr.
+ * @param localName The local name of the DOMAttr.
+ * @param isId Whether the attribute is of type ID.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * NOT_FOUND_ERR: Raised if the specified node is not an DOMAttr of this element.
+ *
+ * @since DOM Level 3
+ */
+ virtual void setIdAttributeNS(const XMLCh* namespaceURI, const XMLCh* localName, bool isId) = 0;
+
+
+
+ /**
+ * If the parameter isId is true, this method declares the specified
+ * attribute to be a user-determined ID attribute.
+ * This affects the value of DOMAttr::isId and the behavior of
+ * DOMDocument::getElementById, but does not change any schema that
+ * may be in use, in particular this does not affect the DOMAttr::getSchemaTypeInfo
+ * of the specified DOMAttr node. Use the value false for the parameter isId
+ * to undeclare an attribute for being a user-determined ID attribute.
+ *
+ * @param idAttr The DOMAttr node.
+ * @param isId Whether the attribute is of type ID.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * NOT_FOUND_ERR: Raised if the specified node is not an DOMAttr of this element.
+ *
+ * @since DOM Level 3
+ */
+ virtual void setIdAttributeNode(const DOMAttr *idAttr, bool isId) = 0;
+
+
+
+ /**
+ * Returns the type information associated with this element.
+ *
+ * @return the DOMTypeInfo associated with this element
+ * @since DOM level 3
+ */
+ virtual const DOMTypeInfo* getSchemaTypeInfo() const = 0;
+
+ //@}
+
+ // -----------------------------------------------------------------------
+ // DOMElementTraversal interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in the ElementTraversal specification (http://www.w3.org/TR/2008/REC-ElementTraversal-20081222/)*/
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * The first child of type DOMElement.
+ *
+ * @return The DOMElement object that is the first element node
+ * among the child nodes of this node, or null if there is none.
+ */
+ virtual DOMElement * getFirstElementChild() const = 0;
+
+ /**
+ * The last child of type DOMElement.
+ *
+ * @return The DOMElement object that is the last element node
+ * among the child nodes of this node, or null if there is none.
+ */
+ virtual DOMElement * getLastElementChild() const = 0;
+
+ /**
+ * The previous sibling node of type DOMElement.
+ *
+ * @return The DOMElement object that is the previous sibling element node
+ * in document order, or null if there is none.
+ */
+ virtual DOMElement * getPreviousElementSibling() const = 0;
+
+ /**
+ * The next sibling node of type DOMElement.
+ *
+ * @return The DOMElement object that is the next sibling element node
+ * in document order, or null if there is none.
+ */
+ virtual DOMElement * getNextElementSibling() const = 0;
+
+ /**
+ * The number of child nodes that are of type DOMElement.
+ *
+ * Note: the count is computed every time this function is invoked
+ *
+ * @return The number of DOMElement objects that are direct children
+ * of this object (nested elements are not counted), or 0 if there is none.
+ *
+ */
+ virtual XMLSize_t getChildElementCount() const = 0;
+ //@}
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
+
+
diff --git a/include/xercesc/dom/DOMEntity.hpp b/include/xercesc/dom/DOMEntity.hpp
new file mode 100644
index 0000000..2a33a38
--- /dev/null
+++ b/include/xercesc/dom/DOMEntity.hpp
@@ -0,0 +1,170 @@
+/*
+ * 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: DOMEntity.hpp 527149 2007-04-10 14:56:39Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMENTITY_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMENTITY_HPP
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+/**
+ * This interface represents an entity, either parsed or unparsed, in an XML
+ * document. Note that this models the entity itself not the entity
+ * declaration. DOMEntity declaration modeling has been left for a
+ * later Level of the DOM specification.
+ * The nodeName attribute that is inherited from
+ * DOMNode contains the name of the entity.
+ *
An XML processor may choose to completely expand entities before the
+ * structure model is passed to the DOM; in this case there will be no
+ * DOMEntityReference nodes in the document tree.
+ *
XML does not mandate that a non-validating XML processor read and
+ * process entity declarations made in the external subset or declared in
+ * external parameter entities. This means that parsed entities declared in
+ * the external subset need not be expanded by some classes of applications,
+ * and that the replacement value of the entity may not be available. When
+ * the replacement value is available, the corresponding DOMEntity
+ * node's child list represents the structure of that replacement text.
+ * Otherwise, the child list is empty.
+ *
The DOM Level 2 does not support editing DOMEntity nodes; if a
+ * user wants to make changes to the contents of an DOMEntity,
+ * every related DOMEntityReference node has to be replaced in the
+ * structure model by a clone of the DOMEntity's contents, and
+ * then the desired changes must be made to each of those clones instead.
+ * DOMEntity nodes and all their descendants are readonly.
+ *
An DOMEntity node does not have any parent.If the entity
+ * contains an unbound namespace prefix, the namespaceURI of
+ * the corresponding node in the DOMEntity node subtree is
+ * null. The same is true for DOMEntityReference
+ * nodes that refer to this entity, when they are created using the
+ * createEntityReference method of the DOMDocument
+ * interface. The DOM Level 2 does not support any mechanism to resolve
+ * namespace prefixes.
+ *
See also the Document Object Model (DOM) Level 2 Core Specification.
+ *
+ * @since DOM Level 1
+ */
+class CDOM_EXPORT DOMEntity: public DOMNode {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMEntity() {}
+ DOMEntity(const DOMEntity &other) : DOMNode(other) {}
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented operators */
+ //@{
+ DOMEntity & operator = (const DOMEntity &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMEntity() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMEntity interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 1 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * The public identifier associated with the entity, if specified.
+ *
+ * If the public identifier was not specified, this is null.
+ *
+ * @since DOM Level 1
+ */
+ virtual const XMLCh * getPublicId() const = 0;
+
+ /**
+ * The system identifier associated with the entity, if specified.
+ *
+ * If the system identifier was not specified, this is null.
+ *
+ * @since DOM Level 1
+ */
+ virtual const XMLCh * getSystemId() const = 0;
+
+ /**
+ * For unparsed entities, the name of the notation for the entity.
+ *
+ * For parsed entities, this is null.
+ *
+ * @since DOM Level 1
+ */
+ virtual const XMLCh * getNotationName() const = 0;
+ //@}
+
+ /** @name Functions introduced in DOM Level 3. */
+ //@{
+
+ /**
+ * An attribute specifying the encoding used for this entity at the time of parsing,
+ * when it is an external parsed entity. This is null if it an entity
+ * from the internal subset or if it is not known.
+ *
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getInputEncoding() const = 0;
+
+ /**
+ * An attribute specifying, as part of the text declaration, the encoding
+ * of this entity, when it is an external parsed entity. This is
+ * null otherwise.
+ *
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getXmlEncoding() const = 0;
+
+ /**
+ * An attribute specifying, as part of the text declaration, the version
+ * number of this entity, when it is an external parsed entity. This is
+ * null otherwise.
+ *
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getXmlVersion() const = 0;
+ //@}
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
diff --git a/include/xercesc/dom/DOMEntityReference.hpp b/include/xercesc/dom/DOMEntityReference.hpp
new file mode 100644
index 0000000..7dc89c3
--- /dev/null
+++ b/include/xercesc/dom/DOMEntityReference.hpp
@@ -0,0 +1,96 @@
+/*
+ * 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: DOMEntityReference.hpp 527149 2007-04-10 14:56:39Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMENTITYREFERENCE_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMENTITYREFERENCE_HPP
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+/**
+ * DOMEntityReference objects may be inserted into the structure
+ * model when an entity reference is in the source document, or when the
+ * user wishes to insert an entity reference. Note that character references
+ * and references to predefined entities are considered to be expanded by
+ * the HTML or XML processor so that characters are represented by their
+ * Unicode equivalent rather than by an entity reference. Moreover, the XML
+ * processor may completely expand references to entities while building the
+ * structure model, instead of providing DOMEntityReference
+ * objects. If it does provide such objects, then for a given
+ * DOMEntityReference node, it may be that there is no
+ * DOMEntity node representing the referenced entity. If such an
+ * DOMEntity exists, then the subtree of the
+ * DOMEntityReference node is in general a copy of the
+ * DOMEntity node subtree. However, this may not be true when an
+ * entity contains an unbound namespace prefix. In such a case, because the
+ * namespace prefix resolution depends on where the entity reference is, the
+ * descendants of the DOMEntityReference node may be bound to
+ * different namespace URIs.
+ * As for DOMEntity nodes, DOMEntityReference nodes and
+ * all their descendants are readonly.
+ *
See also the Document Object Model (DOM) Level 2 Core Specification.
+ *
+ * @since DOM Level 1
+ */
+
+class CDOM_EXPORT DOMEntityReference: public DOMNode {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMEntityReference() {}
+ DOMEntityReference(const DOMEntityReference &other) : DOMNode(other) {}
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented operators */
+ //@{
+ DOMEntityReference & operator = (const DOMEntityReference &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMEntityReference() {};
+ //@}
+
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
+
diff --git a/include/xercesc/dom/DOMError.hpp b/include/xercesc/dom/DOMError.hpp
new file mode 100644
index 0000000..76bb676
--- /dev/null
+++ b/include/xercesc/dom/DOMError.hpp
@@ -0,0 +1,173 @@
+/*
+ * 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: DOMError.hpp 671894 2008-06-26 13:29:21Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMERROR_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMERROR_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+class DOMLocator;
+
+
+/**
+ * DOMError is an interface that describes an error.
+ *
+ * @see DOMErrorHandler#handleError
+ * @since DOM Level 3
+ */
+
+class CDOM_EXPORT DOMError
+{
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMError() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMError(const DOMError &);
+ DOMError & operator = (const DOMError &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMError() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Class types
+ // -----------------------------------------------------------------------
+ /** @name Public constants */
+ //@{
+ /**
+ * The severity of the error described by the DOMError.
+ *
+ * DOM_SEVERITY_ERROR:
+ * The severity of the error described by the DOMError is error.
+ * A DOM_SEVERITY_ERROR may not cause the processing to stop if the error can
+ * be recovered, unless DOMErrorHandler::handleError() returns false.
+ *
+ * DOM_SEVERITY_FATAL_ERROR
+ * The severity of the error described by the DOMError is fatal error.
+ * A DOM_SEVERITY_FATAL_ERROR will cause the normal processing to stop. The return
+ * value of DOMErrorHandler::handleError() is ignored unless the
+ * implementation chooses to continue, in which case the behavior becomes undefined.
+ *
+ * DOM_SEVERITY_WARNING
+ * The severity of the error described by the DOMError is warning.
+ * A DOM_SEVERITY_WARNING will not cause the processing to stop, unless
+ * DOMErrorHandler::handleError() returns false.
+ *
+ * @since DOM Level 3
+ */
+ enum ErrorSeverity
+ {
+ DOM_SEVERITY_WARNING = 1,
+ DOM_SEVERITY_ERROR = 2,
+ DOM_SEVERITY_FATAL_ERROR = 3
+ };
+ //@}
+
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMError interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Get the severity of the error
+ *
+ * @see setSeverity
+ * @since DOM Level 3
+ */
+ virtual ErrorSeverity getSeverity() const = 0;
+
+ /**
+ * Get the message describing the error that occured.
+ *
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getMessage() const = 0;
+
+ /**
+ * Get the location of the error
+ *
+ * @since DOM Level 3
+ */
+ virtual DOMLocator* getLocation() const = 0;
+
+ /**
+ * The related platform dependent exception if any.
+ *
+ * @since DOM Level 3
+ */
+ virtual void* getRelatedException() const = 0;
+
+ /**
+ * A XMLCh* indicating which related data is expected in
+ * relatedData. Users should refer to the specification of the error
+ * in order to find its XMLCh* type and relatedData
+ * definitions if any.
+ *
+ * Note: As an example, DOMDocument::normalizeDocument() does generate
+ * warnings when the "split-cdata-sections" parameter is in use. Therefore, the
+ * method generates a DOM_SEVERITY_WARNING with type "cdata-sections-splitted"
+ * and the first DOMCDATASection node in document order resulting from the split
+ * is returned by the relatedData attribute.
+ *
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getType() const = 0;
+
+ /**
+ * The related DOMError::getType dependent data if any.
+ *
+ * @since DOM Level 3
+ */
+ virtual void* getRelatedData() const = 0;
+ //@}
+
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMErrorHandler.hpp b/include/xercesc/dom/DOMErrorHandler.hpp
new file mode 100644
index 0000000..880a9c0
--- /dev/null
+++ b/include/xercesc/dom/DOMErrorHandler.hpp
@@ -0,0 +1,107 @@
+/*
+ * 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: DOMErrorHandler.hpp 932887 2010-04-11 13:04:59Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMERRORHANDLER_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMERRORHANDLER_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMError;
+
+/**
+ * Basic interface for DOM error handlers.
+ *
+ * DOMErrorHandler is a callback interface that the DOM implementation
+ * can call when reporting errors that happens while processing XML data, or
+ * when doing some other processing (e.g. validating a document).
+ *
+ * The application that is using the DOM implementation is expected to
+ * implement this interface.
+ *
+ * @see DOMLSParser#getDomConfig
+ * @since DOM Level 3
+ */
+
+class CDOM_EXPORT DOMErrorHandler
+{
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMErrorHandler() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMErrorHandler(const DOMErrorHandler &);
+ DOMErrorHandler & operator = (const DOMErrorHandler &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMErrorHandler() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMErrorHandler interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+ /**
+ * This method is called on the error handler when an error occurs.
+ * If an exception is thrown from this method, it is considered to be equivalent of returning true.
+ *
+ * @param domError The error object that describes the error, this object
+ * may be reused by the DOM implementation across multiple
+ * calls to the handleError method.
+ * @return If the handleError method returns true the DOM
+ * implementation should continue as if the error didn't happen
+ * when possible, if the method returns false then the
+ * DOM implementation should stop the current processing when
+ * possible.
+ *
+ * @since DOM Level 3
+ */
+ virtual bool handleError(const DOMError& domError) = 0;
+ //@}
+
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMException.cpp b/include/xercesc/dom/DOMException.cpp
new file mode 100644
index 0000000..5f1f57f
--- /dev/null
+++ b/include/xercesc/dom/DOMException.cpp
@@ -0,0 +1,84 @@
+/*
+ * 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: DOMException.cpp 671894 2008-06-26 13:29:21Z borisk $
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include "impl/DOMImplementationImpl.hpp"
+
+#include "DOMException.hpp"
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+// ---------------------------------------------------------------------------
+// Destructor and Constructor
+// ---------------------------------------------------------------------------
+DOMException::~DOMException()
+{
+ if (msg && fMsgOwned)
+ fMemoryManager->deallocate((void*)msg);
+}
+
+DOMException::DOMException()
+:code(0)
+,msg(0)
+,fMemoryManager(0)
+,fMsgOwned(false)
+{
+}
+
+DOMException::DOMException(short exCode,
+ short messageCode,
+ MemoryManager* const memoryManager)
+:code(exCode)
+,fMemoryManager(0)
+,fMsgOwned(true)
+{
+ if (memoryManager)
+ fMemoryManager = memoryManager->getExceptionMemoryManager();
+
+ const XMLSize_t msgSize = 2047;
+ XMLCh errText[msgSize + 1];
+
+ // load the text
+ if(messageCode==0)
+ messageCode=XMLDOMMsg::DOMEXCEPTION_ERRX+exCode;
+
+ msg = XMLString::replicate
+ (
+ DOMImplementationImpl::getMsgLoader4DOM()->loadMsg(messageCode, errText, msgSize) ? errText : XMLUni::fgDefErrMsg
+ , fMemoryManager
+ );
+}
+
+DOMException::DOMException(const DOMException &other)
+:code(other.code)
+,msg(0)
+,fMemoryManager(other.fMemoryManager)
+,fMsgOwned(other.fMsgOwned)
+{
+ if (other.msg)
+ msg = other.fMsgOwned? XMLString::replicate(other.msg, other.fMemoryManager) : other.msg;
+}
+
+XERCES_CPP_NAMESPACE_END
diff --git a/include/xercesc/dom/DOMException.hpp b/include/xercesc/dom/DOMException.hpp
new file mode 100644
index 0000000..142f8df
--- /dev/null
+++ b/include/xercesc/dom/DOMException.hpp
@@ -0,0 +1,257 @@
+/*
+ * 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: DOMException.hpp 932887 2010-04-11 13:04:59Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMEXCEPTION_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMEXCEPTION_HPP
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+/**
+ * DOM operations only raise exceptions in "exceptional" circumstances, i.e.,
+ * when an operation is impossible to perform (either for logical reasons,
+ * because data is lost, or because the implementation has become unstable).
+ * In general, DOM methods return specific error values in ordinary
+ * processing situations, such as out-of-bound errors when using
+ * DOMNodeList.
+ * Implementations should raise other exceptions under other circumstances.
+ * For example, implementations should raise an implementation-dependent
+ * exception if a null argument is passed.
+ *
Some languages and object systems do not support the concept of
+ * exceptions. For such systems, error conditions may be indicated using
+ * native error reporting mechanisms. For some bindings, for example,
+ * methods may return error codes similar to those listed in the
+ * corresponding method descriptions.
+ *
See also the Document Object Model (DOM) Level 2 Core Specification.
+ * @since DOM Level 1
+ */
+
+class MemoryManager;
+
+class CDOM_EXPORT DOMException {
+public:
+ // -----------------------------------------------------------------------
+ // Class Types
+ // -----------------------------------------------------------------------
+ /** @name Public Constants */
+ //@{
+ /**
+ * ExceptionCode
+ *
+ *
INDEX_SIZE_ERR:
+ * If index or size is negative, or greater than the allowed value.
+ *
+ * DOMSTRING_SIZE_ERR:
+ * If the specified range of text does not fit into a DOMString.
+ *
+ * HIERARCHY_REQUEST_ERR:
+ * If any node is inserted somewhere it doesn't belong.
+ *
+ * WRONG_DOCUMENT_ERR:
+ * If a node is used in a different document than the one that created it
+ * (that doesn't support it).
+ *
+ * INVALID_CHARACTER_ERR:
+ * If an invalid or illegal character is specified, such as in a name. See
+ * production 2 in the XML specification for the definition of a legal
+ * character, and production 5 for the definition of a legal name
+ * character.
+ *
+ * NO_DATA_ALLOWED_ERR:
+ * If data is specified for a node which does not support data.
+ *
+ * NO_MODIFICATION_ALLOWED_ERR:
+ * If an attempt is made to modify an object where modifications are not
+ * allowed.
+ *
+ * NOT_FOUND_ERR:
+ * If an attempt is made to reference a node in a context where it does
+ * not exist.
+ *
+ * NOT_SUPPORTED_ERR:
+ * If the implementation does not support the requested type of object or
+ * operation.
+ *
+ * INUSE_ATTRIBUTE_ERR:
+ * If an attempt is made to add an attribute that is already in use
+ * elsewhere.
+ *
+ * The above are since DOM Level 1
+ * @since DOM Level 1
+ *
+ * INVALID_STATE_ERR:
+ * If an attempt is made to use an object that is not, or is no longer,
+ * usable.
+ *
+ * SYNTAX_ERR:
+ * If an invalid or illegal string is specified.
+ *
+ * INVALID_MODIFICATION_ERR:
+ * If an attempt is made to modify the type of the underlying object.
+ *
+ * NAMESPACE_ERR:
+ * If an attempt is made to create or change an object in a way which is
+ * incorrect with regard to namespaces.
+ *
+ * INVALID_ACCESS_ERR:
+ * If a parameter or an operation is not supported by the underlying
+ * object.
+ *
+ * The above are since DOM Level 2
+ * @since DOM Level 2
+ *
+ *
VALIDATION_ERR:
+ * If a call to a method such as insertBefore or
+ * removeChild would make the Node invalid
+ * with respect to "partial validity", this exception would be raised
+ * and the operation would not be done.
+ *
+ *
TYPE_MISMATCH_ERR:
+ * If the type of an object is incompatible with the expected type of
+ * the parameter associated to the object, this exception would be raised.
+ *
+ * The above is since DOM Level 3
+ * @since DOM Level 3
+ */
+ enum ExceptionCode {
+ INDEX_SIZE_ERR = 1,
+ DOMSTRING_SIZE_ERR = 2,
+ HIERARCHY_REQUEST_ERR = 3,
+ WRONG_DOCUMENT_ERR = 4,
+ INVALID_CHARACTER_ERR = 5,
+ NO_DATA_ALLOWED_ERR = 6,
+ NO_MODIFICATION_ALLOWED_ERR = 7,
+ NOT_FOUND_ERR = 8,
+ NOT_SUPPORTED_ERR = 9,
+ INUSE_ATTRIBUTE_ERR = 10,
+ INVALID_STATE_ERR = 11,
+ SYNTAX_ERR = 12,
+ INVALID_MODIFICATION_ERR = 13,
+ NAMESPACE_ERR = 14,
+ INVALID_ACCESS_ERR = 15,
+ VALIDATION_ERR = 16,
+ TYPE_MISMATCH_ERR = 17
+ };
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // Constructors
+ // -----------------------------------------------------------------------
+ /** @name Constructors */
+ //@{
+ /**
+ * Default constructor for DOMException.
+ *
+ */
+ DOMException();
+
+ /**
+ * Constructor which takes an error code and an optional message code.
+ *
+ * @param code The error code which indicates the exception
+ * @param messageCode The string containing the error message
+ * @param memoryManager The memory manager used to (de)allocate memory
+ */
+ DOMException(short code,
+ short messageCode = 0,
+ MemoryManager* const memoryManager = XMLPlatformUtils::fgMemoryManager);
+
+ /**
+ * Copy constructor.
+ *
+ * @param other The object to be copied.
+ */
+ DOMException(const DOMException &other);
+
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Destructors
+ // -----------------------------------------------------------------------
+ /** @name Destructor. */
+ //@{
+ /**
+ * Destructor for DOMException.
+ *
+ */
+ virtual ~DOMException();
+ //@}
+
+
+public:
+ // -----------------------------------------------------------------------
+ // Getter
+ // -----------------------------------------------------------------------
+ inline const XMLCh* getMessage() const;
+
+ // -----------------------------------------------------------------------
+ // Class Types
+ // -----------------------------------------------------------------------
+ /** @name Public variables */
+ //@{
+ /**
+ * A code value, from the set defined by the ExceptionCode enum,
+ * indicating the type of error that occured.
+ */
+ short code;
+
+ /**
+ * A string value. Applications may use this field to hold an error
+ * message. The field value is not set by the DOM implementation,
+ * meaning that the string will be empty when an exception is first
+ * thrown.
+ */
+ const XMLCh *msg;
+ //@}
+
+protected:
+ MemoryManager* fMemoryManager;
+
+private:
+
+ /**
+ * A boolean value.
+ * If the message is provided by the applications, it is not
+ * adopted.
+ * If the message is resolved by the DOM implementation, it is
+ * owned.
+ */
+ bool fMsgOwned;
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ DOMException & operator = (const DOMException &);
+};
+
+inline const XMLCh* DOMException::getMessage() const
+{
+ return msg;
+}
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMImplementation.hpp b/include/xercesc/dom/DOMImplementation.hpp
new file mode 100644
index 0000000..79ef386
--- /dev/null
+++ b/include/xercesc/dom/DOMImplementation.hpp
@@ -0,0 +1,249 @@
+/*
+ * 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: DOMImplementation.hpp 932887 2010-04-11 13:04:59Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATION_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATION_HPP
+
+#include
+#include
+#include
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMDocument;
+class DOMDocumentType;
+
+/**
+ * The DOMImplementation interface provides a number of methods
+ * for performing operations that are independent of any particular instance
+ * of the document object model.
+ */
+
+class CDOM_EXPORT DOMImplementation : public DOMImplementationLS
+{
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMImplementation() {}; // no plain constructor
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMImplementation(const DOMImplementation &); // no copy constructor.
+ DOMImplementation & operator = (const DOMImplementation &); // No Assignment
+ //@}
+
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMImplementation() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMImplementation interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 1 */
+ //@{
+ /**
+ * Test if the DOM implementation implements a specific feature.
+ * @param feature The name of the feature to test (case-insensitive). The
+ * values used by DOM features are defined throughout the DOM Level 2
+ * specifications and listed in the section. The name must be an XML
+ * name. To avoid possible conflicts, as a convention, names referring
+ * to features defined outside the DOM specification should be made
+ * unique.
+ * @param version This is the version number of the feature to test. In
+ * Level 2, the string can be either "2.0" or "1.0". If the version is
+ * not specified, supporting any version of the feature causes the
+ * method to return true.
+ * @return true if the feature is implemented in the
+ * specified version, false otherwise.
+ * @since DOM Level 1
+ */
+ virtual bool hasFeature(const XMLCh *feature, const XMLCh *version) const = 0;
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Functions introduced in DOM Level 2
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 2 */
+ //@{
+ /**
+ * Creates an empty DOMDocumentType node. Entity declarations
+ * and notations are not made available. Entity reference expansions and
+ * default attribute additions do not occur. It is expected that a
+ * future version of the DOM will provide a way for populating a
+ * DOMDocumentType.
+ * @param qualifiedName The qualified name of the document type to be
+ * created.
+ * @param publicId The external subset public identifier.
+ * @param systemId The external subset system identifier.
+ * @return A new DOMDocumentType node with
+ * ownerDocument set to null.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified qualified name
+ * contains an illegal character.
+ *
NAMESPACE_ERR: Raised if the qualifiedName is
+ * malformed.
+ *
NOT_SUPPORTED_ERR: May be raised by DOM implementations which do
+ * not support the "XML" feature, if they choose not to
+ * support this method. Other features introduced in the future, by
+ * the DOM WG or in extensions defined by other groups, may also
+ * demand support for this method; please consult the definition of
+ * the feature to see if it requires this method.
+ * @since DOM Level 2
+ */
+ virtual DOMDocumentType *createDocumentType(const XMLCh *qualifiedName,
+ const XMLCh *publicId,
+ const XMLCh *systemId) = 0;
+
+ /**
+ * Creates a DOMDocument object of the specified type with its document
+ * element.
+ * @param namespaceURI The namespace URI of the document element to
+ * create.
+ * @param qualifiedName The qualified name of the document element to be
+ * created.
+ * @param doctype The type of document to be created or null.
+ * When doctype is not null, its
+ * ownerDocument attribute is set to the document
+ * being created.
+ * @param manager Pointer to the memory manager to be used to
+ * allocate objects.
+ * @return A new DOMDocument object.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified qualified name
+ * contains an illegal character.
+ *
NAMESPACE_ERR: Raised if the qualifiedName is
+ * malformed, if the qualifiedName has a prefix and the
+ * namespaceURI is null, or if the
+ * qualifiedName has a prefix that is "xml" and the
+ * namespaceURI is different from "
+ * http://www.w3.org/XML/1998/namespace" , or if the DOM
+ * implementation does not support the "XML" feature but
+ * a non-null namespace URI was provided, since namespaces were
+ * defined by XML.
+ *
WRONG_DOCUMENT_ERR: Raised if doctype has already
+ * been used with a different document or was created from a different
+ * implementation.
+ *
NOT_SUPPORTED_ERR: May be raised by DOM implementations which do
+ * not support the "XML" feature, if they choose not to support this
+ * method. Other features introduced in the future, by the DOM WG or
+ * in extensions defined by other groups, may also demand support for
+ * this method; please consult the definition of the feature to see if
+ * it requires this method.
+ * @since DOM Level 2
+ */
+
+ virtual DOMDocument *createDocument(const XMLCh *namespaceURI,
+ const XMLCh *qualifiedName,
+ DOMDocumentType *doctype,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0;
+
+ //@}
+ // -----------------------------------------------------------------------
+ // Functions introduced in DOM Level 3
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+ /**
+ * This method returns a specialized object which implements the specialized APIs
+ * of the specified feature and version, as specified in DOM Features.
+ * This method also allow the implementation to provide specialized objects which
+ * do not support the DOMImplementation interface.
+ *
+ * @param feature The name of the feature requested (case-insensitive).
+ * Note that any plus sign "+" prepended to the name of the feature will
+ * be ignored since it is not significant in the context of this method.
+ * @param version This is the version number of the feature to test.
+ * @return Returns an object which implements the specialized APIs of the specified
+ * feature and version, if any, or null if there is no object which implements
+ * interfaces associated with that feature.
+ * @since DOM Level 3
+ */
+ virtual void* getFeature(const XMLCh* feature, const XMLCh* version) const = 0;
+
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Non-standard extension
+ // -----------------------------------------------------------------------
+ /** @name Non-standard extension */
+ //@{
+ /**
+ * Non-standard extension
+ *
+ * Create a completely empty document that has neither a root element or a doctype node.
+ */
+ virtual DOMDocument *createDocument(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0;
+
+ /**
+ * Non-standard extension
+ *
+ * Factory method for getting a DOMImplementation object.
+ * The DOM implementation retains ownership of the returned object.
+ * Application code should NOT delete it.
+ */
+ static DOMImplementation *getImplementation();
+
+ /**
+ * Non-standard extension
+ *
+ * Load the default error text message for DOMException.
+ * @param msgToLoad The DOM ExceptionCode id to be processed
+ * @param toFill The buffer that will hold the output on return. The
+ * size of this buffer should at least be 'maxChars + 1'.
+ * @param maxChars The maximum number of output characters that can be
+ * accepted. If the result will not fit, it is an error.
+ * @return true if the message is successfully loaded
+ */
+ static bool loadDOMExceptionMsg
+ (
+ const short msgToLoad
+ , XMLCh* const toFill
+ , const XMLSize_t maxChars
+ );
+
+ //@}
+
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMImplementationLS.hpp b/include/xercesc/dom/DOMImplementationLS.hpp
new file mode 100644
index 0000000..acd09a2
--- /dev/null
+++ b/include/xercesc/dom/DOMImplementationLS.hpp
@@ -0,0 +1,183 @@
+/*
+ * 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: DOMImplementationLS.hpp 932887 2010-04-11 13:04:59Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONLS_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONLS_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMLSParser;
+class DOMLSSerializer;
+class DOMLSInput;
+class DOMLSOutput;
+class MemoryManager;
+class XMLGrammarPool;
+
+/**
+ * DOMImplementationLS contains the factory methods for
+ * creating Load and Save objects.
+ *
+ * An object that implements DOMImplementationLS is obtained by doing a
+ * binding specific cast from DOMImplementation to DOMImplementationLS.
+ * Implementations supporting the Load and Save feature must implement the
+ * DOMImplementationLS interface on whatever object implements the
+ * DOMImplementation interface.
+ *
+ * @since DOM Level 3
+ */
+class CDOM_EXPORT DOMImplementationLS
+{
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMImplementationLS() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMImplementationLS(const DOMImplementationLS &);
+ DOMImplementationLS & operator = (const DOMImplementationLS &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMImplementationLS() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Public constants
+ // -----------------------------------------------------------------------
+ /** @name Public constants */
+ //@{
+ /**
+ * Create a synchronous or an asynchronous DOMLSParser.
+ * @see createLSParser(const DOMImplementationLSMode mode, const XMLCh* const schemaType)
+ * @since DOM Level 3
+ *
+ */
+ enum DOMImplementationLSMode
+ {
+ MODE_SYNCHRONOUS = 1,
+ MODE_ASYNCHRONOUS = 2
+ };
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMImplementationLS interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Factory create methods
+ // -----------------------------------------------------------------------
+ /**
+ * Create a new DOMLSParser. The newly constructed parser may then be configured
+ * by means of its DOMConfiguration object, and used to parse documents by
+ * means of its parse method.
+ *
+ * @param mode The mode argument is either MODE_SYNCHRONOUS
+ * or MODE_ASYNCHRONOUS, if mode is MODE_SYNCHRONOUS
+ * then the DOMLSParser that is created will operate in synchronous
+ * mode, if it's MODE_ASYNCHRONOUS then the DOMLSParser
+ * that is created will operate in asynchronous mode.
+ * @param schemaType An absolute URI representing the type of the schema
+ * language used during the load of a DOMDocument using the newly
+ * created DOMLSParser. Note that no lexical checking is done on
+ * the absolute URI. In order to create a DOMLSParser for any kind
+ * of schema types (i.e. the DOMLSParser will be free to use any
+ * schema found), use the value NULL.
+ * Note: For W3C XML Schema [XML Schema Part 1], applications must use
+ * the value "http://www.w3.org/2001/XMLSchema". For XML DTD [XML 1.0],
+ * applications must use the value "http://www.w3.org/TR/REC-xml".
+ * Other Schema languages are outside the scope of the W3C and therefore should
+ * recommend an absolute URI in order to use this method.
+ * @param manager Pointer to the memory manager to be used to allocate objects.
+ * @param gramPool The collection of cached grammars.
+ * @return The newly created DOMLSParser object. This
+ * DOMLSParser is either synchronous or asynchronous depending
+ * on the value of the mode argument.
+ * @exception DOMException NOT_SUPPORTED_ERR: Raised if the requested mode
+ * or schema type is not supported.
+ *
+ * @see DOMLSParser
+ * @since DOM Level 3
+ */
+ virtual DOMLSParser* createLSParser(const DOMImplementationLSMode mode,
+ const XMLCh* const schemaType,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager,
+ XMLGrammarPool* const gramPool = 0) = 0;
+
+
+ /**
+ * Create a new DOMLSSerializer. DOMLSSerializer is used to serialize a DOM tree
+ * back into an XML document.
+ *
+ * @return The newly created DOMLSSerializer object.
+ *
+ * @see DOMLSSerializer
+ * @since DOM Level 3
+ */
+ virtual DOMLSSerializer* createLSSerializer(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0;
+
+ /**
+ * Create a new "empty" DOMLSInput.
+ *
+ * @return The newly created DOMLSInput object.
+ *
+ * @see DOMLSInput
+ * @since DOM Level 3
+ */
+ virtual DOMLSInput* createLSInput(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0;
+
+ /**
+ * Create a new "empty" LSOutput.
+ *
+ * @return The newly created LSOutput object.
+ *
+ * @see LSOutput
+ * @since DOM Level 3
+ */
+ virtual DOMLSOutput* createLSOutput(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0;
+ //@}
+};
+
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMImplementationList.hpp b/include/xercesc/dom/DOMImplementationList.hpp
new file mode 100644
index 0000000..45990e9
--- /dev/null
+++ b/include/xercesc/dom/DOMImplementationList.hpp
@@ -0,0 +1,124 @@
+/*
+ * 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: DOMImplementationList.hpp 671894 2008-06-26 13:29:21Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONLIST_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONLIST_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMImplementation;
+
+
+/**
+ * The DOMImplementationList interface provides the abstraction of an ordered
+ * collection of DOM implementations, without defining or constraining how this collection
+ * is implemented. The items in the DOMImplementationList are accessible via
+ * an integral index, starting from 0.
+ */
+
+class CDOM_EXPORT DOMImplementationList {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMImplementationList() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMImplementationList(const DOMImplementationList &);
+ DOMImplementationList & operator = (const DOMImplementationList &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMImplementationList() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMImplementationList interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Returns the index item in the collection.
+ *
+ * If index is greater than or equal to the number of DOMImplementation in
+ * the list, this returns null.
+ *
+ * @param index Index into the collection.
+ * @return The DOMImplementation at the indexth position in the
+ * DOMImplementationList, or null if that is not a valid
+ * index.
+ * @since DOM Level 3
+ */
+ virtual DOMImplementation *item(XMLSize_t index) const = 0;
+
+ /**
+ * Returns the number of DOMImplementation in the list.
+ *
+ * The range of valid child node indices is 0 to length-1 inclusive.
+ * @since DOM Level 3
+ */
+ virtual XMLSize_t getLength() const = 0;
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Non-standard Extension
+ // -----------------------------------------------------------------------
+ /** @name Non-standard Extension */
+ //@{
+ /**
+ * Called to indicate that this list is no longer in use
+ * and that the implementation may relinquish any resources associated with it and
+ * its associated children.
+ *
+ * Access to a released object will lead to unexpected result.
+ *
+ */
+ virtual void release() = 0;
+ //@}
+
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMImplementationRegistry.hpp b/include/xercesc/dom/DOMImplementationRegistry.hpp
new file mode 100644
index 0000000..b151cf1
--- /dev/null
+++ b/include/xercesc/dom/DOMImplementationRegistry.hpp
@@ -0,0 +1,101 @@
+/*
+ * 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: DOMImplementationRegistry.hpp 527149 2007-04-10 14:56:39Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONREGISTRY_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONREGISTRY_HPP
+
+ /**
+ * This class holds the list of registered DOMImplementations. Implementation
+ * or application can register DOMImplementationSource to the registry, and
+ * then can query DOMImplementation based on a list of requested features.
+ *
+ * This provides an application with an implementation independent starting
+ * point.
+ *
+ * @see DOMImplementation
+ * @see DOMImplementationList
+ * @see DOMImplementationSource
+ * @since DOM Level 3
+ */
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMImplementation;
+class DOMImplementationSource;
+class DOMImplementationList;
+
+class CDOM_EXPORT DOMImplementationRegistry
+{
+public:
+ // -----------------------------------------------------------------------
+ // Static DOMImplementationRegistry interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+ /**
+ * Return the first registered implementation that has the desired features,
+ * or null if none is found.
+ *
+ * @param features A string that specifies which features are required.
+ * This is a space separated list in which each feature is
+ * specified by its name optionally followed by a space
+ * and a version number.
+ * This is something like: "XML 1.0 Traversal 2.0"
+ * @return An implementation that has the desired features, or
+ * null if this source has none.
+ * @since DOM Level 3
+ */
+ static DOMImplementation* getDOMImplementation(const XMLCh* features);
+
+ /**
+ * Return the list of registered implementation that have the desired features.
+ *
+ * @param features A string that specifies which features are required.
+ * This is a space separated list in which each feature is
+ * specified by its name optionally followed by a space
+ * and a version number.
+ * This is something like: "XML 1.0 Traversal 2.0"
+ * @return A DOMImplementationList object that contains the DOMImplementation
+ * that have the desired features
+ * @since DOM Level 3
+ */
+ static DOMImplementationList* getDOMImplementationList(const XMLCh* features);
+
+ /**
+ * Register an implementation.
+ *
+ * @param source A DOMImplementation Source object to be added to the registry.
+ * The registry does NOT adopt the source object. Users still own it.
+ * @since DOM Level 3
+ */
+ static void addSource(DOMImplementationSource* source);
+ //@}
+
+private:
+ DOMImplementationRegistry();
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMImplementationSource.hpp b/include/xercesc/dom/DOMImplementationSource.hpp
new file mode 100644
index 0000000..21cc7b6
--- /dev/null
+++ b/include/xercesc/dom/DOMImplementationSource.hpp
@@ -0,0 +1,112 @@
+/*
+ * 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: DOMImplementationSource.hpp 527149 2007-04-10 14:56:39Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONSOURCE_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMIMPLEMENTATIONSOURCE_HPP
+
+ /**
+ * This interface permits a DOM implementer to supply one or more
+ * implementations, based upon requested features and versions. Each implemented
+ * DOMImplementationSource object is listed in the
+ * binding-specific list of available sources so that its
+ * DOMImplementation objects are made available.
+ *
+ * @since DOM Level 3
+ */
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMImplementation;
+class DOMImplementationList;
+
+class CDOM_EXPORT DOMImplementationSource
+{
+protected :
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMImplementationSource() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMImplementationSource(const DOMImplementationSource &);
+ DOMImplementationSource & operator = (const DOMImplementationSource &);
+ //@}
+
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMImplementationSource() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMImplementationSource interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+ /**
+ * A method to request the first DOM implementation that supports the specified features.
+ *
+ * @param features A string that specifies which features are required.
+ * This is a space separated list in which each feature is specified
+ * by its name optionally followed by a space and a version number.
+ * This is something like: "XML 1.0 Traversal 2.0"
+ * @return An implementation that has the desired features, or
+ * null if this source has none.
+ * @since DOM Level 3
+ */
+ virtual DOMImplementation* getDOMImplementation(const XMLCh* features) const = 0;
+
+ /**
+ * A method to request a list of DOM implementations that support the specified features and versions,
+ *
+ * @param features A string that specifies which features are required.
+ * This is a space separated list in which each feature is specified
+ * by its name optionally followed by a space and a version number.
+ * This is something like: "XML 1.0 Traversal 2.0"
+ * @return A list of DOM implementations that support the desired features
+ * @since DOM Level 3
+ */
+ virtual DOMImplementationList* getDOMImplementationList(const XMLCh* features) const = 0;
+ //@}
+
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMLSException.cpp b/include/xercesc/dom/DOMLSException.cpp
new file mode 100644
index 0000000..0e3df1c
--- /dev/null
+++ b/include/xercesc/dom/DOMLSException.cpp
@@ -0,0 +1,49 @@
+/*
+ * 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: DOMLSException.cpp 671894 2008-06-26 13:29:21Z borisk $
+ */
+
+#include "DOMLSException.hpp"
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+DOMLSException::DOMLSException()
+: DOMException()
+{
+}
+
+DOMLSException::DOMLSException(short exCode,
+ short messageCode,
+ MemoryManager* const memoryManager)
+: DOMException(exCode, messageCode?messageCode:XMLDOMMsg::DOMLSEXCEPTION_ERRX+exCode-DOMLSException::PARSE_ERR+1, memoryManager)
+{
+}
+
+DOMLSException::DOMLSException(const DOMLSException &other)
+: DOMException(other)
+{
+}
+
+
+DOMLSException::~DOMLSException()
+{
+}
+
+XERCES_CPP_NAMESPACE_END
diff --git a/include/xercesc/dom/DOMLSException.hpp b/include/xercesc/dom/DOMLSException.hpp
new file mode 100644
index 0000000..14d9cab
--- /dev/null
+++ b/include/xercesc/dom/DOMLSException.hpp
@@ -0,0 +1,123 @@
+/*
+ * 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: DOMLSException.hpp 671894 2008-06-26 13:29:21Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMLSEXCEPTION_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMLSEXCEPTION_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+/**
+ * Parser or write operations may throw an LSException if the processing is stopped.
+ * The processing can be stopped due to a DOMError with a severity of
+ * DOMError::DOM_SEVERITY_FATAL_ERROR or a non recovered DOMError::DOM_SEVERITY_ERROR,
+ * or if DOMErrorHandler::handleError() returned false.
+ * Note: As suggested in the definition of the constants in the DOMError
+ * interface, a DOM implementation may choose to continue after a fatal error, but the
+ * resulting DOM tree is then implementation dependent.
+ *
See also the
+ * Document Object Model (DOM) Level 3 Load and Save Specification.
+ * @since DOM Level 3
+ */
+
+class MemoryManager;
+
+class CDOM_EXPORT DOMLSException : public DOMException {
+public:
+ // -----------------------------------------------------------------------
+ // Class Types
+ // -----------------------------------------------------------------------
+ /** @name Public Contants */
+ //@{
+ /**
+ * ExceptionCode
+ *
+ *
PARSE_ERR:
+ * If an attempt was made to load a document, or an XML Fragment, using DOMLSParser
+ * and the processing has been stopped.
+ *
+ * SERIALIZE_ERR:
+ * If an attempt was made to serialize a Node using LSSerializer and the processing
+ * has been stopped.
+ *
+ * @since DOM Level 3
+ */
+ enum LSExceptionCode {
+ PARSE_ERR = 81,
+ SERIALIZE_ERR = 82
+ };
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Constructors
+ // -----------------------------------------------------------------------
+ /** @name Constructors */
+ //@{
+ /**
+ * Default constructor for DOMLSException.
+ *
+ */
+ DOMLSException();
+
+ /**
+ * Constructor which takes an error code and a message.
+ *
+ * @param code The error code which indicates the exception
+ * @param messageCode The string containing the error message
+ * @param memoryManager The memory manager used to (de)allocate memory
+ */
+ DOMLSException(short code,
+ short messageCode,
+ MemoryManager* const memoryManager);
+
+ /**
+ * Copy constructor.
+ *
+ * @param other The object to be copied.
+ */
+ DOMLSException(const DOMLSException &other);
+
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Destructors
+ // -----------------------------------------------------------------------
+ /** @name Destructor. */
+ //@{
+ /**
+ * Destructor for DOMLSException.
+ *
+ */
+ virtual ~DOMLSException();
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ DOMLSException & operator = (const DOMLSException &);
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMLSInput.hpp b/include/xercesc/dom/DOMLSInput.hpp
new file mode 100644
index 0000000..a73a6ea
--- /dev/null
+++ b/include/xercesc/dom/DOMLSInput.hpp
@@ -0,0 +1,274 @@
+/*
+ * 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: DOMLSInput.hpp 527149 2007-04-10 14:56:39Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMLSINPUT_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMLSINPUT_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class InputSource;
+
+
+/**
+ * This interface represents a single input source for an XML entity.
+ *
+ * This interface allows an application to encapsulate information about
+ * an input source in a single object, which may include a public identifier,
+ * a system identifier, a byte stream (possibly with a specified encoding),
+ * and/or a character stream.
+ *
+ * There are two places that the application will deliver this input source
+ * to the parser: as the argument to the parse method, or as the return value
+ * of the DOMLSResourceResolver.resolveResource method.
+ *
+ * The DOMLSParser will use the DOMLSInput object to determine how to
+ * read XML input. If there is a character stream available, the parser will
+ * read that stream directly; if not, the parser will use a byte stream, if
+ * available; if neither a character stream nor a byte stream is available,
+ * the parser will attempt to open a URI connection to the resource identified
+ * by the system identifier.
+ *
+ * A DOMLSInput object belongs to the application: the parser shall
+ * never modify it in any way (it may modify a copy if necessary).
+ *
+ * @see DOMLSParser#parse
+ * @see DOMLSResourceResolver#resolveResource
+ * @since DOM Level 3
+ */
+class CDOM_EXPORT DOMLSInput
+{
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMLSInput() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMLSInput(const DOMLSInput &);
+ DOMLSInput & operator = (const DOMLSInput &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMLSInput() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMLSInput interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * String data to parse. If provided, this will always be treated as a sequence of 16-bit units (UTF-16 encoded characters).
+ * It is not a requirement to have an XML declaration when using stringData. If an XML declaration is present, the value of
+ * the encoding attribute will be ignored.
+ *
+ */
+ virtual const XMLCh* getStringData() const = 0;
+
+ /**
+ * Returns the byte stream for this input source.
+ *
+ * @see InputSource
+ */
+ virtual InputSource* getByteStream() const = 0;
+
+ /**
+ * An input source can be set to force the parser to assume a particular
+ * encoding for the data that input source reprsents, via the setEncoding()
+ * method. This method returns name of the encoding that is to be forced.
+ * If the encoding has never been forced, it returns a null pointer.
+ *
+ * @return The forced encoding, or null if none was supplied.
+ * @see #setEncoding
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getEncoding() const = 0;
+
+
+ /**
+ * Get the public identifier for this input source.
+ *
+ * @return The public identifier, or null if none was supplied.
+ * @see #setPublicId
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getPublicId() const = 0;
+
+
+ /**
+ * Get the system identifier for this input source.
+ *
+ * If the system ID is a URL, it will be fully resolved.
+ *
+ * @return The system identifier.
+ * @see #setSystemId
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getSystemId() const = 0;
+
+
+ /**
+ * Get the base URI to be used for resolving relative URIs to absolute
+ * URIs. If the baseURI is itself a relative URI, the behavior is
+ * implementation dependent.
+ *
+ * @return The base URI.
+ * @see #setBaseURI
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getBaseURI() const = 0;
+
+ // -----------------------------------------------------------------------
+ // Setter methods
+ // -----------------------------------------------------------------------
+ // -----------------------------------------------------------------------
+ /**
+ * Sets the UTF-16 string for this input source.
+ *
+ */
+ virtual void setStringData(const XMLCh* data) = 0;
+
+ /**
+ * Sets the byte stream for this input source.
+ *
+ * @see BinInputStream
+ */
+ virtual void setByteStream(InputSource* stream) = 0;
+
+ /**
+ * Set the encoding which will be required for use with the XML text read
+ * via a stream opened by this input source.
+ *
+ * This is usually not set, allowing the encoding to be sensed in the
+ * usual XML way. However, in some cases, the encoding in the file is known
+ * to be incorrect because of intermediate transcoding, for instance
+ * encapsulation within a MIME document.
+ *
+ * @param encodingStr The name of the encoding to force.
+ * @since DOM Level 3
+ */
+ virtual void setEncoding(const XMLCh* const encodingStr) = 0;
+
+
+ /**
+ * Set the public identifier for this input source.
+ *
+ *
The public identifier is always optional: if the application writer
+ * includes one, it will be provided as part of the location information.
+ *
+ * @param publicId The public identifier as a string.
+ * @see #getPublicId
+ * @since DOM Level 3
+ */
+ virtual void setPublicId(const XMLCh* const publicId) = 0;
+
+ /**
+ * Set the system identifier for this input source.
+ *
+ * The system id is always required. The public id may be used to map
+ * to another system id, but the system id must always be present as a fall
+ * back.
+ *
+ * If the system ID is a URL, it must be fully resolved.
+ *
+ * @param systemId The system identifier as a string.
+ * @see #getSystemId
+ * @since DOM Level 3
+ */
+ virtual void setSystemId(const XMLCh* const systemId) = 0;
+
+ /**
+ * Set the base URI to be used for resolving relative URIs to absolute
+ * URIs. If the baseURI is itself a relative URI, the behavior is
+ * implementation dependent.
+ *
+ * @param baseURI The base URI.
+ * @see #getBaseURI
+ * @since DOM Level 3
+ */
+ virtual void setBaseURI(const XMLCh* const baseURI) = 0;
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Non-standard Extension
+ // -----------------------------------------------------------------------
+ /** @name Non-standard Extension */
+ //@{
+
+ /**
+ * Indicates if the parser should issue fatal error if this input source
+ * is not found. If set to false, the parser issue warning message instead.
+ *
+ * @param flag True if the parser should issue fatal error if this input source is not found.
+ * If set to false, the parser issue warning message instead. (Default: true)
+ *
+ * @see #getIssueFatalErrorIfNotFound
+ */
+ virtual void setIssueFatalErrorIfNotFound(bool flag) = 0;
+
+
+ /**
+ * Get the flag that indicates if the parser should issue fatal error if this input source
+ * is not found.
+ *
+ * @return True if the parser should issue fatal error if this input source is not found.
+ * False if the parser issue warning message instead.
+ * @see #setIssueFatalErrorIfNotFound
+ */
+ virtual bool getIssueFatalErrorIfNotFound() const = 0;
+
+ /**
+ * Called to indicate that this DOMLSInput 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
diff --git a/include/xercesc/dom/DOMLSOutput.hpp b/include/xercesc/dom/DOMLSOutput.hpp
new file mode 100644
index 0000000..ab86288
--- /dev/null
+++ b/include/xercesc/dom/DOMLSOutput.hpp
@@ -0,0 +1,169 @@
+/*
+ * 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: DOMLSOutput.hpp 527149 2007-04-10 14:56:39Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMLSOUTPUT_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMLSOUTPUT_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class XMLFormatTarget;
+
+
+/**
+ * This interface represents an output destination for data.
+ *
+ * @see XMLFormatTarget
+ * @since DOM Level 3
+ */
+class CDOM_EXPORT DOMLSOutput
+{
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMLSOutput() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMLSOutput(const DOMLSOutput &);
+ DOMLSOutput & operator = (const DOMLSOutput &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMLSOutput() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMLSOutput interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Returns the byte stream for this input source.
+ *
+ * @see InputSource
+ */
+ virtual XMLFormatTarget* getByteStream() const = 0;
+
+ /**
+ * An input source can be set to force the parser to assume a particular
+ * encoding for the data that input source reprsents, via the setEncoding()
+ * method. This method returns name of the encoding that is to be forced.
+ * If the encoding has never been forced, it returns a null pointer.
+ *
+ * @return The forced encoding, or null if none was supplied.
+ * @see #setEncoding
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getEncoding() const = 0;
+
+ /**
+ * Get the system identifier for this input source.
+ *
+ * If the system ID is a URL, it will be fully resolved.
+ *
+ * @return The system identifier.
+ * @see #setSystemId
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getSystemId() const = 0;
+
+ // -----------------------------------------------------------------------
+ // Setter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Sets the byte stream for this input source.
+ *
+ * @see BinInputStream
+ */
+ virtual void setByteStream(XMLFormatTarget* stream) = 0;
+
+ /**
+ * Set the encoding which will be required for use with the XML text read
+ * via a stream opened by this input source.
+ *
+ * This is usually not set, allowing the encoding to be sensed in the
+ * usual XML way. However, in some cases, the encoding in the file is known
+ * to be incorrect because of intermediate transcoding, for instance
+ * encapsulation within a MIME document.
+ *
+ * @param encodingStr The name of the encoding to force.
+ * @since DOM Level 3
+ */
+ virtual void setEncoding(const XMLCh* const encodingStr) = 0;
+
+ /**
+ * Set the system identifier for this input source.
+ *
+ *
The system id is always required. The public id may be used to map
+ * to another system id, but the system id must always be present as a fall
+ * back.
+ *
+ * If the system ID is a URL, it must be fully resolved.
+ *
+ * @param systemId The system identifier as a string.
+ * @see #getSystemId
+ * @since DOM Level 3
+ */
+ virtual void setSystemId(const XMLCh* const systemId) = 0;
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Non-standard Extension
+ // -----------------------------------------------------------------------
+ /** @name Non-standard Extension */
+ //@{
+ /**
+ * Called to indicate that this DOMLSOutput 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
diff --git a/include/xercesc/dom/DOMLSParser.hpp b/include/xercesc/dom/DOMLSParser.hpp
new file mode 100644
index 0000000..fcfc839
--- /dev/null
+++ b/include/xercesc/dom/DOMLSParser.hpp
@@ -0,0 +1,766 @@
+/*
+ * 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: DOMLSParser.hpp 832686 2009-11-04 08:55:59Z borisk $
+ *
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMLSPARSER_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMLSPARSER_HPP
+
+#include
+#include
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMErrorHandler;
+class DOMLSInput;
+class DOMNode;
+class DOMDocument;
+
+/**
+ * DOMLSParser provides an API for parsing XML documents and building the
+ * corresponding DOM document tree. A DOMLSParser instance is obtained from
+ * the DOMImplementationLS interface by invoking its createLSParser method.
+ *
+ * @since DOM Level 3
+ *
+ */
+class CDOM_EXPORT DOMLSParser
+{
+protected :
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMLSParser() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMLSParser(const DOMLSParser &);
+ DOMLSParser & operator = (const DOMLSParser &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMLSParser() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Class types
+ // -----------------------------------------------------------------------
+ /** @name Public Constants */
+ //@{
+ /**
+ * A set of possible actions for the parseWithContext method.
+ *
+ * ACTION_APPEND_AS_CHILDREN:
+ * Append the result of the parse operation as children of the context node.
+ * For this action to work, the context node must be a DOMElement
+ * or a DOMDocumentFragment.
+ *
+ * ACTION_INSERT_AFTER:
+ * Insert the result of the parse operation as the immediately following sibling
+ * of the context node. For this action to work the context node's parent must
+ * be a DOMElement or a DOMDocumentFragment.
+ *
+ * ACTION_INSERT_BEFORE:
+ * Insert the result of the parse operation as the immediately preceding sibling
+ * of the context node. For this action to work the context node's parent must
+ * be a DOMElement or a DOMDocumentFragment.
+ *
+ * ACTION_REPLACE:
+ * Replace the context node with the result of the parse operation. For this
+ * action to work, the context node must have a parent, and the parent must be
+ * a DOMElement or a DOMDocumentFragment.
+ *
+ * ACTION_REPLACE_CHILDREN:
+ * Replace all the children of the context node with the result of the parse
+ * operation. For this action to work, the context node must be a DOMElement,
+ * a DOMDocument, or a DOMDocumentFragment.
+ *
+ * @see parseWithContext(...)
+ * @since DOM Level 3
+ */
+ enum ActionType
+ {
+ ACTION_APPEND_AS_CHILDREN = 1,
+ ACTION_REPLACE_CHILDREN = 2,
+ ACTION_INSERT_BEFORE = 3,
+ ACTION_INSERT_AFTER = 4,
+ ACTION_REPLACE = 5
+ };
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMLSParser interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+
+ /**
+ * Get a pointer to the DOMConfiguration object used when parsing
+ * an input source.
+ * This DOMConfiguration is specific to the parse operation.
+ * No parameter values from this DOMConfiguration object are passed
+ * automatically to the DOMConfiguration object on the
+ * DOMDocument that is created, or used, by the parse operation.
+ * The DOM application is responsible for passing any needed parameter values
+ * from this DOMConfiguration object to the DOMConfiguration
+ * object referenced by the DOMDocument object.
+ *
+ * In addition to the parameters recognized in on the DOMConfiguration
+ * interface defined in [DOM Level 3 Core], the DOMConfiguration objects
+ * for DOMLSParser add or modify the following parameters:
+ *
+ * "charset-overrides-xml-encoding"
+ * true [optional] (default)
+ * If a higher level protocol such as HTTP [IETF RFC 2616] provides an
+ * indication of the character encoding of the input stream being processed,
+ * that will override any encoding specified in the XML declaration or the
+ * Text declaration (see also section 4.3.3, "Character Encoding in Entities",
+ * in [XML 1.0]). Explicitly setting an encoding in the DOMLSInput
+ * overrides any encoding from the protocol.
+ * false [required]
+ * The parser ignores any character set encoding information from higher-level
+ * protocols.
+ *
+ * "disallow-doctype"
+ * true [optional]
+ * Throw a fatal "doctype-not-allowed" error if a doctype node is found while
+ * parsing the document. This is useful when dealing with things like SOAP
+ * envelopes where doctype nodes are not allowed.
+ * false [required] (default)
+ * Allow doctype nodes in the document.
+ *
+ * "ignore-unknown-character-denormalizations"
+ * true [required] (default)
+ * If, while verifying full normalization when [XML 1.1] is supported, a
+ * processor encounters characters for which it cannot determine the normalization
+ * properties, then the processor will ignore any possible denormalizations
+ * caused by these characters.
+ * This parameter is ignored for [XML 1.0].
+ * false [optional]
+ * Report an fatal "unknown-character-denormalization" error if a character
+ * is encountered for which the processor cannot determine the normalization
+ * properties.
+ *
+ * "infoset"
+ * See the definition of DOMConfiguration for a description of this parameter.
+ * Unlike in [DOM Level 3 Core], this parameter will default to true for DOMLSParser.
+ *
+ * "namespaces"
+ * true [required] (default)
+ * Perform the namespace processing as defined in [XML Namespaces] and
+ * [XML Namespaces 1.1].
+ * false [optional]
+ * Do not perform the namespace processing.
+ *
+ * "resource-resolver" [required]
+ * A pointer to a DOMLSResourceResolver object, or NULL. If the value of this parameter
+ * is not null when an external resource (such as an external XML entity or an XML schema
+ * location) is encountered, the implementation will request that the DOMLSResourceResolver
+ * referenced in this parameter resolves the resource.
+ *
+ * "supported-media-types-only"
+ * true [optional]
+ * Check that the media type of the parsed resource is a supported media type. If
+ * an unsupported media type is encountered, a fatal error of type "unsupported-media-type"
+ * will be raised. The media types defined in [IETF RFC 3023] must always be accepted.
+ * false [required] (default)
+ * Accept any media type.
+ *
+ * "validate"
+ * See the definition of DOMConfiguration for a description of this parameter.
+ * Unlike in [DOM Level 3 Core], the processing of the internal subset is always accomplished, even
+ * if this parameter is set to false.
+ *
+ * "validate-if-schema"
+ * See the definition of DOMConfiguration for a description of this parameter.
+ * Unlike in [DOM Level 3 Core], the processing of the internal subset is always accomplished, even
+ * if this parameter is set to false.
+ *
+ * "well-formed"
+ * See the definition of DOMConfiguration for a description of this parameter.
+ * Unlike in [DOM Level 3 Core], this parameter cannot be set to false.
+ *
+ * In addition to these, Xerces adds these non standard parameters:
+ *
+ * "http://apache.org/xml/properties/entity-resolver"
+ * A pointer to a XMLEntityResolver object, or NULL. If the value of this parameter
+ * is not null when an external resource (such as an external XML entity or an XML schema
+ * location) is encountered, the implementation will request that the XMLEntityResolver
+ * referenced in this parameter resolves the resource.
+ *
+ * "http://apache.org/xml/properties/schema/external-schemaLocation"
+ * A string holding a set of [namespaceUri schemaLocation] entries that will be treated as
+ * the content of the attribute xsi:schemaLocation of the root element
+ *
+ * "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"
+ * A string holding the schemaLocation for the empty namespace URI that will be treated as
+ * the content of the attribute xsi:noNamespaceSchemaLocation of the root element
+ *
+ * "http://apache.org/xml/properties/security-manager"
+ * A pointer to a SecurityManager object that will control how many entity references will be
+ * expanded during parsing
+ *
+ * "http://apache.org/xml/properties/scannerName"
+ * A string holding the type of scanner used while parsing. The valid names are:
+ *
+ * - IGXMLScanner: the default one, capable of both XMLSchema and DTD validation
+ * - SGXMLScanner: a scanner that can only perform XMLSchema validation
+ * - DGXMLScanner: a scanner that can only perform DTD validation
+ * - WFXMLScanner: a scanner that cannot perform any type validation, only well-formedness
+ *
+ *
+ * "http://apache.org/xml/properties/parser-use-DOMDocument-from-Implementation"
+ * A string holding the capabilities of the DOM implementation to be used to create the DOMDocument
+ * resulting from the parse operation. For instance, "LS" or "Core"
+ *
+ * "http://apache.org/xml/features/validation/schema"
+ * true
+ * Enable XMLSchema validation (note that also namespace processing should be enabled)
+ * false (default)
+ * Don't perform XMLSchema validation
+ *
+ * "http://apache.org/xml/features/validation/schema-full-checking"
+ * true
+ * Turn on full XMLSchema checking (e.g. Unique Particle Attribution)
+ * false (default)
+ * Don't perform full XMLSchema checking
+ *
+ * "http://apache.org/xml/features/validating/load-schema"
+ * true (default)
+ * Allow the parser to load schemas that are not in the grammar pool
+ * false
+ * Schemas that are not in the grammar pool are ignored
+ *
+ * "http://apache.org/xml/features/dom/user-adopts-DOMDocument"
+ * true
+ * The DOMDocument objects returned by parse will be owned by the caller
+ * false (default)
+ * The DOMDocument objects returned by parse will be owned by this DOMLSParser
+ * and deleted when released
+ *
+ * "http://apache.org/xml/features/nonvalidating/load-external-dtd"
+ * true (default)
+ * Allow the parser to load external DTDs
+ * false
+ * References to external DTDs will be ignored
+ *
+ * "http://apache.org/xml/features/continue-after-fatal-error"
+ * true
+ * Parsing should try to continue even if a fatal error has been triggered, trying to generate a DOM tree
+ * from a non well-formed XML
+ * false (default)
+ * Violation of XML rules will abort parsing
+ *
+ * "http://apache.org/xml/features/validation-error-as-fatal"
+ * true
+ * Validation errors are treated as fatal errors, and abort parsing (unless "continue-after-fatal-error"
+ * has been specified)
+ * false (default)
+ * Validation errors are normal errors
+ *
+ * "http://apache.org/xml/features/validation/cache-grammarFromParse"
+ * true
+ * XMLSchemas referenced by an XML file are cached in order to be reused by other parse operations
+ * false (default)
+ * XMLSchemas loaded during a parse operation will be discarded before the next one
+ *
+ * "http://apache.org/xml/features/validation/use-cachedGrammarInParse"
+ * true
+ * During this parse operation, reuse the XMLSchemas found in the cache
+ * false (default)
+ * Don't reuse the XMLSchemas found in the cache
+ *
+ * "http://apache.org/xml/features/calculate-src-ofs"
+ * true
+ * During parsing update the position in the source stream
+ * false (default)
+ * Don't waste time computing the position in the source stream
+ *
+ * "http://apache.org/xml/features/standard-uri-conformant"
+ * true
+ * Require that every URL being resolved is made of valid URL characters only
+ * false (default)
+ * Allow invalid URL characters in URL (e.g. spaces)
+ *
+ * "http://apache.org/xml/features/dom-has-psvi-info"
+ * true
+ * Add schema informations to DOMElement and DOMAttr nodes in the output DOM tree
+ * false (default)
+ * Don't store schema informations in the output DOM tree
+ *
+ * "http://apache.org/xml/features/generate-synthetic-annotations"
+ * true
+ * Create annotation objects in the representation of the loaded XMLSchemas
+ * false (default)
+ * Discard annotations found in the loaded XMLSchemas
+ *
+ * "http://apache.org/xml/features/validate-annotations"
+ * true
+ * Check that annotations are valid according to their XMLSchema definition
+ * false (default)
+ * Don't validate annotations
+ *
+ * "http://apache.org/xml/features/validation/identity-constraint-checking"
+ * true (default)
+ * Enforce identity constraints specified in the XMLSchema
+ * false
+ * Don't enforce identity constraints
+ *
+ * "http://apache.org/xml/features/validation/ignoreCachedDTD"
+ * true
+ * Don't reuse DTDs found in the cache, even if use-cachedGrammarInParse is true
+ * false (default)
+ * Reuse DTDs found in the cache, if use-cachedGrammarInParse is true
+ *
+ * "http://apache.org/xml/features/schema/ignore-annotations"
+ * true
+ * Don't process annotations found in an XMLSchema
+ * false (default)
+ * Process the annotations found in an XMLSchema
+ *
+ * "http://apache.org/xml/features/disable-default-entity-resolution"
+ * true
+ * Entities will be resolved only by a resolver installed by the user
+ * false (default)
+ * If the entity resolver has not been installed, or it refuses to resolve the given entity, the
+ * parser will try to locate it himself
+ *
+ * "http://apache.org/xml/features/validation/schema/skip-dtd-validation"
+ * true
+ * If XMLSchema validation is true, DTD validation will not be performed
+ * false (default)
+ * If a DTD is found, it will be used to validate the XML
+ *
+ * @return The pointer to the configuration object.
+ * @since DOM Level 3
+ */
+ virtual DOMConfiguration* getDomConfig() = 0;
+
+ /**
+ * Get a const pointer to the application filter
+ *
+ * This method returns the installed application filter. If no filter
+ * has been installed, then it will be a zero pointer.
+ *
+ * @return A const pointer to the installed application filter
+ * @since DOM Level 3
+ */
+ virtual const DOMLSParserFilter* getFilter() const = 0;
+
+ /**
+ * Return whether the parser is asynchronous
+ *
+ * @return true if the DOMLSParser is asynchronous,
+ * false if it is synchronous
+ * @since DOM Level 3
+ */
+ virtual bool getAsync() const = 0;
+
+ /**
+ * Return whether the parser is busy parsing
+ *
+ * @return true if the DOMLSParser is currently busy
+ * loading a document, otherwise false.
+ * @since DOM Level 3
+ */
+ virtual bool getBusy() const = 0;
+
+ // -----------------------------------------------------------------------
+ // Setter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Set the application filter
+ *
+ * When the application provides a filter, the parser will call out to
+ * the filter at the completion of the construction of each DOMElement
+ * node. The filter implementation can choose to remove the element from the
+ * document being constructed or to terminate the parse early.
+ * The filter is invoked after the operations requested by the DOMConfiguration
+ * parameters have been applied. For example, if "validate" is set to true,
+ * the validation is done before invoking the filter.
+ *
+ * Any previously set filter is merely dropped, since the parser
+ * does not own them.
+ *
+ * @param filter A const pointer to the user supplied application
+ * filter.
+ *
+ * @see #getFilter
+ * @since DOM Level 3
+ */
+ virtual void setFilter(DOMLSParserFilter* const filter) = 0;
+
+ // -----------------------------------------------------------------------
+ // Parsing methods
+ // -----------------------------------------------------------------------
+ /**
+ * Parse an XML document from a resource identified by a DOMLSInput.
+ *
+ * The parser owns the returned DOMDocument. It will be deleted
+ * when the parser is released.
+ *
+ * @param source The DOMLSInput from which the source of the document
+ * is to be read.
+ * @return If the DOMLSParser is a synchronous DOMLSParser
+ * the newly created and populated DOMDocument is returned.
+ * If the DOMLSParser is asynchronous then NULL
+ * is returned since the document object may not yet be constructed when
+ * this method returns.
+ * @exception DOMException INVALID_STATE_ERR: Raised if the DOMLSParser::busy
+ * attribute is true.
+ * @exception DOMLSException PARSE_ERR: Starting from Xerces-C++ 4.0.0 this exception is
+ * raised if the DOMLSParser was unable
+ * to load the XML document. DOM applications should
+ * attach a DOMErrorHandler using the
+ * parameter "error-handler" if they wish to get details
+ * on the error.
+ *
+ * @see DOMLSInput#DOMLSInput
+ * @see DOMConfiguration
+ * @see resetDocumentPool
+ * @since DOM Level 3
+ */
+ virtual DOMDocument* parse(const DOMLSInput* source) = 0;
+
+ /**
+ * Parse an XML document from a location identified by a URI reference [IETF RFC 2396].
+ * If the URI contains a fragment identifier (see section 4.1 in [IETF RFC 2396]),
+ * the behavior is not defined by this specification, future versions of this
+ * specification may define the behavior.
+ *
+ * The parser owns the returned DOMDocument. It will be deleted
+ * when the parser is released.
+ *
+ * @param uri The location of the XML document to be read (in Unicode)
+ * @return If the DOMLSParser is a synchronous DOMLSParser
+ * the newly created and populated DOMDocument is returned.
+ * If the DOMLSParser is asynchronous then NULL
+ * is returned since the document object is not yet parsed when this method returns.
+ * @exception DOMException INVALID_STATE_ERR: Raised if the DOMLSParser::busy
+ * attribute is true.
+ * @exception DOMLSException PARSE_ERR: Starting from Xerces-C++ 4.0.0 this exception is
+ * raised if the DOMLSParser was unable
+ * to load the XML document. DOM applications should
+ * attach a DOMErrorHandler using the
+ * parameter "error-handler" if they wish to get details
+ * on the error.
+ *
+ * @see #parse(DOMLSInput,...)
+ * @see resetDocumentPool
+ * @since DOM Level 3
+ */
+ virtual DOMDocument* parseURI(const XMLCh* const uri) = 0;
+
+ /**
+ * Parse an XML document from a location identified by a URI reference [IETF RFC 2396].
+ * If the URI contains a fragment identifier (see section 4.1 in [IETF RFC 2396]),
+ * the behavior is not defined by this specification, future versions of this
+ * specification may define the behavior.
+ *
+ * The parser owns the returned DOMDocument. It will be deleted
+ * when the parser is released.
+ *
+ * @param uri The location of the XML document to be read (in the local code page)
+ * @return If the DOMLSParser is a synchronous DOMLSParser
+ * the newly created and populated DOMDocument is returned.
+ * If the DOMLSParser is asynchronous then NULL
+ * is returned since the document object is not yet parsed when this method returns.
+ * @exception DOMException INVALID_STATE_ERR: Raised if the DOMLSParser::busy
+ * attribute is true.
+ * @exception DOMLSException PARSE_ERR: Starting from Xerces-C++ 4.0.0 this exception is
+ * raised if the DOMLSParser was unable
+ * to load the XML document. DOM applications should
+ * attach a DOMErrorHandler using the
+ * parameter "error-handler" if they wish to get details
+ * on the error.
+ *
+ * @see #parse(DOMLSInput,...)
+ * @see resetDocumentPool
+ * @since DOM Level 3
+ */
+ virtual DOMDocument* parseURI(const char* const uri) = 0;
+
+ /**
+ * Parse an XML fragment from a resource identified by a DOMLSInput
+ * and insert the content into an existing document at the position specified
+ * with the context and action arguments. When parsing the input stream, the
+ * context node (or its parent, depending on where the result will be inserted)
+ * is used for resolving unbound namespace prefixes. The context node's
+ * ownerDocument node (or the node itself if the node of type
+ * DOCUMENT_NODE) is used to resolve default attributes and entity
+ * references.
+ * As the new data is inserted into the document, at least one mutation event
+ * is fired per new immediate child or sibling of the context node.
+ * If the context node is a DOMDocument node and the action is
+ * ACTION_REPLACE_CHILDREN, then the document that is passed as
+ * the context node will be changed such that its xmlEncoding,
+ * documentURI, xmlVersion, inputEncoding,
+ * xmlStandalone, and all other such attributes are set to what they
+ * would be set to if the input source was parsed using DOMLSParser::parse().
+ * This method is always synchronous, even if the DOMLSParser is
+ * asynchronous (DOMLSParser::getAsync() returns true).
+ * If an error occurs while parsing, the caller is notified through the ErrorHandler
+ * instance associated with the "error-handler" parameter of the DOMConfiguration.
+ * When calling parseWithContext, the values of the following configuration
+ * parameters will be ignored and their default values will always be used instead:
+ * "validate",
+ * "validate-if-schema"
+ * "element-content-whitespace".
+ * Other parameters will be treated normally, and the parser is expected to call
+ * the DOMLSParserFilter just as if a whole document was parsed.
+ *
+ * @param source The DOMLSInput from which the source document is
+ * to be read. The source document must be an XML fragment, i.e.
+ * anything except a complete XML document (except in the case where
+ * the context node of type DOCUMENT_NODE, and the action is
+ * ACTION_REPLACE_CHILDREN), a DOCTYPE
+ * (internal subset), entity declaration(s), notation declaration(s),
+ * or XML or text declaration(s).
+ * @param contextNode The node that is used as the context for the data that is being
+ * parsed. This node must be a DOMDocument node, a
+ * DOMDocumentFragment node, or a node of a type that
+ * is allowed as a child of an DOMElement node, e.g.
+ * it cannot be an DOMAttribute node.
+ * @param action This parameter describes which action should be taken between the new
+ * set of nodes being inserted and the existing children of the context node.
+ * The set of possible actions is defined in ACTION_TYPES above.
+ * @return Return the node that is the result of the parse operation. If the result is more
+ * than one top-level node, the first one is returned.
+ *
+ * @exception DOMException
+ * HIERARCHY_REQUEST_ERR: Raised if the content cannot replace, be inserted before, after,
+ * or as a child of the context node (see also DOMNode::insertBefore
+ * or DOMNode::replaceChild in [DOM Level 3 Core]).
+ * NOT_SUPPORTED_ERR: Raised if the DOMLSParser doesn't support this method,
+ * or if the context node is of type DOMDocument and the DOM
+ * implementation doesn't support the replacement of the DOMDocumentType
+ * child or DOMElement child.
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if the context node is a read only node and the content
+ * is being appended to its child list, or if the parent node of
+ * the context node is read only node and the content is being
+ * inserted in its child list.
+ * INVALID_STATE_ERR: Raised if the DOMLSParser::getBusy() returns true.
+ *
+ * @exception DOMLSException PARSE_ERR: Raised if the DOMLSParser was unable to load
+ * the XML fragment. DOM applications should attach a
+ * DOMErrorHandler using the parameter "error-handler"
+ * if they wish to get details on the error.
+ * @since DOM Level 3
+ */
+ virtual DOMNode* parseWithContext(const DOMLSInput* source, DOMNode* contextNode, const ActionType action) = 0;
+
+ /**
+ * Abort the loading of the document that is currently being loaded by the DOMLSParser.
+ * If the DOMLSParser is currently not busy, a call to this method does nothing.
+ *
+ * Note: invoking this method will remove the installed DOMLSParserFilter filter
+ *
+ * @since DOM Level 3
+ */
+ virtual void abort() = 0;
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Non-standard Extension
+ // -----------------------------------------------------------------------
+ /** @name Non-standard Extension */
+ //@{
+ /**
+ * Called to indicate that this DOMLSParser 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;
+
+ /** Reset the documents vector pool and release all the associated memory
+ * back to the system.
+ *
+ * When parsing a document using a DOM parser, all memory allocated
+ * for a DOM tree is associated to the DOM document.
+ *
+ * If you do multiple parse using the same DOM parser instance, then
+ * multiple DOM documents will be generated and saved in a vector pool.
+ * All these documents (and thus all the allocated memory)
+ * won't be deleted until the parser instance is destroyed.
+ *
+ * If you don't need these DOM documents anymore and don't want to
+ * destroy the DOM parser instance at this moment, then you can call this method
+ * to reset the document vector pool and release all the allocated memory
+ * back to the system.
+ *
+ * It is an error to call this method if you are in the middle of a
+ * parse (e.g. in the mid of a progressive parse).
+ *
+ * @exception IOException An exception from the parser if this function
+ * is called when a parse is in progress.
+ *
+ */
+ virtual void resetDocumentPool() = 0;
+
+ /**
+ * Preparse schema grammar (XML Schema, DTD, etc.) via an input source
+ * object.
+ *
+ * This method invokes the preparsing process on a schema grammar XML
+ * file specified by the DOMLSInput parameter. If the 'toCache' flag
+ * is enabled, the parser will cache the grammars for re-use. If a grammar
+ * key is found in the pool, no caching of any grammar will take place.
+ *
+ * @param source A const reference to the DOMLSInput object which
+ * points to the schema grammar file to be preparsed.
+ * @param grammarType The grammar type (Schema or DTD).
+ * @param toCache If true, we cache the preparsed grammar,
+ * otherwise, no chaching. Default is false.
+ * @return The preparsed schema grammar object (SchemaGrammar or
+ * DTDGrammar). That grammar object is owned by the parser.
+ *
+ * @exception SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @exception XMLException An exception from the parser or client
+ * handler code.
+ * @exception DOMException A DOM exception as per DOM spec.
+ *
+ * @see DOMLSInput#DOMLSInput
+ */
+ virtual Grammar* loadGrammar(const DOMLSInput* source,
+ const Grammar::GrammarType grammarType,
+ const bool toCache = false) = 0;
+
+ /**
+ * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL
+ *
+ * This method invokes the preparsing process on a schema grammar XML
+ * file specified by the file path parameter. If the 'toCache' flag is
+ * enabled, the parser will cache the grammars for re-use. If a grammar
+ * key is found in the pool, no caching of any grammar will take place.
+ *
+ * @param systemId A const XMLCh pointer to the Unicode string which
+ * contains the path to the XML grammar file to be
+ * preparsed.
+ * @param grammarType The grammar type (Schema or DTD).
+ * @param toCache If true, we cache the preparsed grammar,
+ * otherwise, no chaching. Default is false.
+ * @return The preparsed schema grammar object (SchemaGrammar or
+ * DTDGrammar). That grammar object is owned by the parser.
+ *
+ * @exception SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @exception XMLException An exception from the parser or client
+ * handler code.
+ * @exception DOMException A DOM exception as per DOM spec.
+ */
+ virtual Grammar* loadGrammar(const XMLCh* const systemId,
+ const Grammar::GrammarType grammarType,
+ const bool toCache = false) = 0;
+
+ /**
+ * Preparse schema grammar (XML Schema, DTD, etc.) via a file path or URL
+ *
+ * This method invokes the preparsing process on a schema grammar XML
+ * file specified by the file path parameter. If the 'toCache' flag is
+ * enabled, the parser will cache the grammars for re-use. If a grammar
+ * key is found in the pool, no caching of any grammar will take place.
+ *
+ * @param systemId A const char pointer to a native string which contains
+ * the path to the XML grammar file to be preparsed.
+ * @param grammarType The grammar type (Schema or DTD).
+ * @param toCache If true, we cache the preparsed grammar,
+ * otherwise, no chaching. Default is false.
+ * @return The preparsed schema grammar object (SchemaGrammar or
+ * DTDGrammar). That grammar object is owned by the parser.
+ *
+ *
+ * @exception SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @exception XMLException An exception from the parser or client
+ * handler code.
+ * @exception DOMException A DOM exception as per DOM spec.
+ */
+ virtual Grammar* loadGrammar(const char* const systemId,
+ const Grammar::GrammarType grammarType,
+ const bool toCache = false) = 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) const = 0;
+
+ /**
+ * Retrieve the grammar where the root element is declared.
+ *
+ * @return Grammar where root element declared
+ */
+ virtual Grammar* getRootGrammar() const = 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;
+
+ /**
+ * Clear the cached grammar pool
+ */
+ virtual void resetCachedGrammarPool() = 0;
+
+ /**
+ * Returns the current src offset within the input source.
+ *
+ * @return offset within the input source
+ */
+ virtual XMLFilePos getSrcOffset() const = 0;
+
+ //@}
+
+};
+
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMLSParserFilter.hpp b/include/xercesc/dom/DOMLSParserFilter.hpp
new file mode 100644
index 0000000..0621322
--- /dev/null
+++ b/include/xercesc/dom/DOMLSParserFilter.hpp
@@ -0,0 +1,164 @@
+/*
+ * 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: DOMLSParserFilter.hpp 671894 2008-06-26 13:29:21Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMLSPARSERFILTER_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMLSPARSERFILTER_HPP
+
+ /**
+ *
+ * DOMLSParserFilter.hpp: interface for the DOMLSParserFilter class.
+ *
+ * DOMLSParserFilter provide applications the ability to examine nodes
+ * as they are being created during the parse process.
+ *
+ * DOMLSParserFilter lets the application decide what nodes should be
+ * in the output DOM tree or not.
+ *
+ * @since DOM Level 3
+ */
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+class DOMElement;
+class DOMNode;
+
+class CDOM_EXPORT DOMLSParserFilter {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMLSParserFilter() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMLSParserFilter(const DOMLSParserFilter &);
+ DOMLSParserFilter & operator = (const DOMLSParserFilter &);
+ //@}
+
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMLSParserFilter() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Class Types
+ // -----------------------------------------------------------------------
+ /** @name Public Contants */
+ //@{
+ /**
+ * Constants returned by acceptNode.
+ *
+ * FILTER_ACCEPT:
+ * Accept the node.
+ *
+ * FILTER_REJECT:
+ * Reject the node and its children.
+ *
+ * FILTER_SKIP:
+ * Skip this single node. The children of this node will still be considered.
+ *
+ * FILTER_INTERRUPT:
+ * Interrupt the normal processing of the document.
+ *
+ * @since DOM Level 3
+ */
+ enum FilterAction {FILTER_ACCEPT = 1,
+ FILTER_REJECT = 2,
+ FILTER_SKIP = 3,
+ FILTER_INTERRUPT = 4};
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMLSParserFilter interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+ /**
+ * This method will be called by the parser at the completion of the parsing of each node.
+ * The node and all of its descendants will exist and be complete. The parent node will also exist,
+ * although it may be incomplete, i.e. it may have additional children that have not yet been parsed.
+ * Attribute nodes are never passed to this function.
+ * From within this method, the new node may be freely modified - children may be added or removed,
+ * text nodes modified, etc. The state of the rest of the document outside this node is not defined,
+ * and the affect of any attempt to navigate to, or to modify any other part of the document is undefined.
+ * For validating parsers, the checks are made on the original document, before any modification by the
+ * filter. No validity checks are made on any document modifications made by the filter.
+ * If this new node is rejected, the parser might reuse the new node and any of its descendants.
+ *
+ * @param node The newly constructed element. At the time this method is called, the element is complete -
+ * it has all of its children (and their children, recursively) and attributes, and is attached
+ * as a child to its parent.
+ * @return One of the FilterAction enum
+ */
+ virtual FilterAction acceptNode(DOMNode* node) = 0;
+
+ /**
+ * The parser will call this method after each DOMElement start tag has been scanned,
+ * but before the remainder of the DOMElement is processed. The intent is to allow the element,
+ * including any children, to be efficiently skipped. Note that only element nodes are passed to the
+ * startElement function.
+ * The element node passed to startElement for filtering will include all of the attributes, but none
+ * of the children nodes. The DOMElement may not yet be in place in the document being
+ * constructed (it may not have a parent node.)
+ * A startElement filter function may access or change the attributes for the DOMElement.
+ * Changing namespace declarations will have no effect on namespace resolution by the parser.
+ *
+ * @param node The newly encountered element. At the time this method is called, the element is incomplete -
+ * it will have its attributes, but no children.
+ * @return One of the FilterAction enum
+ */
+ virtual FilterAction startElement(DOMElement* node) = 0;
+
+ /**
+ * Tells the DOMLSParser what types of nodes to show to the method DOMLSParserFilter::acceptNode.
+ * If a node is not shown to the filter using this attribute, it is automatically included in the DOM document being built.
+ * See DOMNodeFilter for definition of the constants. The constants SHOW_ATTRIBUTE, SHOW_DOCUMENT,
+ * SHOW_DOCUMENT_TYPE, SHOW_NOTATION, SHOW_ENTITY, and SHOW_DOCUMENT_FRAGMENT are meaningless here.
+ * Those nodes will never be passed to DOMLSParserFilter::acceptNode.
+ *
+ * @return The constants of what types of nodes to show.
+ * @since DOM Level 3
+ */
+ virtual DOMNodeFilter::ShowType getWhatToShow() const = 0;
+
+ //@}
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMLSResourceResolver.hpp b/include/xercesc/dom/DOMLSResourceResolver.hpp
new file mode 100644
index 0000000..24792d3
--- /dev/null
+++ b/include/xercesc/dom/DOMLSResourceResolver.hpp
@@ -0,0 +1,143 @@
+/*
+ * 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: DOMLSResourceResolver.hpp 527149 2007-04-10 14:56:39Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMLSRESOURCERESOLVER_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMLSRESOURCERESOLVER_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMLSInput;
+
+/**
+ * DOMLSResourceResolver provides a way for applications to redirect references
+ * to external entities.
+ *
+ * Applications needing to implement customized handling for external
+ * entities must implement this interface and register their implementation
+ * by setting the entityResolver attribute of the DOMLSParser.
+ *
+ * The DOMLSParser will then allow the application to intercept any
+ * external entities (including the external DTD subset and external parameter
+ * entities) before including them.
+ *
+ * Many DOM applications will not need to implement this interface, but it
+ * will be especially useful for applications that build XML documents from
+ * databases or other specialized input sources, or for applications that use
+ * URNs.
+ *
+ * @see DOMLSParser#getDomConfig
+ * @see DOMLSInput#DOMLSInput
+ * @since DOM Level 3
+ */
+class CDOM_EXPORT DOMLSResourceResolver
+{
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMLSResourceResolver() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMLSResourceResolver(const DOMLSResourceResolver &);
+ DOMLSResourceResolver & operator = (const DOMLSResourceResolver &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMLSResourceResolver() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMLSResourceResolver interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+ /**
+ * Allow the application to resolve external resources.
+ *
+ * The DOMLSParser will call this method before opening any external resource,
+ * including the external DTD subset, external entities referenced within the DTD, and
+ * external entities referenced within the document element (however, the top-level
+ * document entity is not passed to this method). The application may then request that
+ * the DOMLSParser resolve the external resource itself, that it use an
+ * alternative URI, or that it use an entirely different input source.
+ *
+ * Application writers can use this method to redirect external system identifiers to
+ * secure and/or local URI, to look up public identifiers in a catalogue, or to read
+ * an entity from a database or other input source (including, for example, a dialog box).
+ *
+ * The returned DOMLSInput is owned by the DOMLSParser which is
+ * responsible to clean up the memory.
+ *
+ * @param resourceType The type of the resource being resolved. For XML [XML 1.0] resources
+ * (i.e. entities), applications must use the value "http://www.w3.org/TR/REC-xml".
+ * For XML Schema [XML Schema Part 1], applications must use the value
+ * "http://www.w3.org/2001/XMLSchema". Other types of resources are outside
+ * the scope of this specification and therefore should recommend an absolute
+ * URI in order to use this method.
+ * @param namespaceUri The namespace of the resource being resolved, e.g. the target namespace
+ * of the XML Schema [XML Schema Part 1] when resolving XML Schema resources.
+ * @param publicId The public identifier of the external entity being referenced, or null
+ * if no public identifier was supplied or if the resource is not an entity.
+ * @param systemId The system identifier, a URI reference [IETF RFC 2396], of the external
+ * resource being referenced, or null if no system identifier was supplied.
+ * @param baseURI The absolute base URI of the resource being parsed, or null if
+ * there is no base URI.
+ * @return A DOMLSInput object describing the new input source,
+ * or null to request that the parser open a regular
+ * URI connection to the resource.
+ * The returned DOMLSInput is owned by the DOMLSParser which is
+ * responsible to clean up the memory.
+ * @see DOMLSInput#DOMLSInput
+ * @since DOM Level 3
+ */
+ virtual DOMLSInput* resolveResource( const XMLCh* const resourceType
+ , const XMLCh* const namespaceUri
+ , const XMLCh* const publicId
+ , const XMLCh* const systemId
+ , const XMLCh* const baseURI) = 0;
+
+ //@}
+
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMLSSerializer.hpp b/include/xercesc/dom/DOMLSSerializer.hpp
new file mode 100644
index 0000000..96aadd4
--- /dev/null
+++ b/include/xercesc/dom/DOMLSSerializer.hpp
@@ -0,0 +1,547 @@
+/*
+ * 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: DOMLSSerializer.hpp 883665 2009-11-24 11:41:38Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMLSSERIALIZER_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMLSSERIALIZER_HPP
+
+/**
+ *
+ * DOMLSSerializer provides an API for serializing (writing) a DOM document out in
+ * an XML document. The XML data is written to an output stream, the type of
+ * which depends on the specific language bindings in use. During
+ * serialization of XML data, namespace fixup is done when possible.
+ * DOMLSSerializer accepts any node type for serialization. For
+ * nodes of type Document or Entity, well formed
+ * XML will be created if possible. The serialized output for these node
+ * types is either as a Document or an External Entity, respectively, and is
+ * acceptable input for an XML parser. For all other types of nodes the
+ * serialized form is not specified, but should be something useful to a
+ * human for debugging or diagnostic purposes. Note: rigorously designing an
+ * external (source) form for stand-alone node types that don't already have
+ * one defined in seems a bit much to take on here.
+ *
Within a Document or Entity being serialized, Nodes are processed as
+ * follows Documents are written including an XML declaration and a DTD
+ * subset, if one exists in the DOM. Writing a document node serializes the
+ * entire document. Entity nodes, when written directly by
+ * write defined in the DOMLSSerializer interface,
+ * output the entity expansion but no namespace fixup is done. The resulting
+ * output will be valid as an external entity. Entity References nodes are
+ * serializes as an entity reference of the form
+ * "&entityName;") in the output. Child nodes (the
+ * expansion) of the entity reference are ignored. CDATA sections
+ * containing content characters that can not be represented in the
+ * specified output encoding are handled according to the
+ * "split-cdata-sections" feature.If the feature is true, CDATA
+ * sections are split, and the unrepresentable characters are serialized as
+ * numeric character references in ordinary content. The exact position and
+ * number of splits is not specified. If the feature is false,
+ * unrepresentable characters in a CDATA section are reported as errors. The
+ * error is not recoverable - there is no mechanism for supplying
+ * alternative characters and continuing with the serialization. All other
+ * node types (DOMElement, DOMText, etc.) are serialized to their corresponding
+ * XML source form.
+ *
Within the character data of a document (outside of markup), any
+ * characters that cannot be represented directly are replaced with
+ * character references. Occurrences of '<' and '&' are replaced by
+ * the predefined entities < and &. The other predefined
+ * entities (>, &apos, etc.) are not used; these characters can be
+ * included directly. Any character that can not be represented directly in
+ * the output character encoding is serialized as a numeric character
+ * reference.
+ *
Attributes not containing quotes are serialized in quotes. Attributes
+ * containing quotes but no apostrophes are serialized in apostrophes
+ * (single quotes). Attributes containing both forms of quotes are
+ * serialized in quotes, with quotes within the value represented by the
+ * predefined entity ". Any character that can not be represented
+ * directly in the output character encoding is serialized as a numeric
+ * character reference.
+ *
Within markup, but outside of attributes, any occurrence of a character
+ * that cannot be represented in the output character encoding is reported
+ * as an error. An example would be serializing the element
+ * <LaCañada/> with the encoding="us-ascii".
+ *
When requested by setting the normalize-characters feature
+ * on DOMLSSerializer, all data to be serialized, both markup and
+ * character data, is W3C Text normalized according to the rules defined in
+ * . The W3C Text normalization process affects only the data as it is being
+ * written; it does not alter the DOM's view of the document after
+ * serialization has completed.
+ *
Namespaces are fixed up during serialization, the serialization process
+ * will verify that namespace declarations, namespace prefixes and the
+ * namespace URIs associated with Elements and Attributes are consistent. If
+ * inconsistencies are found, the serialized form of the document will be
+ * altered to remove them. The algorithm used for doing the namespace fixup
+ * while seralizing a document is a combination of the algorithms used for
+ * lookupNamespaceURI and lookupPrefix. previous paragraph to be
+ * defined closer here.
+ *
Any changes made affect only the namespace prefixes and declarations
+ * appearing in the serialized data. The DOM's view of the document is not
+ * altered by the serialization operation, and does not reflect any changes
+ * made to namespace declarations or prefixes in the serialized output.
+ *
While serializing a document the serializer will write out
+ * non-specified values (such as attributes whose specified is
+ * false) if the output-default-values feature is
+ * set to true. If the output-default-values flag
+ * is set to false and the use-abstract-schema
+ * feature is set to true the abstract schema will be used to
+ * determine if a value is specified or not, if
+ * use-abstract-schema is not set the specified
+ * flag on attribute nodes is used to determine if attribute values should
+ * be written out.
+ *
Ref to Core spec (1.1.9, XML namespaces, 5th paragraph) entity ref
+ * description about warning about unbound entity refs. Entity refs are
+ * always serialized as &foo;, also mention this in the load part of
+ * this spec.
+ *
When serializing a document the DOMLSSerializer checks to see if the document
+ * element in the document is a DOM Level 1 element or a DOM Level 2 (or
+ * higher) element (this check is done by looking at the localName of the
+ * root element). If the root element is a DOM Level 1 element then the
+ * DOMLSSerializer will issue an error if a DOM Level 2 (or higher) element is
+ * found while serializing. Likewise if the document element is a DOM Level
+ * 2 (or higher) element and the DOMLSSerializer sees a DOM Level 1 element an
+ * error is issued. Mixing DOM Level 1 elements with DOM Level 2 (or higher)
+ * is not supported.
+ *
DOMLSSerializers have a number of named features that can be
+ * queried or set. The name of DOMLSSerializer features must be valid
+ * XML names. Implementation specific features (extensions) should choose an
+ * implementation dependent prefix to avoid name collisions.
+ *
Here is a list of properties that must be recognized by all
+ * implementations.
+ *
+ * "normalize-characters"
+ * -
+ *
+ * true
+ * - [
+ * optional] (default) Perform the W3C Text Normalization of the characters
+ * in document as they are written out. Only the characters being written
+ * are (potentially) altered. The DOM document itself is unchanged.
+ * -
+ *
false
+ * - [required] do not perform character normalization.
+ *
+ * -
+ *
"split-cdata-sections"
+ * -
+ *
+ * true
+ * - [required] (default)
+ * Split CDATA sections containing the CDATA section termination marker
+ * ']]>' or characters that can not be represented in the output
+ * encoding, and output the characters using numeric character references.
+ * If a CDATA section is split a warning is issued.
+ * false
+ * - [
+ * required] Signal an error if a
CDATASection contains an
+ * unrepresentable character.
+ *
+ * "validation"
+ * -
+ *
+ * true
+ * - [
+ * optional] Use the abstract schema to validate the document as it is being
+ * serialized. If validation errors are found the error handler is notified
+ * about the error. Setting this state will also set the feature
+ *
use-abstract-schema to true.
+ * false
+ * - [
+ * required] (default) Don't validate the document as it is being
+ * serialized.
+ *
+ * "expand-entity-references"
+ * -
+ *
+ * true
+ * - [
+ * optional] Expand
EntityReference nodes when serializing.
+ * -
+ *
false
+ * - [required] (default) Serialize all
+ *
EntityReference nodes as XML entity references.
+ *
+ * -
+ *
"whitespace-in-element-content"
+ * -
+ *
+ * true
+ * - [required] (
+ * default) Output all white spaces in the document.
+ * false
+ * - [
+ * optional] Only output white space that is not within element content. The
+ * implementation is expected to use the
+ *
isWhitespaceInElementContent flag on Text nodes
+ * to determine if a text node should be written out or not.
+ *
+ * -
+ *
"discard-default-content"
+ * -
+ *
+ * true
+ * - [required] (default
+ * ) Use whatever information available to the implementation (i.e. XML
+ * schema, DTD, the
specified flag on Attr nodes,
+ * and so on) to decide what attributes and content should be serialized or
+ * not. Note that the specified flag on Attr nodes
+ * in itself is not always reliable, it is only reliable when it is set to
+ * false since the only case where it can be set to
+ * false is if the attribute was created by a Level 1
+ * implementation.
+ * false
+ * - [required] Output all attributes and
+ * all content.
+ *
+ * "format-canonical"
+ * -
+ *
+ * true
+ * - [optional]
+ * This formatting writes the document according to the rules specified in .
+ * Setting this feature to true will set the feature "format-pretty-print"
+ * to false.
+ * false
+ * - [required] (default) Don't canonicalize the
+ * output.
+ *
+ * "format-pretty-print"
+ * -
+ *
+ * true
+ * - [optional]
+ * Formatting the output by adding whitespace to produce a pretty-printed,
+ * indented, human-readable form. The exact form of the transformations is
+ * not specified by this specification. Setting this feature to true will
+ * set the feature "format-canonical" to false.
+ * false
+ * - [required]
+ * (default) Don't pretty-print the result.
+ *
+ * "http://apache.org/xml/features/dom/byte-order-mark"
+ * -
+ *
+ * false
+ * - [optional]
+ * (default) Setting this feature to true will output the correct BOM for the specified
+ * encoding.
+ * true
+ * - [required]
+ * Don't generate a BOM.
+ *
+ * "http://apache.org/xml/features/pretty-print/space-first-level-elements"
+ * -
+ *
+ * true
+ * - [optional]
+ * (default) Setting this feature to true will add an extra line feed between the elements
+ * that are children of the document root.
+ * false
+ * - [required]
+ * Don't add the extra line feed.
+ *
+ *
+ * See also the Document Object Model (DOM) Level 3 Load and Save Specification.
+ *
+ * @since DOM Level 3
+ */
+
+
+#include
+#include
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+class DOMLSOutput;
+
+class CDOM_EXPORT DOMLSSerializer
+{
+protected :
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMLSSerializer() {};
+ //@}
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMLSSerializer(const DOMLSSerializer &);
+ DOMLSSerializer & operator = (const DOMLSSerializer &);
+ //@}
+
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMLSSerializer() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMLSSerializer interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Feature methods
+ // -----------------------------------------------------------------------
+ /**
+ * The DOMConfiguration object used by the LSSerializer when serializing a DOM node.
+ *
+ * In addition to the parameters recognized in on the DOMConfiguration
+ * interface defined in [DOM Level 3 Core], the DOMConfiguration objects
+ * for DOMLSSerializer add or modify the following parameters:
+ *
+ * "canonical-form"
+ * true [optional]
+ * Writes the document according to the rules specified in [Canonical XML]. In addition to
+ * the behavior described in "canonical-form" [DOM Level 3 Core], setting this parameter to
+ * true will set the parameters "format-pretty-print", "discard-default-content", and
+ * "xml-declaration", to false. Setting one of those parameters to true will set this
+ * parameter to false. Serializing an XML 1.1 document when "canonical-form" is true will
+ * generate a fatal error.
+ * false [required] (default)
+ * Do not canonicalize the output.
+ *
+ * "discard-default-content"
+ * true [required] (default)
+ * Use the DOMAttr::getSpecified attribute to decide what attributes should be discarded.
+ * Note that some implementations might use whatever information available to the implementation
+ * (i.e. XML schema, DTD, the DOMAttr::getSpecified attribute, and so on) to determine what
+ * attributes and content to discard if this parameter is set to true.
+ * false [required]
+ * Keep all attributes and all content.
+ *
+ * "format-pretty-print"
+ * true [optional]
+ * Formatting the output by adding whitespace to produce a pretty-printed, indented,
+ * human-readable form. The exact form of the transformations is not specified by this specification.
+ * Pretty-printing changes the content of the document and may affect the validity of the document,
+ * validating implementations should preserve validity.
+ * false [required] (default)
+ * Don't pretty-print the result.
+ *
+ * "ignore-unknown-character-denormalizations"
+ * true [required] (default)
+ * If, while verifying full normalization when [XML 1.1] is supported, a character is encountered
+ * for which the normalization properties cannot be determined, then raise a "unknown-character-denormalization"
+ * warning (instead of raising an error, if this parameter is not set) and ignore any possible
+ * denormalizations caused by these characters.
+ * false [optional]
+ * Report a fatal error if a character is encountered for which the processor cannot determine the
+ * normalization properties.
+ *
+ * "normalize-characters"
+ * This parameter is equivalent to the one defined by DOMConfiguration in [DOM Level 3 Core].
+ * Unlike in the Core, the default value for this parameter is true. While DOM implementations are not
+ * required to support fully normalizing the characters in the document according to appendix E of [XML 1.1],
+ * this parameter must be activated by default if supported.
+ *
+ * "xml-declaration"
+ * true [required] (default)
+ * If a DOMDocument, DOMElement, or DOMEntity node is serialized, the XML declaration, or text declaration,
+ * should be included. The version (DOMDocument::xmlVersion if the document is a Level 3 document and the
+ * version is non-null, otherwise use the value "1.0"), and the output encoding (see DOMLSSerializer::write
+ * for details on how to find the output encoding) are specified in the serialized XML declaration.
+ * false [required]
+ * Do not serialize the XML and text declarations. Report a "xml-declaration-needed" warning if this will
+ * cause problems (i.e. the serialized data is of an XML version other than [XML 1.0], or an encoding would
+ * be needed to be able to re-parse the serialized data).
+ *
+ * "error-handler"
+ * Contains a DOMErrorHandler object. If an error is encountered in the document, the implementation will call back
+ * the DOMErrorHandler registered using this parameter. The implementation may provide a default DOMErrorHandler
+ * object. When called, DOMError::relatedData will contain the closest node to where the error occurred.
+ * If the implementation is unable to determine the node where the error occurs, DOMError::relatedData will contain
+ * the DOMDocument node. Mutations to the document from within an error handler will result in implementation
+ * dependent behavior.
+ *
+ * @return The pointer to the configuration object.
+ * @since DOM Level 3
+ */
+ virtual DOMConfiguration* getDomConfig() = 0;
+
+ // -----------------------------------------------------------------------
+ // Setter methods
+ // -----------------------------------------------------------------------
+ /**
+ * The end-of-line sequence of characters to be used in the XML being
+ * written out. The only permitted values are these:
+ *
+ * null
+ * -
+ * 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". However, Xerces-C++ always uses LF when this
+ * property is set to
null since otherwise automatic
+ * translation of LF to CR-LF on Windows for text files would
+ * result in such files containing CR-CR-LF. If you need Windows-style
+ * end of line sequences in your output, consider writing to a file
+ * opened in text mode or explicitly set this property to CR-LF.
+ * - CR
+ * - The carriage-return character (\#xD).
+ * - CR-LF
+ * - The
+ * carriage-return and line-feed characters (\#xD \#xA).
+ * - LF
+ * - The line-feed
+ * character (\#xA).
+ *
+ *
The default value for this attribute is null.
+ *
+ * @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;
+
+ /**
+ * 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.
+ *
+ * @param filter The writer filter to be used.
+ * @see getFilter
+ * @since DOM Level 3
+ */
+ virtual void setFilter(DOMLSSerializerFilter *filter) = 0;
+
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Return the end-of-line sequence of characters to be used in the XML being
+ * written out.
+ *
+ * @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 WriterFilter used.
+ *
+ * @return The writer filter used.
+ * @see setFilter
+ * @since DOM Level 3
+ */
+ virtual DOMLSSerializerFilter* getFilter() const = 0;
+
+ // -----------------------------------------------------------------------
+ // Write methods
+ // -----------------------------------------------------------------------
+ /**
+ * Write out the specified node as described above in the description of
+ * DOMLSSerializer. 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.
+ *
+ * @param nodeToWrite The Document or Entity node to
+ * be written. For other node types, something sensible should be
+ * written, but the exact serialized form is not specified.
+ * @param destination The destination for the data to be written.
+ * @return Returns true if node was
+ * successfully serialized and false in case a failure
+ * occured and the failure wasn't canceled by the error handler.
+ * @since DOM Level 3
+ */
+ virtual bool write(const DOMNode* nodeToWrite,
+ DOMLSOutput* const destination) = 0;
+
+ /**
+ * Write out the specified node as described above in the description of
+ * DOMLSSerializer. 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.
+ *
+ * @param nodeToWrite The Document or Entity node to
+ * be written. For other node types, something sensible should be
+ * written, but the exact serialized form is not specified.
+ * @param uri The destination for the data to be written.
+ * @return Returns true if node was
+ * successfully serialized and false in case a failure
+ * occured and the failure wasn't canceled by the error handler.
+ * @since DOM Level 3
+ */
+ virtual bool writeToURI(const DOMNode* nodeToWrite,
+ const XMLCh* uri) = 0;
+ /**
+ * Serialize the specified node as described above in the description of
+ * DOMLSSerializer. 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.
+ *
+ * @param nodeToWrite The node to be written.
+ * @param manager The memory manager to be used to allocate the result string.
+ * If NULL is used, the memory manager used to construct the serializer will
+ * be used.
+ * @return Returns the serialized data, or null 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 DOMLSSerializer is ignored in writeToString().
+ * @since DOM Level 3
+ */
+ virtual XMLCh* writeToString(const DOMNode* nodeToWrite, MemoryManager* manager = NULL) = 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
diff --git a/include/xercesc/dom/DOMLSSerializerFilter.hpp b/include/xercesc/dom/DOMLSSerializerFilter.hpp
new file mode 100644
index 0000000..0bd9bc7
--- /dev/null
+++ b/include/xercesc/dom/DOMLSSerializerFilter.hpp
@@ -0,0 +1,107 @@
+/*
+ * 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: DOMLSSerializerFilter.hpp 671894 2008-06-26 13:29:21Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMLSSERIALIZERFILTER_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMLSSERIALIZERFILTER_HPP
+
+/**
+ *
+ * DOMLSSerializerFilter.hpp: interface for the DOMLSSerializerFilter class.
+ *
+ * DOMLSSerializerFilter provide applications the ability to examine nodes
+ * as they are being serialized.
+ *
+ * DOMLSSerializerFilter lets the application decide what nodes should be
+ * serialized or not.
+ *
+ * The DOMDocument, DOMDocumentType, DOMNotation, and DOMEntity nodes are not passed
+ * to the filter.
+ *
+ * @since DOM Level 3
+ */
+
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class CDOM_EXPORT DOMLSSerializerFilter : public DOMNodeFilter {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMLSSerializerFilter() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMLSSerializerFilter(const DOMLSSerializerFilter &);
+ DOMLSSerializerFilter & operator = (const DOMLSSerializerFilter &);
+ //@}
+
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMLSSerializerFilter() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMLSSerializerFilter interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+ /**
+ * Interface from DOMNodeFilter,
+ * to be implemented by implementation (derived class)
+ */
+ virtual FilterAction acceptNode(const DOMNode* node) const = 0;
+
+ /**
+ * Tells the DOMLSSerializer what types of nodes to show to the filter.
+ * See DOMNodeFilter for definition of the constants.
+ * The constant SHOW_ATTRIBUTE is meaningless here, attribute nodes will
+ * never be passed to a DOMLSSerializerFilter.
+ *
+ * @return The constants of what types of nodes to show.
+ * @since DOM Level 3
+ */
+ virtual ShowType getWhatToShow() const =0;
+ //@}
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMLocator.hpp b/include/xercesc/dom/DOMLocator.hpp
new file mode 100644
index 0000000..abbcd8e
--- /dev/null
+++ b/include/xercesc/dom/DOMLocator.hpp
@@ -0,0 +1,135 @@
+/*
+ * 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: DOMLocator.hpp 676853 2008-07-15 09:58:05Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMLOCATOR_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMLOCATOR_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMNode;
+
+
+/**
+ * DOMLocator is an interface that describes a location. (e.g. where an error
+ * occured).
+ *
+ * @see DOMError#DOMError
+ * @since DOM Level 3
+ */
+
+class CDOM_EXPORT DOMLocator
+{
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMLocator() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMLocator(const DOMLocator &);
+ DOMLocator & operator = (const DOMLocator &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMLocator() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMLocator interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Get the line number where the error occured, or 0 if there is
+ * no line number available.
+ *
+ * @since DOM Level 3
+ */
+ virtual XMLFileLoc getLineNumber() const = 0;
+
+ /**
+ * Get the column number where the error occured, or 0 if there
+ * is no column number available.
+ *
+ * @since DOM Level 3
+ */
+ virtual XMLFileLoc getColumnNumber() const = 0;
+
+ /**
+ * Get the byte offset into the input source, or ~(XMLFilePos(0)) if
+ * there is no byte offset available.
+ *
+ * @since DOM Level 3
+ */
+ virtual XMLFilePos getByteOffset() const = 0;
+
+ /**
+ * Get the UTF-16 offset into the input source, or ~(XMLFilePos(0)) if
+ * there is no UTF-16 offset available.
+ *
+ * @since DOM Level 3
+ */
+ virtual XMLFilePos getUtf16Offset() const = 0;
+
+ /**
+ * Get the DOMNode where the error occured, or null if there
+ * is no node available.
+ *
+ * @since DOM Level 3
+ */
+ virtual DOMNode* getRelatedNode() const = 0;
+
+ /**
+ * Get the URI where the error occured, or null if there is no
+ * URI available.
+ *
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getURI() const = 0;
+ //@}
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMMemoryManager.hpp b/include/xercesc/dom/DOMMemoryManager.hpp
new file mode 100644
index 0000000..c1dd83c
--- /dev/null
+++ b/include/xercesc/dom/DOMMemoryManager.hpp
@@ -0,0 +1,160 @@
+/*
+ * 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.
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMMEMORYMANAGER_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMMEMORYMANAGER_HPP
+
+//------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+/**
+ * The DOMMemoryManager interface exposes the memory allocation-related
+ * functionalities of a DOMDocument
+ */
+
+class CDOM_EXPORT DOMMemoryManager
+{
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMMemoryManager() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMMemoryManager(const DOMMemoryManager &);
+ DOMMemoryManager & operator = (const DOMMemoryManager &);
+ //@}
+
+public:
+
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMMemoryManager() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // data types
+ // -----------------------------------------------------------------------
+ enum NodeObjectType {
+ ATTR_OBJECT = 0,
+ ATTR_NS_OBJECT = 1,
+ CDATA_SECTION_OBJECT = 2,
+ COMMENT_OBJECT = 3,
+ DOCUMENT_FRAGMENT_OBJECT = 4,
+ DOCUMENT_TYPE_OBJECT = 5,
+ ELEMENT_OBJECT = 6,
+ ELEMENT_NS_OBJECT = 7,
+ ENTITY_OBJECT = 8,
+ ENTITY_REFERENCE_OBJECT = 9,
+ NOTATION_OBJECT = 10,
+ PROCESSING_INSTRUCTION_OBJECT = 11,
+ TEXT_OBJECT = 12
+ };
+
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Returns the size of the chunks of memory allocated by the memory manager
+ *
+ * @return the dimension of the chunks of memory allocated by the memory manager
+ */
+ virtual XMLSize_t getMemoryAllocationBlockSize() const = 0;
+
+ //@}
+
+ //@{
+ // -----------------------------------------------------------------------
+ // Setter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Set the size of the chunks of memory allocated by the memory manager
+ *
+ * @param size the new size of the chunks; it must be greater than 4KB
+ */
+ virtual void setMemoryAllocationBlockSize(XMLSize_t size) = 0;
+ //@}
+
+ //@{
+ // -----------------------------------------------------------------------
+ // Operations
+ // -----------------------------------------------------------------------
+ /**
+ * Allocate a memory block of the requested size from the managed pool
+ *
+ * @param amount the size of the new memory block
+ *
+ * @return the pointer to the newly allocated block
+ */
+ virtual void* allocate(XMLSize_t amount) = 0;
+
+ /**
+ * Allocate a memory block of the requested size from the managed pool of DOM objects
+ *
+ * @param amount the size of the new memory block
+ * @param type the type of the DOM object that will be stored in the block
+ *
+ * @return the pointer to the newly allocated block
+ */
+ virtual void* allocate(XMLSize_t amount, DOMMemoryManager::NodeObjectType type) = 0;
+
+ /**
+ * Release a DOM object and place its memory back in the pool
+ *
+ * @param object the pointer to the DOM node
+ * @param type the type of the DOM object
+ */
+ virtual void release(DOMNode* object, DOMMemoryManager::NodeObjectType type) = 0;
+
+ /**
+ * Allocate a memory block from the mnaged pool and copy the provided string
+ *
+ * @param src the string to be copied
+ *
+ * @return the pointer to the newly allocated block
+ */
+ virtual XMLCh* cloneString(const XMLCh *src) = 0;
+ //@}
+
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
+/**
+ * End of file DOMMemoryManager.hpp
+ */
diff --git a/include/xercesc/dom/DOMNamedNodeMap.hpp b/include/xercesc/dom/DOMNamedNodeMap.hpp
new file mode 100644
index 0000000..2d23f27
--- /dev/null
+++ b/include/xercesc/dom/DOMNamedNodeMap.hpp
@@ -0,0 +1,245 @@
+/*
+ * 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: DOMNamedNodeMap.hpp 671894 2008-06-26 13:29:21Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMNAMEDNODEMAP_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMNAMEDNODEMAP_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMNode;
+
+/**
+ * DOMNamedNodeMaps are used to
+ * represent collections of nodes that can be accessed by name.
+ *
+ * Note that DOMNamedNodeMap does not inherit from DOMNodeList;
+ * DOMNamedNodeMaps are not maintained in any particular order.
+ * Nodes contained in a DOMNamedNodeMap may
+ * also be accessed by an ordinal index, but this is simply to allow
+ * convenient enumeration of the contents, and
+ * does not imply that the DOM specifies an order to these Nodes.
+ *
+ * @since DOM Level 1
+ */
+class CDOM_EXPORT DOMNamedNodeMap {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMNamedNodeMap() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMNamedNodeMap(const DOMNamedNodeMap &);
+ DOMNamedNodeMap & operator = (const DOMNamedNodeMap &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMNamedNodeMap() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMNamedNodeMap interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 1 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Setter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Adds a node using its nodeName attribute.
+ *
+ *
As the nodeName attribute is used to derive the name
+ * which the node must be stored under, multiple nodes of certain types
+ * (those that have a "special" string value) cannot be stored as the names
+ * would clash. This is seen as preferable to allowing nodes to be aliased.
+ * @param arg A node to store in a named node map. The node will later be
+ * accessible using the value of the nodeName attribute of
+ * the node. If a node with that name is already present in the map, it
+ * is replaced by the new one.
+ * @return If the new DOMNode replaces an existing node the
+ * replaced DOMNode is returned,
+ * otherwise null is returned.
+ * @exception DOMException
+ * WRONG_DOCUMENT_ERR: Raised if arg was created from a
+ * different document than the one that created the
+ * DOMNamedNodeMap.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if this
+ * DOMNamedNodeMap is readonly.
+ *
INUSE_ATTRIBUTE_ERR: Raised if arg is an
+ * DOMAttr that is already an attribute of another
+ * DOMElement object. The DOM user must explicitly clone
+ * DOMAttr nodes to re-use them in other elements.
+ * @since DOM Level 1
+ */
+ virtual DOMNode *setNamedItem(DOMNode *arg) = 0;
+
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Returns the indexth item in the map.
+ *
+ * If index
+ * is greater than or equal to the number of nodes in the map, this returns
+ * null.
+ * @param index Index into the map.
+ * @return The node at the indexth position in the
+ * DOMNamedNodeMap, or null if that is not a valid
+ * index.
+ * @since DOM Level 1
+ */
+ virtual DOMNode *item(XMLSize_t index) const = 0;
+
+ /**
+ * Retrieves a node specified by name.
+ *
+ * @param name The nodeName of a node to retrieve.
+ * @return A DOMNode (of any type) with the specified nodeName, or
+ * null if it does not identify any node in
+ * the map.
+ * @since DOM Level 1
+ */
+ virtual DOMNode *getNamedItem(const XMLCh *name) const = 0;
+
+ /**
+ * The number of nodes in the map.
+ *
+ * The range of valid child node indices is
+ * 0 to length-1 inclusive.
+ * @since DOM Level 1
+ */
+ virtual XMLSize_t getLength() const = 0;
+
+ // -----------------------------------------------------------------------
+ // Node methods
+ // -----------------------------------------------------------------------
+ /**
+ * Removes a node specified by name.
+ *
+ * If the removed node is an
+ * DOMAttr with a default value it is immediately replaced.
+ * @param name The nodeName of a node to remove.
+ * @return The node removed from the map if a node with such a name exists.
+ * @exception DOMException
+ * NOT_FOUND_ERR: Raised if there is no node named name in
+ * the map.
+ *
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this DOMNamedNodeMap
+ * is readonly.
+ * @since DOM Level 1
+ */
+ virtual DOMNode *removeNamedItem(const XMLCh *name) = 0;
+ //@}
+
+ /** @name Functions introduced in DOM Level 2 */
+ //@{
+ /**
+ * Retrieves a node specified by local name and namespace URI.
+ *
+ * @param namespaceURI The namespace URI of
+ * the node to retrieve.
+ * @param localName The local name of the node to retrieve.
+ * @return A DOMNode (of any type) with the specified
+ * local name and namespace URI, or null if they do not
+ * identify any node in the map.
+ * @since DOM Level 2
+ */
+ virtual DOMNode *getNamedItemNS(const XMLCh *namespaceURI,
+ const XMLCh *localName) const = 0;
+
+ /**
+ * Adds a node using its namespaceURI and localName.
+ *
+ * @param arg A node to store in a named node map. The node will later be
+ * accessible using the value of the namespaceURI and
+ * localName attribute of the node. If a node with those
+ * namespace URI and local name is already present in the map, it is
+ * replaced by the new one.
+ * @return If the new DOMNode replaces an existing node the
+ * replaced DOMNode is returned,
+ * otherwise null is returned.
+ * @exception DOMException
+ * WRONG_DOCUMENT_ERR: Raised if arg was created from a
+ * different document than the one that created the
+ * DOMNamedNodeMap.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if this
+ * DOMNamedNodeMap is readonly.
+ *
INUSE_ATTRIBUTE_ERR: Raised if arg is an
+ * DOMAttr that is already an attribute of another
+ * DOMElement object. The DOM user must explicitly clone
+ * DOMAttr nodes to re-use them in other elements.
+ * @since DOM Level 2
+ */
+ virtual DOMNode *setNamedItemNS(DOMNode *arg) = 0;
+
+ /**
+ * Removes a node specified by local name and namespace URI.
+ *
+ * @param namespaceURI The namespace URI of
+ * the node to remove.
+ * @param localName The local name of the
+ * node to remove. When this DOMNamedNodeMap contains the
+ * attributes attached to an element, as returned by the attributes
+ * attribute of the DOMNode interface, if the removed
+ * attribute is known to have a default value, an attribute
+ * immediately appears containing the default value
+ * as well as the corresponding namespace URI, local name, and prefix.
+ * @return The node removed from the map if a node with such a local name
+ * and namespace URI exists.
+ * @exception DOMException
+ * NOT_FOUND_ERR: Raised if there is no node named name in
+ * the map.
+ *
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this DOMNamedNodeMap
+ * is readonly.
+ * @since DOM Level 2
+ */
+ virtual DOMNode *removeNamedItemNS(const XMLCh *namespaceURI,
+ const XMLCh *localName) = 0;
+ //@}
+
+};
+
+#define GetDOMNamedNodeMapMemoryManager GET_INDIRECT_MM(fOwnerNode)
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMNode.hpp b/include/xercesc/dom/DOMNode.hpp
new file mode 100644
index 0000000..0cf0f99
--- /dev/null
+++ b/include/xercesc/dom/DOMNode.hpp
@@ -0,0 +1,922 @@
+/*
+ * 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: DOMNode.hpp 932887 2010-04-11 13:04:59Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMNODE_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMNODE_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMDocument;
+class DOMNamedNodeMap;
+class DOMNodeList;
+class DOMUserDataHandler;
+
+/**
+ * The DOMNode interface is the primary datatype for the entire
+ * Document Object Model. It represents a single node in the document tree.
+ * While all objects implementing the DOMNode interface expose
+ * methods for dealing with children, not all objects implementing the
+ * DOMNode interface may have children. For example,
+ * DOMText nodes may not have children, and adding children to
+ * such nodes results in a DOMException being raised.
+ * The attributes nodeName, nodeValue and
+ * attributes are included as a mechanism to get at node
+ * information without casting down to the specific derived interface. In
+ * cases where there is no obvious mapping of these attributes for a
+ * specific nodeType (e.g., nodeValue for an
+ * DOMElement or attributes for a DOMComment
+ * ), this returns null. Note that the specialized interfaces
+ * may contain additional and more convenient mechanisms to get and set the
+ * relevant information.
+ *
The values of nodeName,
+ * nodeValue, and attributes vary according to the
+ * node type as follows:
+ *
+ *
+ * | Interface |
+ * nodeName |
+ * nodeValue |
+ * attributes |
+ *
+ *
+ * | DOMAttr |
+ * name of attribute |
+ * value of attribute |
+ * null |
+ *
+ *
+ * | DOMCDATASection |
+ * "\#cdata-section" |
+ * content of the CDATA Section |
+ * null |
+ *
+ *
+ * | DOMComment |
+ * "\#comment" |
+ * content of the comment |
+ * null |
+ *
+ *
+ * | DOMDocument |
+ * "\#document" |
+ * null |
+ * null |
+ *
+ *
+ * | DOMDocumentFragment |
+ * "\#document-fragment" |
+ * null |
+ * null |
+ *
+ *
+ * | DOMDocumentType |
+ * document type name |
+ * null |
+ * null |
+ *
+ *
+ * | DOMElement |
+ * tag name |
+ * null |
+ * NamedNodeMap |
+ *
+ *
+ * | DOMEntity |
+ * entity name |
+ * null |
+ * null |
+ *
+ *
+ * | DOMEntityReference |
+ * name of entity referenced |
+ * null |
+ * null |
+ *
+ *
+ * | DOMNotation |
+ * notation name |
+ * null |
+ * null |
+ *
+ *
+ * | DOMProcessingInstruction |
+ * target |
+ * entire content excluding the target |
+ * null |
+ *
+ *
+ * | DOMText |
+ * "\#text" |
+ * content of the text node |
+ * null |
+ *
+ *
+ * See also the Document Object Model (DOM) Level 2 Core Specification.
+ *
+ * @since DOM Level 1
+ */
+class CDOM_EXPORT DOMNode {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMNode() {}
+ DOMNode(const DOMNode &) {}
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented operators */
+ //@{
+ DOMNode & operator = (const DOMNode &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMNode() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Class Types
+ // -----------------------------------------------------------------------
+ /** @name Public Constants */
+ //@{
+ /**
+ * NodeType
+ *
+ * @since DOM Level 1
+ */
+ enum NodeType {
+ ELEMENT_NODE = 1,
+ ATTRIBUTE_NODE = 2,
+ TEXT_NODE = 3,
+ CDATA_SECTION_NODE = 4,
+ ENTITY_REFERENCE_NODE = 5,
+ ENTITY_NODE = 6,
+ PROCESSING_INSTRUCTION_NODE = 7,
+ COMMENT_NODE = 8,
+ DOCUMENT_NODE = 9,
+ DOCUMENT_TYPE_NODE = 10,
+ DOCUMENT_FRAGMENT_NODE = 11,
+ NOTATION_NODE = 12
+ };
+
+ /**
+ * DocumentPosition:
+ *
+ *
DOCUMENT_POSITION_CONTAINED_BY:
+ * The node is contained by the reference node. A node which is contained is always following, too.
+ * DOCUMENT_POSITION_CONTAINS:
+ * The node contains the reference node. A node which contains is always preceding, too.
+ * DOCUMENT_POSITION_DISCONNECTED:
+ * The two nodes are disconnected. Order between disconnected nodes is always implementation-specific.
+ * DOCUMENT_POSITION_FOLLOWING:
+ * The node follows the reference node.
+ * DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:
+ * The determination of preceding versus following is implementation-specific.
+ * DOCUMENT_POSITION_PRECEDING:
+ * The second node precedes the reference node.
+ *
+ * @since DOM Level 3
+ */
+ enum DocumentPosition {
+ DOCUMENT_POSITION_DISCONNECTED = 0x01,
+ DOCUMENT_POSITION_PRECEDING = 0x02,
+ DOCUMENT_POSITION_FOLLOWING = 0x04,
+ DOCUMENT_POSITION_CONTAINS = 0x08,
+ DOCUMENT_POSITION_CONTAINED_BY = 0x10,
+ DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20
+ };
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMNode interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 1 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * The name of this node, depending on its type; see the table above.
+ * @since DOM Level 1
+ */
+ virtual const XMLCh * getNodeName() const = 0;
+
+ /**
+ * Gets the value of this node, depending on its type.
+ *
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
+ * @since DOM Level 1
+ */
+ virtual const XMLCh * getNodeValue() const = 0;
+
+ /**
+ * An enum value representing the type of the underlying object.
+ * @since DOM Level 1
+ */
+ virtual NodeType getNodeType() const = 0;
+
+ /**
+ * Gets the parent of this node.
+ *
+ * All nodes, except DOMDocument,
+ * DOMDocumentFragment, and DOMAttr may have a parent.
+ * However, if a node has just been created and not yet added to the tree,
+ * or if it has been removed from the tree, a null DOMNode
+ * is returned.
+ * @since DOM Level 1
+ */
+ virtual DOMNode *getParentNode() const = 0;
+
+ /**
+ * Gets a DOMNodeList that contains all children of this node.
+ *
+ * If there
+ * are no children, this is a DOMNodeList containing no nodes.
+ * The content of the returned DOMNodeList is "live" in the sense
+ * that, for instance, changes to the children of the node object that
+ * it was created from are immediately reflected in the nodes returned by
+ * the DOMNodeList accessors; it is not a static snapshot of the
+ * content of the node. This is true for every DOMNodeList,
+ * including the ones returned by the getElementsByTagName
+ * method.
+ * @since DOM Level 1
+ */
+ virtual DOMNodeList *getChildNodes() const = 0;
+ /**
+ * Gets the first child of this node.
+ *
+ * If there is no such node, this returns null.
+ * @since DOM Level 1
+ */
+ virtual DOMNode *getFirstChild() const = 0;
+
+ /**
+ * Gets the last child of this node.
+ *
+ * If there is no such node, this returns null.
+ * @since DOM Level 1
+ */
+ virtual DOMNode *getLastChild() const = 0;
+
+ /**
+ * Gets the node immediately preceding this node.
+ *
+ * If there is no such node, this returns null.
+ * @since DOM Level 1
+ */
+ virtual DOMNode *getPreviousSibling() const = 0;
+
+ /**
+ * Gets the node immediately following this node.
+ *
+ * If there is no such node, this returns null.
+ * @since DOM Level 1
+ */
+ virtual DOMNode *getNextSibling() const = 0;
+
+ /**
+ * Gets a DOMNamedNodeMap containing the attributes of this node (if it
+ * is an DOMElement) or null otherwise.
+ * @since DOM Level 1
+ */
+ virtual DOMNamedNodeMap *getAttributes() const = 0;
+
+ /**
+ * Gets the DOMDocument object associated with this node.
+ *
+ * This is also
+ * the DOMDocument object used to create new nodes. When this
+ * node is a DOMDocument or a DOMDocumentType
+ * which is not used with any DOMDocument yet, this is
+ * null.
+ *
+ * @since DOM Level 1
+ */
+ virtual DOMDocument *getOwnerDocument() const = 0;
+
+ // -----------------------------------------------------------------------
+ // Node methods
+ // -----------------------------------------------------------------------
+ /**
+ * Returns a duplicate of this node.
+ *
+ * This function serves as a generic copy constructor for nodes.
+ *
+ * The duplicate node has no parent (
+ * parentNode returns null.).
+ *
Cloning an DOMElement copies all attributes and their
+ * values, including those generated by the XML processor to represent
+ * defaulted attributes, but this method does not copy any text it contains
+ * unless it is a deep clone, since the text is contained in a child
+ * DOMText node. Cloning any other type of node simply returns a
+ * copy of this node.
+ * @param deep If true, recursively clone the subtree under the
+ * specified node; if false, clone only the node itself (and
+ * its attributes, if it is an DOMElement).
+ * @return The duplicate node.
+ * @since DOM Level 1
+ */
+ virtual DOMNode * cloneNode(bool deep) const = 0;
+
+ /**
+ * Inserts the node newChild before the existing child node
+ * refChild.
+ *
+ * If refChild is null,
+ * insert newChild at the end of the list of children.
+ *
If newChild is a DOMDocumentFragment object,
+ * all of its children are inserted, in the same order, before
+ * refChild. If the newChild is already in the
+ * tree, it is first removed. Note that a DOMNode that
+ * has never been assigned to refer to an actual node is == null.
+ * @param newChild The node to insert.
+ * @param refChild The reference node, i.e., the node before which the new
+ * node must be inserted.
+ * @return The node being inserted.
+ * @exception DOMException
+ * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
+ * allow children of the type of the newChild node, or if
+ * the node to insert is one of this node's ancestors.
+ *
WRONG_DOCUMENT_ERR: Raised if newChild was created
+ * from a different document than the one that created this node.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the node being
+ * inserted is readonly.
+ *
NOT_FOUND_ERR: Raised if refChild is not a child of
+ * this node.
+ * @since DOM Level 1
+ */
+ virtual DOMNode *insertBefore(DOMNode *newChild,
+ DOMNode *refChild) = 0;
+
+
+ /**
+ * Replaces the child node oldChild with newChild
+ * in the list of children, and returns the oldChild node.
+ *
+ * If newChild is a DOMDocumentFragment object,
+ * oldChild is replaced by all of the DOMDocumentFragment
+ * children, which are inserted in the same order.
+ *
+ * If the newChild is already in the tree, it is first removed.
+ * @param newChild The new node to put in the child list.
+ * @param oldChild The node being replaced in the list.
+ * @return The node replaced.
+ * @exception DOMException
+ * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
+ * allow children of the type of the newChild node, or it
+ * the node to put in is one of this node's ancestors.
+ *
WRONG_DOCUMENT_ERR: Raised if newChild was created
+ * from a different document than the one that created this node.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the new node is readonly.
+ *
NOT_FOUND_ERR: Raised if oldChild is not a child of
+ * this node.
+ * @since DOM Level 1
+ */
+ virtual DOMNode *replaceChild(DOMNode *newChild,
+ DOMNode *oldChild) = 0;
+ /**
+ * Removes the child node indicated by oldChild from the list
+ * of children, and returns it.
+ *
+ * @param oldChild The node being removed.
+ * @return The node removed.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ *
NOT_FOUND_ERR: Raised if oldChild is not a child of
+ * this node.
+ * @since DOM Level 1
+ */
+ virtual DOMNode *removeChild(DOMNode *oldChild) = 0;
+
+ /**
+ * Adds the node newChild to the end of the list of children of
+ * this node.
+ *
+ * If the newChild is already in the tree, it is
+ * first removed.
+ * @param newChild The node to add.If it is a DOMDocumentFragment
+ * object, the entire contents of the document fragment are moved into
+ * the child list of this node
+ * @return The node added.
+ * @exception DOMException
+ * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
+ * allow children of the type of the newChild node, or if
+ * the node to append is one of this node's ancestors.
+ *
WRONG_DOCUMENT_ERR: Raised if newChild was created
+ * from a different document than the one that created this node.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the node being
+ * appended is readonly.
+ * @since DOM Level 1
+ */
+ virtual DOMNode *appendChild(DOMNode *newChild) = 0;
+
+ // -----------------------------------------------------------------------
+ // Query methods
+ // -----------------------------------------------------------------------
+ /**
+ * This is a convenience method to allow easy determination of whether a
+ * node has any children.
+ *
+ * @return true if the node has any children,
+ * false if the node has no children.
+ * @since DOM Level 1
+ */
+ virtual bool hasChildNodes() const = 0;
+
+ // -----------------------------------------------------------------------
+ // Setter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Sets the value of the node.
+ *
+ * Any node which can have a nodeValue will
+ * also accept requests to set it to a string. The exact response to
+ * this varies from node to node -- Attribute, for example, stores
+ * its values in its children and has to replace them with a new Text
+ * holding the replacement value.
+ *
+ * For most types of Node, value is null and attempting to set it
+ * will throw DOMException(NO_MODIFICATION_ALLOWED_ERR). This will
+ * also be thrown if the node is read-only.
+ * @see #getNodeValue
+ * @since DOM Level 1
+ */
+ virtual void setNodeValue(const XMLCh *nodeValue) = 0;
+ //@}
+
+ /** @name Functions introduced in DOM Level 2. */
+ //@{
+ /**
+ * Puts all DOMText
+ * nodes in the full depth of the sub-tree underneath this DOMNode,
+ * including attribute nodes, into a "normal" form where only markup (e.g.,
+ * tags, comments, processing instructions, CDATA sections, and entity
+ * references) separates DOMText
+ * nodes, i.e., there are neither adjacent DOMText
+ * nodes nor empty DOMText
+ * nodes. This can be used to ensure that the DOM view of a document is the
+ * same as if it were saved and re-loaded, and is useful when operations
+ * (such as XPointer lookups) that depend on a particular document tree
+ * structure are to be used.
+ * Note: In cases where the document contains DOMCDATASections,
+ * the normalize operation alone may not be sufficient, since XPointers do
+ * not differentiate between DOMText
+ * nodes and DOMCDATASection
+ * nodes.
+ *
+ * @since DOM Level 2
+ */
+ virtual void normalize() = 0;
+
+ /**
+ * Tests whether the DOM implementation implements a specific
+ * feature and that feature is supported by this node.
+ *
+ * @param feature The string of the feature to test. This is the same
+ * name as what can be passed to the method hasFeature on
+ * DOMImplementation.
+ * @param version This is the version number of the feature to test. In
+ * Level 2, version 1, this is the string "2.0". If the version is not
+ * specified, supporting any version of the feature will cause the
+ * method to return true.
+ * @return Returns true if the specified feature is supported
+ * on this node, false otherwise.
+ * @since DOM Level 2
+ */
+ virtual bool isSupported(const XMLCh *feature,
+ const XMLCh *version) const = 0;
+
+ /**
+ * Get the namespace URI of
+ * this node, or null if it is unspecified.
+ *
+ * This is not a computed value that is the result of a namespace lookup
+ * based on an examination of the namespace declarations in scope. It is
+ * merely the namespace URI given at creation time.
+ *
+ * For nodes of any type other than ELEMENT_NODE and
+ * ATTRIBUTE_NODE and nodes created with a DOM Level 1 method,
+ * such as createElement from the DOMDocument
+ * interface, this is always null.
+ *
+ * @since DOM Level 2
+ */
+ virtual const XMLCh * getNamespaceURI() const = 0;
+
+ /**
+ * Get the namespace prefix
+ * of this node, or null if it is unspecified.
+ *
+ * @since DOM Level 2
+ */
+ virtual const XMLCh * getPrefix() const = 0;
+
+ /**
+ * Returns the local part of the qualified name of this node.
+ *
+ * For nodes created with a DOM Level 1 method, such as
+ * createElement from the DOMDocument interface,
+ * it is null.
+ *
+ * @since DOM Level 2
+ */
+ virtual const XMLCh * getLocalName() const = 0;
+
+ /**
+ * Set the namespace prefix of this node.
+ *
+ * Note that setting this attribute, when permitted, changes
+ * the nodeName attribute, which holds the qualified
+ * name, as well as the tagName and name
+ * attributes of the DOMElement and DOMAttr
+ * interfaces, when applicable.
+ *
+ * Note also that changing the prefix of an
+ * attribute, that is known to have a default value, does not make a new
+ * attribute with the default value and the original prefix appear, since the
+ * namespaceURI and localName do not change.
+ *
+ *
+ * @param prefix The prefix of this node.
+ * @exception DOMException
+ * INVALID_CHARACTER_ERR: Raised if the specified prefix contains
+ * an illegal character.
+ *
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ *
+ * NAMESPACE_ERR: Raised if the specified prefix is
+ * malformed, if the namespaceURI of this node is
+ * null, if the specified prefix is "xml" and the
+ * namespaceURI of this node is different from
+ * "http://www.w3.org/XML/1998/namespace", if this node is an attribute
+ * and the specified prefix is "xmlns" and the
+ * namespaceURI of this node is different from
+ * "http://www.w3.org/2000/xmlns/", or if this node is an attribute and
+ * the qualifiedName of this node is "xmlns".
+ * @since DOM Level 2
+ */
+ virtual void setPrefix(const XMLCh * prefix) = 0;
+
+ /**
+ * Returns whether this node (if it is an element) has any attributes.
+ * @return true if this node has any attributes,
+ * false otherwise.
+ * @since DOM Level 2
+ */
+ virtual bool hasAttributes() const = 0;
+ //@}
+
+ /** @name Functions introduced in DOM Level 3. */
+ //@{
+ /**
+ * Returns whether this node is the same node as the given one.
+ *
This method provides a way to determine whether two
+ * DOMNode references returned by the implementation reference
+ * the same object. When two DOMNode references are references
+ * to the same object, even if through a proxy, the references may be
+ * used completely interchangeably, such that all attributes have the
+ * same values and calling the same DOM method on either reference
+ * always has exactly the same effect.
+ *
+ * @param other The node to test against.
+ * @return Returns true if the nodes are the same,
+ * false otherwise.
+ * @since DOM Level 3
+ */
+ virtual bool isSameNode(const DOMNode* other) const = 0;
+
+ /**
+ * Tests whether two nodes are equal.
+ *
This method tests for equality of nodes, not sameness (i.e.,
+ * whether the two nodes are pointers to the same object) which can be
+ * tested with DOMNode::isSameNode. All nodes that are the same
+ * will also be equal, though the reverse may not be true.
+ *
Two nodes are equal if and only if the following conditions are
+ * satisfied: The two nodes are of the same type.The following string
+ * attributes are equal: nodeName, localName,
+ * namespaceURI, prefix, nodeValue
+ * , baseURI. This is: they are both null, or
+ * they have the same length and are character for character identical.
+ * The attributes DOMNamedNodeMaps are equal.
+ * This is: they are both null, or they have the same
+ * length and for each node that exists in one map there is a node that
+ * exists in the other map and is equal, although not necessarily at the
+ * same index.The childNodes DOMNodeLists are
+ * equal. This is: they are both null, or they have the
+ * same length and contain equal nodes at the same index. This is true
+ * for DOMAttr nodes as for any other type of node. Note that
+ * normalization can affect equality; to avoid this, nodes should be
+ * normalized before being compared.
+ *
For two DOMDocumentType nodes to be equal, the following
+ * conditions must also be satisfied: The following string attributes
+ * are equal: publicId, systemId,
+ * internalSubset.The entities
+ * DOMNamedNodeMaps are equal.The notations
+ * DOMNamedNodeMaps are equal.
+ *
On the other hand, the following do not affect equality: the
+ * ownerDocument attribute, the specified
+ * attribute for DOMAttr nodes, the
+ * isWhitespaceInElementContent attribute for
+ * DOMText nodes, as well as any user data or event listeners
+ * registered on the nodes.
+ *
+ * @param arg The node to compare equality with.
+ * @return If the nodes, and possibly subtrees are equal,
+ * true otherwise false.
+ * @since DOM Level 3
+ */
+ virtual bool isEqualNode(const DOMNode* arg) const = 0;
+
+
+ /**
+ * Associate an object to a key on this node. The object can later be
+ * retrieved from this node by calling getUserData with the
+ * same key.
+ *
+ * Deletion of the user data remains the responsibility of the
+ * application program; it will not be automatically deleted when
+ * the nodes themselves are reclaimed.
+ *
+ * Both the parameter data and the returned object are
+ * void pointer, it is applications' responsibility to keep track of
+ * their original type. Casting them to the wrong type may result
+ * unexpected behavior.
+ *
+ * @param key The key to associate the object to.
+ * @param data The object to associate to the given key, or
+ * null to remove any existing association to that key.
+ * @param handler The handler to associate to that key, or
+ * null.
+ * @return Returns the void* object previously associated to
+ * the given key on this node, or null if there was none.
+ * @see #getUserData
+ *
+ * @since DOM Level 3
+ */
+ virtual void* setUserData(const XMLCh* key,
+ void* data,
+ DOMUserDataHandler* handler) = 0;
+
+ /**
+ * Retrieves the object associated to a key on a this node. The object
+ * must first have been set to this node by calling
+ * setUserData with the same key.
+ *
+ * @param key The key the object is associated to.
+ * @return Returns the void* associated to the given key
+ * on this node, or null if there was none.
+ * @see #setUserData
+ * @since DOM Level 3
+ */
+ virtual void* getUserData(const XMLCh* key) const = 0;
+
+
+ /**
+ * The absolute base URI of this node or null if undefined.
+ * This value is computed according to . However, when the
+ * DOMDocument supports the feature "HTML" , the base URI is
+ * computed using first the value of the href attribute of the HTML BASE
+ * element if any, and the value of the documentURI
+ * attribute from the DOMDocument interface otherwise.
+ *
+ *
When the node is an DOMElement, a DOMDocument
+ * or a a DOMProcessingInstruction, this attribute represents
+ * the properties [base URI] defined in . When the node is a
+ * DOMNotation, an DOMEntity, or an
+ * DOMEntityReference, this attribute represents the
+ * properties [declaration base URI].
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getBaseURI() const = 0;
+
+ /**
+ * Compares the reference node, i.e. the node on which this method is being called,
+ * with a node, i.e. the one passed as a parameter, with regard to their position
+ * in the document and according to the document order.
+ *
+ * @param other The node to compare against this node.
+ * @return Returns how the given node is positioned relatively to this
+ * node.
+ * @since DOM Level 3
+ */
+ virtual short compareDocumentPosition(const DOMNode* other) const = 0;
+
+ /**
+ * This attribute returns the text content of this node and its
+ * descendants. No serialization is performed, the returned string
+ * does not contain any markup. No whitespace normalization is
+ * performed and the returned string does not contain the white
+ * spaces in element content.
+ *
+ *
The string returned is made of the text content of this node
+ * depending on its type, as defined below:
+ *
+ *
+ * | Node type |
+ * Content |
+ *
+ *
+ * |
+ * ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE,
+ * DOCUMENT_FRAGMENT_NODE |
+ * concatenation of the textContent
+ * attribute value of every child node, excluding COMMENT_NODE and
+ * PROCESSING_INSTRUCTION_NODE nodes |
+ *
+ *
+ * | ATTRIBUTE_NODE, TEXT_NODE,
+ * CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE |
+ *
+ * nodeValue |
+ *
+ *
+ * | DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE |
+ *
+ * null |
+ *
+ *
+ * @exception DOMException
+ * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
+ * fit in a DOMString variable on the implementation
+ * platform.
+ * @see #setTextContent
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getTextContent() const = 0;
+
+ /**
+ * This attribute removes any possible children this node may have and, if the
+ * new string is not empty or null, replaced by a single DOMText
+ * node containing the string this attribute is set to. No parsing is
+ * performed, the input string is taken as pure textual content.
+ *
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
+ * @see #getTextContent
+ * @since DOM Level 3
+ */
+ virtual void setTextContent(const XMLCh* textContent) = 0;
+
+ /**
+ * Look up the prefix associated to the given namespace URI, starting from this node.
+ * The default namespace declarations are ignored by this method.
+ *
+ * @param namespaceURI The namespace URI to look for.
+ * @return Returns an associated namespace prefix if found,
+ * null if none is found. If more
+ * than one prefix are associated to the namespace prefix, the
+ * returned namespace prefix is implementation dependent.
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* lookupPrefix(const XMLCh* namespaceURI) const = 0;
+
+ /**
+ * This method checks if the specified namespaceURI is the
+ * default namespace or not.
+ *
+ * @param namespaceURI The namespace URI to look for.
+ * @return true if the specified namespaceURI
+ * is the default namespace, false otherwise.
+ * @since DOM Level 3
+ */
+ virtual bool isDefaultNamespace(const XMLCh* namespaceURI) const = 0;
+
+ /**
+ * Look up the namespace URI associated to the given prefix, starting from
+ * this node.
+ *
+ * @param prefix The prefix to look for. If this parameter is
+ * null, the method will return the default namespace URI
+ * if any.
+ * @return Returns the associated namespace URI or null if
+ * none is found.
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* lookupNamespaceURI(const XMLCh* prefix) const = 0;
+
+ /**
+ * This method makes available a DOMNode's specialized interface
+ *
+ * @param feature The name of the feature requested (case-insensitive).
+ * @param version The version of the feature requested.
+ * @return Returns an alternate DOMNode which implements the
+ * specialized APIs of the specified feature, if any, or
+ * null if there is no alternate DOMNode which
+ * implements interfaces associated with that feature. Any alternate
+ * DOMNode returned by this method must delegate to the
+ * primary core DOMNode and not return results inconsistent
+ * with the primary core DOMNode such as key,
+ * attributes, childNodes, etc.
+ * @since DOM Level 3
+ */
+ virtual void* getFeature(const XMLCh* feature, const XMLCh* version) const = 0;
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Non-standard Extension
+ // -----------------------------------------------------------------------
+ /** @name Non-standard Extension */
+ //@{
+ /**
+ * Called to indicate that this Node (and its associated children) is no longer in use
+ * and that the implementation may relinquish any resources associated with it and
+ * its associated children.
+ *
+ * If this is a document, any nodes it owns (created by DOMDocument::createXXXX())
+ * are also released.
+ *
+ * Access to a released object will lead to unexpected result.
+ *
+ * @exception DOMException
+ * INVALID_ACCESS_ERR: Raised if this Node has a parent and thus should not be released yet.
+ */
+ virtual void release() = 0;
+ //@}
+#if defined(XML_DOMREFCOUNT_EXPERIMENTAL)
+ // -----------------------------------------------------------------------
+ // Non-standard Extension
+ // -----------------------------------------------------------------------
+ /** @name Non-standard Extension */
+ //@{
+ /**
+ * This is custom function which can be implemented by classes deriving
+ * from DOMNode for implementing reference counting on DOMNodes. Any
+ * implementation which has memory management model which involves
+ * disposing of nodes immediately after being used can override this
+ * function to do that job.
+ */
+ virtual void decRefCount() {}
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Non-standard Extension
+ // -----------------------------------------------------------------------
+ /** @name Non-standard Extension */
+ //@{
+ /**
+ * This is custom function which can be implemented by classes deriving
+ * from DOMNode for implementing reference counting on DOMNodes.
+ */
+ virtual void incRefCount() {}
+ //@}
+#endif
+};
+
+/***
+ * Utilities macros for getting memory manager within DOM
+***/
+#define GET_OWNER_DOCUMENT(ptr) \
+ ((DOMDocumentImpl*)(ptr->getOwnerDocument()))
+
+#define GET_DIRECT_MM(ptr) \
+ (ptr ? ((DOMDocumentImpl*)ptr)->getMemoryManager() : XMLPlatformUtils::fgMemoryManager)
+
+#define GET_INDIRECT_MM(ptr) \
+ (!ptr ? XMLPlatformUtils::fgMemoryManager : \
+ GET_OWNER_DOCUMENT(ptr) ? GET_OWNER_DOCUMENT(ptr)->getMemoryManager() : \
+ XMLPlatformUtils::fgMemoryManager)
+
+/***
+ * For DOMNode and its derivatives
+***/
+#define GetDOMNodeMemoryManager GET_INDIRECT_MM(this)
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMNodeFilter.hpp b/include/xercesc/dom/DOMNodeFilter.hpp
new file mode 100644
index 0000000..55d1d31
--- /dev/null
+++ b/include/xercesc/dom/DOMNodeFilter.hpp
@@ -0,0 +1,221 @@
+/*
+ * 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: DOMNodeFilter.hpp 932887 2010-04-11 13:04:59Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMNODEFILTER_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMNODEFILTER_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+/**
+ * Filters are objects that know how to "filter out" nodes. If a
+ * DOMNodeIterator or DOMTreeWalker is given a
+ * DOMNodeFilter, it applies the filter before it returns the next
+ * node. If the filter says to accept the node, the traversal logic returns
+ * it; otherwise, traversal looks for the next node and pretends that the
+ * node that was rejected was not there.
+ * The DOM does not provide any filters. DOMNodeFilter is just an
+ * interface that users can implement to provide their own filters.
+ *
DOMNodeFilters do not need to know how to traverse from node
+ * to node, nor do they need to know anything about the data structure that
+ * is being traversed. This makes it very easy to write filters, since the
+ * only thing they have to know how to do is evaluate a single node. One
+ * filter may be used with a number of different kinds of traversals,
+ * encouraging code reuse.
+ *
See also the Document Object Model (DOM) Level 2 Traversal and Range Specification.
+ * @since DOM Level 2
+ */
+
+class CDOM_EXPORT DOMNodeFilter
+{
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMNodeFilter() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMNodeFilter(const DOMNodeFilter &);
+ DOMNodeFilter & operator = (const DOMNodeFilter &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMNodeFilter() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Class Types
+ // -----------------------------------------------------------------------
+ /** @name Public Constants */
+ //@{
+ /**
+ * Constants returned by acceptNode.
+ *
+ *
FILTER_ACCEPT:
+ * Accept the node. Navigation methods defined for
+ * DOMNodeIterator or DOMTreeWalker will return this
+ * node.
+ *
+ * FILTER_REJECT:
+ * Reject the node. Navigation methods defined for
+ * DOMNodeIterator or DOMTreeWalker will not return
+ * this node. For DOMTreeWalker, the children of this node
+ * will also be rejected. DOMNodeIterators treat this as a
+ * synonym for FILTER_SKIP.
+ *
+ * FILTER_SKIP:
+ * Skip this single node. Navigation methods defined for
+ * DOMNodeIterator or DOMTreeWalker will not return
+ * this node. For both DOMNodeIterator and
+ * DOMTreeWalker, the children of this node will still be
+ * considered.
+ *
+ * @since DOM Level 2
+ */
+ enum FilterAction {FILTER_ACCEPT = 1,
+ FILTER_REJECT = 2,
+ FILTER_SKIP = 3};
+
+ /**
+ * Constants for whatToShow
+ *
+ * SHOW_ALL:
+ * Show all DOMNode(s).
+ *
+ * SHOW_ELEMENT:
+ * Show DOMElement nodes.
+ *
+ * SHOW_ATTRIBUTE:
+ * Show DOMAttr nodes. This is meaningful only when creating an
+ * DOMNodeIterator or DOMTreeWalker with an
+ * attribute node as its root; in this case, it means that
+ * the attribute node will appear in the first position of the iteration
+ * or traversal. Since attributes are never children of other nodes,
+ * they do not appear when traversing over the document tree.
+ *
+ * SHOW_TEXT:
+ * Show DOMText nodes.
+ *
+ * SHOW_CDATA_SECTION:
+ * Show DOMCDATASection nodes.
+ *
+ * SHOW_ENTITY_REFERENCE:
+ * Show DOMEntityReference nodes.
+ *
+ * SHOW_ENTITY:
+ * Show DOMEntity nodes. This is meaningful only when creating
+ * an DOMNodeIterator or DOMTreeWalker with an
+ * DOMEntity node as its root; in this case, it
+ * means that the DOMEntity node will appear in the first
+ * position of the traversal. Since entities are not part of the
+ * document tree, they do not appear when traversing over the document
+ * tree.
+ *
+ * SHOW_PROCESSING_INSTRUCTION:
+ * Show DOMProcessingInstruction nodes.
+ *
+ * SHOW_COMMENT:
+ * Show DOMComment nodes.
+ *
+ * SHOW_DOCUMENT:
+ * Show DOMDocument nodes.
+ *
+ * SHOW_DOCUMENT_TYPE:
+ * Show DOMDocumentType nodes.
+ *
+ * SHOW_DOCUMENT_FRAGMENT:
+ * Show DOMDocumentFragment nodes.
+ *
+ * SHOW_NOTATION:
+ * Show DOMNotation nodes. This is meaningful only when creating
+ * an DOMNodeIterator or DOMTreeWalker with a
+ * DOMNotation node as its root; in this case, it
+ * means that the DOMNotation node will appear in the first
+ * position of the traversal. Since notations are not part of the
+ * document tree, they do not appear when traversing over the document
+ * tree.
+ *
+ * @since DOM Level 2
+ */
+ enum ShowTypeMasks {
+ SHOW_ALL = 0x0000FFFF,
+ SHOW_ELEMENT = 0x00000001,
+ SHOW_ATTRIBUTE = 0x00000002,
+ SHOW_TEXT = 0x00000004,
+ SHOW_CDATA_SECTION = 0x00000008,
+ SHOW_ENTITY_REFERENCE = 0x00000010,
+ SHOW_ENTITY = 0x00000020,
+ SHOW_PROCESSING_INSTRUCTION = 0x00000040,
+ SHOW_COMMENT = 0x00000080,
+ SHOW_DOCUMENT = 0x00000100,
+ SHOW_DOCUMENT_TYPE = 0x00000200,
+ SHOW_DOCUMENT_FRAGMENT = 0x00000400,
+ SHOW_NOTATION = 0x00000800
+ };
+
+ typedef unsigned long ShowType;
+
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMNodeFilter interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 2 */
+ //@{
+ /**
+ * Test whether a specified node is visible in the logical view of a
+ * DOMTreeWalker or DOMNodeIterator. This function
+ * will be called by the implementation of DOMTreeWalker and
+ * DOMNodeIterator; it is not normally called directly from
+ * user code. (Though you could do so if you wanted to use the same
+ * filter to guide your own application logic.)
+ * @param node The node to check to see if it passes the filter or not.
+ * @return A constant to determine whether the node is accepted,
+ * rejected, or skipped, as defined above.
+ * @since DOM Level 2
+ */
+ virtual FilterAction acceptNode (const DOMNode* node) const =0;
+ //@}
+
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMNodeIterator.hpp b/include/xercesc/dom/DOMNodeIterator.hpp
new file mode 100644
index 0000000..44b29a9
--- /dev/null
+++ b/include/xercesc/dom/DOMNodeIterator.hpp
@@ -0,0 +1,196 @@
+/*
+ * 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: DOMNodeIterator.hpp 671894 2008-06-26 13:29:21Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMNODEITERATOR_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMNODEITERATOR_HPP
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+/**
+ * DOMNodeIterators are used to step through a set of nodes, e.g.
+ * the set of nodes in a DOMNodeList, the document subtree
+ * governed by a particular DOMNode, the results of a query, or
+ * any other set of nodes. The set of nodes to be iterated is determined by
+ * the implementation of the DOMNodeIterator. DOM Level 2
+ * specifies a single DOMNodeIterator implementation for
+ * document-order traversal of a document subtree. Instances of these
+ * DOMNodeIterators are created by calling
+ * DOMDocumentTraversal.createNodeIterator().
+ * See also the Document Object Model (DOM) Level 2 Traversal and Range Specification.
+ * @since DOM Level 2
+ */
+class CDOM_EXPORT DOMNodeIterator
+{
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMNodeIterator() {}
+ DOMNodeIterator(const DOMNodeIterator &) {}
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented operators */
+ //@{
+ DOMNodeIterator & operator = (const DOMNodeIterator &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMNodeIterator() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMNodeFilter interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 2 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * The root node of the DOMNodeIterator, as specified
+ * when it was created.
+ * @since DOM Level 2
+ */
+ virtual DOMNode* getRoot() = 0;
+ /**
+ * Return which node types are presented via the iterator.
+ * This attribute determines which node types are presented via the
+ * DOMNodeIterator. The available set of constants is defined
+ * in the DOMNodeFilter interface. Nodes not accepted by
+ * whatToShow will be skipped, but their children may still
+ * be considered. Note that this skip takes precedence over the filter,
+ * if any.
+ * @since DOM Level 2
+ *
+ */
+ virtual DOMNodeFilter::ShowType getWhatToShow() = 0;
+
+ /**
+ * The DOMNodeFilter used to screen nodes.
+ *
+ * @since DOM Level 2
+ */
+ virtual DOMNodeFilter* getFilter() = 0;
+
+ /**
+ * Return the expandEntityReferences flag.
+ * The value of this flag determines whether the children of entity
+ * reference nodes are visible to the DOMNodeIterator. If
+ * false, these children and their descendants will be rejected. Note
+ * that this rejection takes precedence over whatToShow and
+ * the filter. Also note that this is currently the only situation where
+ * DOMNodeIterators may reject a complete subtree rather than
+ * skipping individual nodes.
+ *
+ *
To produce a view of the document that has entity references
+ * expanded and does not expose the entity reference node itself, use
+ * the whatToShow flags to hide the entity reference node
+ * and set expandEntityReferences to true when creating the
+ * DOMNodeIterator. To produce a view of the document that has
+ * entity reference nodes but no entity expansion, use the
+ * whatToShow flags to show the entity reference node and
+ * set expandEntityReferences to false.
+ *
+ * @since DOM Level 2
+ */
+ virtual bool getExpandEntityReferences() = 0;
+
+ // -----------------------------------------------------------------------
+ // Query methods
+ // -----------------------------------------------------------------------
+ /**
+ * Returns the next node in the set and advances the position of the
+ * DOMNodeIterator in the set. After a
+ * DOMNodeIterator is created, the first call to
+ * nextNode() returns the first node in the set.
+ * @return The next DOMNode in the set being iterated over, or
+ * null if there are no more members in that set.
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if this method is called after the
+ * detach method was invoked.
+ * @since DOM Level 2
+ */
+ virtual DOMNode* nextNode() = 0;
+
+ /**
+ * Returns the previous node in the set and moves the position of the
+ * DOMNodeIterator backwards in the set.
+ * @return The previous DOMNode in the set being iterated over,
+ * or null if there are no more members in that set.
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if this method is called after the
+ * detach method was invoked.
+ * @since DOM Level 2
+ */
+ virtual DOMNode* previousNode() = 0;
+
+ /**
+ * Detaches the DOMNodeIterator from the set which it iterated
+ * over, releasing any computational resources and placing the
+ * DOMNodeIterator in the INVALID state. After
+ * detach has been invoked, calls to nextNode
+ * or previousNode will raise the exception
+ * INVALID_STATE_ERR.
+ * @since DOM Level 2
+ */
+ virtual void detach() = 0;
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Non-standard Extension
+ // -----------------------------------------------------------------------
+ /** @name Non-standard Extension */
+ //@{
+ /**
+ * Called to indicate that this NodeIterator is no longer in use
+ * and that the implementation may relinquish any resources associated with it.
+ * (release() will call detach() where appropriate)
+ *
+ * Access to a released object will lead to unexpected result.
+ */
+ virtual void release() = 0;
+ //@}
+};
+
+#define GetDOMNodeIteratorMemoryManager GET_DIRECT_MM(fDocument)
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMNodeList.hpp b/include/xercesc/dom/DOMNodeList.hpp
new file mode 100644
index 0000000..a8cfc78
--- /dev/null
+++ b/include/xercesc/dom/DOMNodeList.hpp
@@ -0,0 +1,112 @@
+/*
+ * 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: DOMNodeList.hpp 671894 2008-06-26 13:29:21Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMNODELIST_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMNODELIST_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMNode;
+
+
+/**
+ * The DOMNodeList interface provides the abstraction of an ordered
+ * collection of nodes. DOMNodeLists are created by DOMDocument::getElementsByTagName(),
+ * DOMNode::getChildNodes(),
+ *
+ * The items in the DOMNodeList are accessible via an integral
+ * index, starting from 0.
+ *
+ * DOMNodeLists are "live", in that any changes to the document tree are immediately
+ * reflected in any DOMNodeLists that may have been created for that tree.
+ */
+
+class CDOM_EXPORT DOMNodeList {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMNodeList() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMNodeList(const DOMNodeList &);
+ DOMNodeList & operator = (const DOMNodeList &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMNodeList() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMNodeList interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 1 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Returns the index item in the collection.
+ *
+ * If index is greater than or equal to the number of nodes in
+ * the list, this returns null.
+ *
+ * @param index Index into the collection.
+ * @return The node at the indexth position in the
+ * DOMNodeList, or null if that is not a valid
+ * index.
+ * @since DOM Level 1
+ */
+ virtual DOMNode *item(XMLSize_t index) const = 0;
+
+ /**
+ * Returns the number of nodes in the list.
+ *
+ * The range of valid child node indices is 0 to length-1 inclusive.
+ * @since DOM Level 1
+ */
+ virtual XMLSize_t getLength() const = 0;
+ //@}
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMNotation.hpp b/include/xercesc/dom/DOMNotation.hpp
new file mode 100644
index 0000000..919c7e9
--- /dev/null
+++ b/include/xercesc/dom/DOMNotation.hpp
@@ -0,0 +1,114 @@
+/*
+ * 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: DOMNotation.hpp 527149 2007-04-10 14:56:39Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMNOTATION_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMNOTATION_HPP
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+/**
+ * This interface represents a notation declared in the DTD. A notation either
+ * declares, by name, the format of an unparsed entity (see section 4.7 of
+ * the XML 1.0 specification), or is used for formal declaration of
+ * Processing Instruction targets (see section 2.6 of the XML 1.0
+ * specification). The nodeName attribute inherited from
+ * DOMNode is set to the declared name of the notation.
+ * The DOM Level 1 does not support editing DOMNotation nodes;
+ * they are therefore readonly.
+ *
A DOMNotation node does not have any parent.
+ *
+ * @since DOM Level 1
+ */
+class CDOM_EXPORT DOMNotation: public DOMNode {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMNotation() {}
+ DOMNotation(const DOMNotation &other) : DOMNode(other) {}
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented operators */
+ //@{
+ DOMNotation & operator = (const DOMNotation &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMNotation() {};
+ //@}
+
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMNotation interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 1 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Get the public identifier of this notation.
+ *
+ * If the public identifier was not
+ * specified, this is null.
+ * @return Returns the public identifier of the notation
+ * @since DOM Level 1
+ */
+ virtual const XMLCh *getPublicId() const = 0;
+
+ /**
+ * Get the system identifier of this notation.
+ *
+ * If the system identifier was not
+ * specified, this is null.
+ * @return Returns the system identifier of the notation
+ * @since DOM Level 1
+ */
+ virtual const XMLCh *getSystemId() const = 0;
+
+
+ //@}
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
+
diff --git a/include/xercesc/dom/DOMPSVITypeInfo.hpp b/include/xercesc/dom/DOMPSVITypeInfo.hpp
new file mode 100644
index 0000000..8ccd1fb
--- /dev/null
+++ b/include/xercesc/dom/DOMPSVITypeInfo.hpp
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMPSVITYPEINFO_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMPSVITYPEINFO_HPP
+
+//------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------
+#include
+
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+/**
+ * The DOMPSVITypeInfo interface represent the PSVI info used by
+ * DOMElement or DOMAttr nodes, specified in the
+ * schemas associated with the document.
+ */
+class CDOM_EXPORT DOMPSVITypeInfo
+{
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMPSVITypeInfo() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMPSVITypeInfo(const DOMPSVITypeInfo &);
+ DOMPSVITypeInfo & operator = (const DOMPSVITypeInfo &);
+ //@}
+
+public:
+
+ enum PSVIProperty
+ {
+ PSVI_Validity
+ , PSVI_Validation_Attempted
+ , PSVI_Type_Definition_Type
+ , PSVI_Type_Definition_Name
+ , PSVI_Type_Definition_Namespace
+ , PSVI_Type_Definition_Anonymous
+ , PSVI_Nil
+ , PSVI_Member_Type_Definition_Name
+ , PSVI_Member_Type_Definition_Namespace
+ , PSVI_Member_Type_Definition_Anonymous
+ , PSVI_Schema_Default
+ , PSVI_Schema_Normalized_Value
+ , PSVI_Schema_Specified
+ };
+
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMPSVITypeInfo() {};
+ //@}
+
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Returns the string value of the specified PSVI property associated to a
+ * DOMElement or DOMAttr, or null if not available.
+ *
+ *
+ * @return the string value of the specified PSVI property associated to a
+ * DOMElement or DOMAttr, or null if not available.
+ */
+ virtual const XMLCh* getStringProperty(PSVIProperty prop) const = 0;
+
+ /**
+ * Returns the numeric value of the specified PSVI property associated to a
+ * DOMElement or DOMAttr, or null if not available.
+ *
+ *
+ * @return the numeric value of the specified PSVI property associated to a
+ * DOMElement or DOMAttr, or null if not available.
+ */
+ virtual int getNumericProperty(PSVIProperty prop) const = 0;
+ //@}
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
+/**
+ * End of file DOMPSVITypeInfo.hpp
+ */
diff --git a/include/xercesc/dom/DOMProcessingInstruction.hpp b/include/xercesc/dom/DOMProcessingInstruction.hpp
new file mode 100644
index 0000000..269416c
--- /dev/null
+++ b/include/xercesc/dom/DOMProcessingInstruction.hpp
@@ -0,0 +1,121 @@
+/*
+ * 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: DOMProcessingInstruction.hpp 527149 2007-04-10 14:56:39Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMPROCESSINGINSTRUCTION_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMPROCESSINGINSTRUCTION_HPP
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+/**
+ * The DOMProcessingInstruction interface represents a "processing
+ * instruction", used in XML as a way to keep processor-specific information
+ * in the text of the document.
+ *
+ * @since DOM Level 1
+ */
+class CDOM_EXPORT DOMProcessingInstruction: public DOMNode {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMProcessingInstruction() {}
+ DOMProcessingInstruction(const DOMProcessingInstruction &other) : DOMNode(other) {}
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented operators */
+ //@{
+ DOMProcessingInstruction & operator = (const DOMProcessingInstruction &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMProcessingInstruction() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMProcessingInstruction interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 1 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * The target of this processing instruction.
+ *
+ * XML defines this as being the
+ * first token following the markup that begins the processing instruction.
+ *
+ * @since DOM Level 1
+ */
+ virtual const XMLCh * getTarget() const = 0;
+
+ /**
+ * The content of this processing instruction.
+ *
+ * This is from the first non
+ * white space character after the target to the character immediately
+ * preceding the ?>.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
+ * @since DOM Level 1
+ */
+ virtual const XMLCh * getData() const = 0;
+
+ // -----------------------------------------------------------------------
+ // Setter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Sets the content of this processing instruction.
+ *
+ * This is from the first non
+ * white space character after the target to the character immediately
+ * preceding the ?>.
+ * @param data The string containing the processing instruction
+ * @since DOM Level 1
+ */
+ virtual void setData(const XMLCh * data) = 0;
+ //@}
+
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
diff --git a/include/xercesc/dom/DOMRange.hpp b/include/xercesc/dom/DOMRange.hpp
new file mode 100644
index 0000000..f0cdec5
--- /dev/null
+++ b/include/xercesc/dom/DOMRange.hpp
@@ -0,0 +1,530 @@
+/*
+ * 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: DOMRange.hpp 932887 2010-04-11 13:04:59Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMRANGE_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMRANGE_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+class DOMNode;
+class DOMDocumentFragment;
+
+/**
+ * See also the Document Object Model (DOM) Level 2 Traversal and Range Specification.
+ * @since DOM Level 2
+ */
+class CDOM_EXPORT DOMRange {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMRange() {}
+ DOMRange(const DOMRange &) {}
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented operators */
+ //@{
+ DOMRange & operator = (const DOMRange &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMRange() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Class Types
+ // -----------------------------------------------------------------------
+ /** @name Public Constants */
+ //@{
+ /**
+ * Constants CompareHow.
+ *
+ *
START_TO_START:
+ * Compare start boundary-point of sourceRange to start
+ * boundary-point of Range on which compareBoundaryPoints
+ * is invoked.
+ *
+ * START_TO_END:
+ * Compare start boundary-point of sourceRange to end
+ * boundary-point of Range on which compareBoundaryPoints
+ * is invoked.
+ *
+ * END_TO_END:
+ * Compare end boundary-point of sourceRange to end
+ * boundary-point of Range on which compareBoundaryPoints
+ * is invoked.
+ *
+ * END_TO_START:
+ * Compare end boundary-point of sourceRange to start
+ * boundary-point of Range on which compareBoundaryPoints
+ * is invoked.
+ *
+ * @since DOM Level 2
+ */
+ enum CompareHow {
+ START_TO_START = 0,
+ START_TO_END = 1,
+ END_TO_END = 2,
+ END_TO_START = 3
+ };
+
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMRange interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 2 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * DOMNode within which the Range begins
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if detach() has already been
+ * invoked on this object.
+ *
+ * @since DOM Level 2
+ */
+ virtual DOMNode* getStartContainer() const = 0;
+
+ /**
+ * Offset within the starting node of the Range.
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if detach() has already been
+ * invoked on this object.
+ *
+ * @since DOM Level 2
+ */
+ virtual XMLSize_t getStartOffset() const = 0;
+
+ /**
+ * DOMNode within which the Range ends
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if detach() has already been
+ * invoked on this object.
+ *
+ * @since DOM Level 2
+ */
+ virtual DOMNode* getEndContainer() const = 0;
+
+ /**
+ * Offset within the ending node of the Range.
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if detach() has already been
+ * invoked on this object.
+ *
+ * @since DOM Level 2
+ */
+ virtual XMLSize_t getEndOffset() const = 0;
+
+ /**
+ * TRUE if the Range is collapsed
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if detach() has already been
+ * invoked on this object.
+ *
+ * @since DOM Level 2
+ */
+ virtual bool getCollapsed() const = 0;
+
+ /**
+ * The deepest common ancestor container of the Range's two
+ * boundary-points.
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if detach() has already been
+ * invoked on this object.
+ *
+ * @since DOM Level 2
+ */
+ virtual const DOMNode* getCommonAncestorContainer() const = 0;
+
+ // -----------------------------------------------------------------------
+ // Setter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Sets the attributes describing the start of the Range.
+ * @param refNode The refNode value. This parameter must be
+ * different from null.
+ * @param offset The startOffset value.
+ * @exception DOMRangeException
+ * INVALID_NODE_TYPE_ERR: Raised if refNode or an ancestor
+ * of refNode is an DOMEntity, DOMNotation, or DOMDocumentType
+ * node.
+ * @exception DOMException
+ * INDEX_SIZE_ERR: Raised if offset is negative or greater
+ * than the number of child units in refNode. Child units
+ * are 16-bit units if refNode is a type of DOMCharacterData
+ * node (e.g., a DOMText or DOMComment node) or a DOMProcessingInstruction
+ * node. Child units are Nodes in all other cases.
+ *
INVALID_STATE_ERR: Raised if detach() has already
+ * been invoked on this object.
+ *
WRONG_DOCUMENT_ERR: Raised if refNode was created
+ * from a different document than the one that created this range.
+ *
+ * @since DOM Level 2
+ */
+ virtual void setStart(const DOMNode *refNode, XMLSize_t offset) = 0;
+
+ /**
+ * Sets the attributes describing the end of a Range.
+ * @param refNode The refNode value. This parameter must be
+ * different from null.
+ * @param offset The endOffset value.
+ * @exception DOMRangeException
+ * INVALID_NODE_TYPE_ERR: Raised if refNode or an ancestor
+ * of refNode is an DOMEntity, DOMNotation, or DOMDocumentType
+ * node.
+ * @exception DOMException
+ * INDEX_SIZE_ERR: Raised if offset is negative or greater
+ * than the number of child units in refNode. Child units
+ * are 16-bit units if refNode is a type of DOMCharacterData
+ * node (e.g., a DOMText or DOMComment node) or a DOMProcessingInstruction
+ * node. Child units are Nodes in all other cases.
+ *
INVALID_STATE_ERR: Raised if detach() has already
+ * been invoked on this object.
+ *
WRONG_DOCUMENT_ERR: Raised if refNode was created
+ * from a different document than the one that created this range.
+ *
+ * @since DOM Level 2
+ */
+ virtual void setEnd(const DOMNode *refNode, XMLSize_t offset) = 0;
+
+ /**
+ * Sets the start position to be before a node
+ * @param refNode Range starts before refNode
+ * @exception DOMRangeException
+ * INVALID_NODE_TYPE_ERR: Raised if the root container of
+ * refNode is not an DOMAttr, DOMDocument, or DOMDocumentFragment
+ * node or if refNode is a DOMDocument, DOMDocumentFragment,
+ * DOMAttr, DOMEntity, or DOMNotation node.
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if detach() has already been
+ * invoked on this object.
+ *
WRONG_DOCUMENT_ERR: Raised if refNode was created
+ * from a different document than the one that created this range.
+ *
+ * @since DOM Level 2
+ */
+ virtual void setStartBefore(const DOMNode *refNode) = 0;
+
+ /**
+ * Sets the start position to be after a node
+ * @param refNode Range starts after refNode
+ * @exception DOMRangeException
+ * INVALID_NODE_TYPE_ERR: Raised if the root container of
+ * refNode is not an DOMAttr, DOMDocument, or DOMDocumentFragment
+ * node or if refNode is a DOMDocument, DOMDocumentFragment,
+ * DOMAttr, DOMEntity, or DOMNotation node.
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if detach() has already been
+ * invoked on this object.
+ *
WRONG_DOCUMENT_ERR: Raised if refNode was created
+ * from a different document than the one that created this range.
+ *
+ * @since DOM Level 2
+ */
+ virtual void setStartAfter(const DOMNode *refNode) = 0;
+
+ /**
+ * Sets the end position to be before a node.
+ * @param refNode Range ends before refNode
+ * @exception DOMRangeException
+ * INVALID_NODE_TYPE_ERR: Raised if the root container of
+ * refNode is not an DOMAttr, DOMDocument, or DOMDocumentFragment
+ * node or if refNode is a DOMDocument, DOMDocumentFragment,
+ * DOMAttr, DOMEntity, or DOMNotation node.
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if detach() has already been
+ * invoked on this object.
+ *
WRONG_DOCUMENT_ERR: Raised if refNode was created
+ * from a different document than the one that created this range.
+ *
+ * @since DOM Level 2
+ */
+ virtual void setEndBefore(const DOMNode *refNode) = 0;
+
+ /**
+ * Sets the end of a Range to be after a node
+ * @param refNode Range ends after refNode.
+ * @exception DOMRangeException
+ * INVALID_NODE_TYPE_ERR: Raised if the root container of
+ * refNode is not a DOMAttr, DOMDocument or DOMDocumentFragment
+ * node or if refNode is a DOMDocument, DOMDocumentFragment,
+ * DOMAttr, DOMEntity, or DOMNotation node.
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if detach() has already been
+ * invoked on this object.
+ *
WRONG_DOCUMENT_ERR: Raised if refNode was created
+ * from a different document than the one that created this range.
+ *
+ * @since DOM Level 2
+ */
+ virtual void setEndAfter(const DOMNode *refNode) = 0;
+
+ // -----------------------------------------------------------------------
+ // Misc methods
+ // -----------------------------------------------------------------------
+ /**
+ * Collapse a Range onto one of its boundary-points
+ * @param toStart If TRUE, collapses the Range onto its start; if FALSE,
+ * collapses it onto its end.
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if detach() has already been
+ * invoked on this object.
+ *
+ * @since DOM Level 2
+ */
+ virtual void collapse(bool toStart) = 0;
+
+ /**
+ * Select a node and its contents
+ * @param refNode The node to select.
+ * @exception DOMRangeException
+ * INVALID_NODE_TYPE_ERR: Raised if an ancestor of refNode
+ * is an DOMEntity, DOMNotation or DOMDocumentType node or if
+ * refNode is a DOMDocument, DOMDocumentFragment, DOMAttr, DOMEntity,
+ * or DOMNotation node.
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if detach() has already been
+ * invoked on this object.
+ *
WRONG_DOCUMENT_ERR: Raised if refNode was created
+ * from a different document than the one that created this range.
+ *
+ * @since DOM Level 2
+ */
+ virtual void selectNode(const DOMNode *refNode) = 0;
+
+ /**
+ * Select the contents within a node
+ * @param refNode DOMNode to select from
+ * @exception DOMRangeException
+ * INVALID_NODE_TYPE_ERR: Raised if refNode or an ancestor
+ * of refNode is an DOMEntity, DOMNotation or DOMDocumentType node.
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if detach() has already been
+ * invoked on this object.
+ *
WRONG_DOCUMENT_ERR: Raised if refNode was created
+ * from a different document than the one that created this range.
+ *
+ * @since DOM Level 2
+ */
+ virtual void selectNodeContents(const DOMNode *refNode) = 0;
+
+ /**
+ * Compare the boundary-points of two Ranges in a document.
+ * @param how A code representing the type of comparison, as defined
+ * above.
+ * @param sourceRange The Range on which this current
+ * Range is compared to.
+ * @return -1, 0 or 1 depending on whether the corresponding
+ * boundary-point of the Range is respectively before, equal to, or
+ * after the corresponding boundary-point of sourceRange.
+ * @exception DOMException
+ * WRONG_DOCUMENT_ERR: Raised if the two Ranges are not in the same
+ * DOMDocument or DOMDocumentFragment.
+ *
INVALID_STATE_ERR: Raised if detach() has already
+ * been invoked on this object.
+ *
+ * @since DOM Level 2
+ */
+ virtual short compareBoundaryPoints(CompareHow how, const DOMRange* sourceRange) const = 0;
+
+ /**
+ * Removes the contents of a Range from the containing document or
+ * document fragment without returning a reference to the removed
+ * content.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if any portion of the content of
+ * the Range is read-only or any of the nodes that contain any of the
+ * content of the Range are read-only.
+ *
INVALID_STATE_ERR: Raised if detach() has already
+ * been invoked on this object.
+ *
+ * @since DOM Level 2
+ */
+ virtual void deleteContents() = 0;
+
+ /**
+ * Moves the contents of a Range from the containing document or document
+ * fragment to a new DOMDocumentFragment.
+ * @return A DOMDocumentFragment containing the extracted contents.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if any portion of the content of
+ * the Range is read-only or any of the nodes which contain any of the
+ * content of the Range are read-only.
+ *
HIERARCHY_REQUEST_ERR: Raised if a DOMDocumentType node would be
+ * extracted into the new DOMDocumentFragment.
+ *
INVALID_STATE_ERR: Raised if detach() has already
+ * been invoked on this object.
+ *
+ * @since DOM Level 2
+ */
+ virtual DOMDocumentFragment* extractContents() = 0;
+
+ /**
+ * Duplicates the contents of a Range
+ * @return A DOMDocumentFragment that contains content equivalent to this
+ * Range.
+ * @exception DOMException
+ * HIERARCHY_REQUEST_ERR: Raised if a DOMDocumentType node would be
+ * extracted into the new DOMDocumentFragment.
+ *
INVALID_STATE_ERR: Raised if detach() has already
+ * been invoked on this object.
+ *
+ * @since DOM Level 2
+ */
+ virtual DOMDocumentFragment* cloneContents() const = 0;
+
+ /**
+ * Inserts a node into the DOMDocument or DOMDocumentFragment at the start of
+ * the Range. If the container is a DOMText node, this will be split at the
+ * start of the Range (as if the DOMText node's splitText method was
+ * performed at the insertion point) and the insertion will occur
+ * between the two resulting DOMText nodes. Adjacent DOMText nodes will not be
+ * automatically merged. If the node to be inserted is a
+ * DOMDocumentFragment node, the children will be inserted rather than the
+ * DOMDocumentFragment node itself.
+ * @param newNode The node to insert at the start of the Range
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of the
+ * start of the Range is read-only.
+ *
WRONG_DOCUMENT_ERR: Raised if newNode and the
+ * container of the start of the Range were not created from the same
+ * document.
+ *
HIERARCHY_REQUEST_ERR: Raised if the container of the start of
+ * the Range is of a type that does not allow children of the type of
+ * newNode or if newNode is an ancestor of
+ * the container.
+ *
INVALID_STATE_ERR: Raised if detach() has already
+ * been invoked on this object.
+ * @exception DOMRangeException
+ * INVALID_NODE_TYPE_ERR: Raised if newNode is an DOMAttr,
+ * DOMEntity, DOMNotation, or DOMDocument node.
+ *
+ * @since DOM Level 2
+ */
+ virtual void insertNode(DOMNode *newNode) = 0;
+
+ /**
+ * Reparents the contents of the Range to the given node and inserts the
+ * node at the position of the start of the Range.
+ * @param newParent The node to surround the contents with.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of
+ * either boundary-point of the Range is read-only.
+ *
WRONG_DOCUMENT_ERR: Raised if newParent and the
+ * container of the start of the Range were not created from the same
+ * document.
+ *
HIERARCHY_REQUEST_ERR: Raised if the container of the start of
+ * the Range is of a type that does not allow children of the type of
+ * newParent or if newParent is an ancestor
+ * of the container or if node would end up with a child
+ * node of a type not allowed by the type of node.
+ *
INVALID_STATE_ERR: Raised if detach() has already
+ * been invoked on this object.
+ * @exception DOMRangeException
+ * BAD_BOUNDARYPOINTS_ERR: Raised if the Range partially selects a
+ * non-text node.
+ *
INVALID_NODE_TYPE_ERR: Raised if node is an DOMAttr,
+ * DOMEntity, DOMDocumentType, DOMNotation, DOMDocument, or DOMDocumentFragment node.
+ *
+ * @since DOM Level 2
+ */
+ virtual void surroundContents(DOMNode *newParent) = 0;
+
+ /**
+ * Produces a new Range whose boundary-points are equal to the
+ * boundary-points of the Range.
+ * @return The duplicated Range.
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if detach() has already been
+ * invoked on this object.
+ *
+ * @since DOM Level 2
+ */
+ virtual DOMRange* cloneRange() const = 0;
+
+ /**
+ * Returns the contents of a Range as a string. This string contains only
+ * the data characters, not any markup.
+ * @return The contents of the Range.
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if detach() has already been
+ * invoked on this object.
+ *
+ * @since DOM Level 2
+ */
+ virtual const XMLCh* toString() const = 0;
+
+ /**
+ * Called to indicate that the Range is no longer in use and that the
+ * implementation may relinquish any resources associated with this
+ * Range. Subsequent calls to any methods or attribute getters on this
+ * Range will result in a DOMException being thrown with an
+ * error code of INVALID_STATE_ERR.
+ * @exception DOMException
+ * INVALID_STATE_ERR: Raised if detach() has already been
+ * invoked on this object.
+ *
+ * @since DOM Level 2
+ */
+ virtual void detach() = 0;
+
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Non-standard Extension
+ // -----------------------------------------------------------------------
+ /** @name Non-standard Extension */
+ //@{
+ /**
+ * Called to indicate that this Range is no longer in use
+ * and that the implementation may relinquish any resources associated with it.
+ * (release() will call detach() where appropriate)
+ *
+ * Access to a released object will lead to unexpected result.
+ */
+ virtual void release() = 0;
+ //@}
+};
+
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMRangeException.cpp b/include/xercesc/dom/DOMRangeException.cpp
new file mode 100644
index 0000000..28a8249
--- /dev/null
+++ b/include/xercesc/dom/DOMRangeException.cpp
@@ -0,0 +1,52 @@
+/*
+ * 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: DOMRangeException.cpp 671894 2008-06-26 13:29:21Z borisk $
+ */
+
+#include "DOMRangeException.hpp"
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+DOMRangeException::DOMRangeException()
+: DOMException()
+{
+}
+
+
+DOMRangeException::DOMRangeException(short exCode,
+ short messageCode,
+ MemoryManager* const memoryManager)
+: DOMException(exCode, messageCode?messageCode:XMLDOMMsg::DOMRANGEEXCEPTION_ERRX+exCode-DOMRangeException::BAD_BOUNDARYPOINTS_ERR+1, memoryManager)
+{
+}
+
+
+DOMRangeException::DOMRangeException(const DOMRangeException &other)
+: DOMException(other)
+{
+}
+
+
+DOMRangeException::~DOMRangeException()
+{
+}
+
+XERCES_CPP_NAMESPACE_END
diff --git a/include/xercesc/dom/DOMRangeException.hpp b/include/xercesc/dom/DOMRangeException.hpp
new file mode 100644
index 0000000..c4d05f8
--- /dev/null
+++ b/include/xercesc/dom/DOMRangeException.hpp
@@ -0,0 +1,114 @@
+/*
+ * 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: DOMRangeException.hpp 932887 2010-04-11 13:04:59Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMRANGEEXCEPTION_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMRANGEEXCEPTION_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+/**
+ * Range operations may throw a DOMRangeException as specified in
+ * their method descriptions.
+ * See also the Document Object Model (DOM) Level 2 Traversal and Range Specification.
+ * @since DOM Level 2
+ */
+
+class CDOM_EXPORT DOMRangeException : public DOMException {
+public:
+ // -----------------------------------------------------------------------
+ // Class Types
+ // -----------------------------------------------------------------------
+ /** @name Public Constants */
+ //@{
+ /**
+ * Enumerators for DOM Range Exceptions
+ *
+ *
BAD_BOUNDARYPOINTS_ERR:
+ * If the boundary-points of a Range do not meet specific requirements.
+ *
+ * INVALID_NODE_TYPE_ERR:
+ * If the container of an boundary-point of a Range is being set to either
+ * a node of an invalid type or a node with an ancestor of an invalid
+ * type.
+ *
+ * @since DOM Level 2
+ */
+ enum RangeExceptionCode {
+ BAD_BOUNDARYPOINTS_ERR = 111,
+ INVALID_NODE_TYPE_ERR = 112
+ };
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // Constructors
+ // -----------------------------------------------------------------------
+ /** @name Constructors */
+ //@{
+ /**
+ * Default constructor for DOMRangeException.
+ *
+ */
+ DOMRangeException();
+
+ /**
+ * Constructor which takes an error code and a message.
+ *
+ * @param code The error code which indicates the exception
+ * @param messageCode The string containing the error message
+ * @param memoryManager The memory manager used to (de)allocate memory
+ */
+ DOMRangeException(short code,
+ short messageCode,
+ MemoryManager* const memoryManager);
+
+ /**
+ * Copy constructor.
+ *
+ * @param other The object to be copied.
+ */
+ DOMRangeException(const DOMRangeException &other);
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Destructors
+ // -----------------------------------------------------------------------
+ /** @name Destructor. */
+ //@{
+ /**
+ * Destructor for DOMRangeException.
+ *
+ */
+ virtual ~DOMRangeException();
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ DOMRangeException & operator = (const DOMRangeException &);
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMStringList.hpp b/include/xercesc/dom/DOMStringList.hpp
new file mode 100644
index 0000000..e594566
--- /dev/null
+++ b/include/xercesc/dom/DOMStringList.hpp
@@ -0,0 +1,131 @@
+/*
+ * 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: DOMStringList.hpp 671894 2008-06-26 13:29:21Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMSTRINGLIST_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMSTRINGLIST_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+/**
+ * The DOMStringList interface provides the abstraction of an ordered
+ * collection of strings, without defining or constraining how this collection
+ * is implemented. The items in the DOMStringList are accessible via
+ * an integral index, starting from 0.
+ */
+
+class CDOM_EXPORT DOMStringList {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMStringList() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMStringList(const DOMStringList &);
+ DOMStringList & operator = (const DOMStringList &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMStringList() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMStringList interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Returns the index item in the collection.
+ *
+ * If index is greater than or equal to the number of strings in
+ * the list, this returns null.
+ *
+ * @param index Index into the collection.
+ * @return The string at the indexth position in the
+ * DOMStringList, or null if that is not a valid
+ * index.
+ * @since DOM Level 3
+ */
+ virtual const XMLCh *item(XMLSize_t index) const = 0;
+
+ /**
+ * Returns the number of strings in the list.
+ *
+ * The range of valid child node indices is 0 to length-1 inclusive.
+ *
+ * @since DOM Level 3
+ */
+ virtual XMLSize_t getLength() const = 0;
+
+ /**
+ * Test if a string is part of this DOMStringList
+ *
+ * @return true if the string has been found, false otherwise.
+ *
+ * @since DOM Level 3
+ */
+ virtual bool contains(const XMLCh*) const = 0;
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Non-standard Extension
+ // -----------------------------------------------------------------------
+ /** @name Non-standard Extension */
+ //@{
+ /**
+ * Called to indicate that this list is no longer in use
+ * and that the implementation may relinquish any resources associated with it and
+ * its associated children.
+ *
+ * Access to a released object will lead to unexpected result.
+ *
+ */
+ virtual void release() = 0;
+ //@}
+
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMText.hpp b/include/xercesc/dom/DOMText.hpp
new file mode 100644
index 0000000..9bc3053
--- /dev/null
+++ b/include/xercesc/dom/DOMText.hpp
@@ -0,0 +1,182 @@
+/*
+ * 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: DOMText.hpp 527149 2007-04-10 14:56:39Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMTEXT_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMTEXT_HPP
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+/**
+ * The DOMText interface inherits from DOMCharacterData
+ * and represents the textual content (termed character data in XML) of an
+ * DOMElement or DOMAttr. If there is no markup inside
+ * an element's content, the text is contained in a single object
+ * implementing the DOMText interface that is the only child of
+ * the element. If there is markup, it is parsed into the information items
+ * (elements, comments, etc.) and DOMText nodes that form the list
+ * of children of the element.
+ * When a document is first made available via the DOM, there is only one
+ * DOMText node for each block of text. Users may create adjacent
+ * DOMText nodes that represent the contents of a given element
+ * without any intervening markup, but should be aware that there is no way
+ * to represent the separations between these nodes in XML or HTML, so they
+ * will not (in general) persist between DOM editing sessions. The
+ * normalize() method on DOMNode merges any such
+ * adjacent DOMText objects into a single node for each block of
+ * text.
+ *
See also the Document Object Model (DOM) Level 2 Core Specification.
+ */
+class CDOM_EXPORT DOMText: public DOMCharacterData {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMText() {}
+ DOMText(const DOMText &other) : DOMCharacterData(other) {}
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented operators */
+ //@{
+ DOMText & operator = (const DOMText &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMText() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMText interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 1 */
+ //@{
+ /**
+ * Breaks this node into two nodes at the specified offset,
+ * keeping both in the tree as siblings. After being split, this node
+ * will contain all the content up to the offset point. A
+ * new node of the same type, which contains all the content at and
+ * after the offset point, is returned. If the original
+ * node had a parent node, the new node is inserted as the next sibling
+ * of the original node. When the offset is equal to the
+ * length of this node, the new node has no data.
+ * @param offset The 16-bit unit offset at which to split, starting from
+ * 0.
+ * @return The new node, of the same type as this node.
+ * @exception DOMException
+ * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
+ * than the number of 16-bit units in data.
+ *
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
+ * @since DOM Level 1
+ */
+ virtual DOMText *splitText(XMLSize_t offset) = 0;
+ //@}
+
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+ /**
+ * Returns whether this text node contains element content whitespace,
+ * often abusively called "ignorable whitespace". The text node is determined
+ * to contain whitespace in element content during the load of the document
+ * or if validation occurs while using DOMDocument::normalizeDocument().
+ *
+ * @since DOM Level 3
+ */
+ virtual bool getIsElementContentWhitespace() const = 0;
+
+ /**
+ * Returns all text of DOMText nodes logically-adjacent text
+ * nodes to this node, concatenated in document order.
+ *
+ * @since DOM Level 3
+ */
+ virtual const XMLCh* getWholeText() const = 0;
+
+ /**
+ * Substitutes the a specified text for the text of the current node and
+ * all logically-adjacent text nodes.
+ *
+ *
This method returns the node in the hierarchy which received the
+ * replacement text, which is null if the text was empty or is the
+ * current node if the current node is not read-only or otherwise is a
+ * new node of the same type as the current node inserted at the site of
+ * the replacement. All logically-adjacent text nodes are removed
+ * including the current node unless it was the recipient of the
+ * replacement text.
+ *
Where the nodes to be removed are read-only descendants of an
+ * DOMEntityReference, the DOMEntityReference must
+ * be removed instead of the read-only nodes. If any
+ * DOMEntityReference to be removed has descendants that are
+ * not DOMEntityReference, DOMText, or
+ * DOMCDATASection nodes, the replaceWholeText
+ * method must fail before performing any modification of the document,
+ * raising a DOMException with the code
+ * NO_MODIFICATION_ALLOWED_ERR.
+ *
+ * @param content The content of the replacing DOMText node.
+ * @return The DOMText node created with the specified content.
+ * @exception DOMException
+ * NO_MODIFICATION_ALLOWED_ERR: Raised if one of the DOMText
+ * nodes being replaced is readonly.
+ * @since DOM Level 3
+ */
+ virtual DOMText* replaceWholeText(const XMLCh* content) = 0;
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Non-standard extension
+ // -----------------------------------------------------------------------
+ /** @name Non-standard extension */
+ //@{
+ /**
+ * Non-standard extension
+ *
+ * Return true if this node contains ignorable whitespaces only.
+ * @return True if this node contains ignorable whitespaces only.
+ */
+ virtual bool isIgnorableWhitespace() const = 0;
+ //@}
+
+};
+
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
+
diff --git a/include/xercesc/dom/DOMTreeWalker.hpp b/include/xercesc/dom/DOMTreeWalker.hpp
new file mode 100644
index 0000000..9f22fbe
--- /dev/null
+++ b/include/xercesc/dom/DOMTreeWalker.hpp
@@ -0,0 +1,276 @@
+/*
+ * 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: DOMTreeWalker.hpp 671894 2008-06-26 13:29:21Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMTREEWALKER_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMTREEWALKER_HPP
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+/**
+ * DOMTreeWalker objects are used to navigate a document tree or
+ * subtree using the view of the document defined by their
+ * whatToShow flags and filter (if any). Any function which
+ * performs navigation using a DOMTreeWalker will automatically
+ * support any view defined by a DOMTreeWalker.
+ * Omitting nodes from the logical view of a subtree can result in a
+ * structure that is substantially different from the same subtree in the
+ * complete, unfiltered document. Nodes that are siblings in the
+ * DOMTreeWalker view may be children of different, widely
+ * separated nodes in the original view. For instance, consider a
+ * DOMNodeFilter that skips all nodes except for DOMText nodes and
+ * the root node of a document. In the logical view that results, all text
+ * nodes will be siblings and appear as direct children of the root node, no
+ * matter how deeply nested the structure of the original document.
+ *
See also the Document Object Model (DOM) Level 2 Traversal and Range Specification.
+ *
+ * @since DOM Level 2
+ */
+class CDOM_EXPORT DOMTreeWalker {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMTreeWalker() {}
+ DOMTreeWalker(const DOMTreeWalker &) {}
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMTreeWalker & operator = (const DOMTreeWalker &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMTreeWalker() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMTreeWalker interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 2 */
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+
+ /**
+ * The root node of the DOMTreeWalker, as specified
+ * when it was created.
+ *
+ * @since DOM Level 2
+ */
+ virtual DOMNode* getRoot() = 0;
+ /**
+ * This attribute determines which node types are presented via the
+ * DOMTreeWalker. The available set of constants is defined in
+ * the DOMNodeFilter interface. Nodes not accepted by
+ * whatToShow will be skipped, but their children may still
+ * be considered. Note that this skip takes precedence over the filter,
+ * if any.
+ *
+ * @since DOM Level 2
+ */
+ virtual DOMNodeFilter::ShowType getWhatToShow()= 0;
+
+ /**
+ * Return The filter used to screen nodes.
+ *
+ * @since DOM Level 2
+ */
+ virtual DOMNodeFilter* getFilter()= 0;
+
+ /**
+ * The value of this flag determines whether the children of entity
+ * reference nodes are visible to the DOMTreeWalker. If false,
+ * these children and their descendants will be rejected. Note that
+ * this rejection takes precedence over whatToShow and the
+ * filter, if any.
+ *
To produce a view of the document that has entity references
+ * expanded and does not expose the entity reference node itself, use
+ * the whatToShow flags to hide the entity reference node
+ * and set expandEntityReferences to true when creating the
+ * DOMTreeWalker. To produce a view of the document that has
+ * entity reference nodes but no entity expansion, use the
+ * whatToShow flags to show the entity reference node and
+ * set expandEntityReferences to false.
+ *
+ * @since DOM Level 2
+ */
+ virtual bool getExpandEntityReferences()= 0;
+
+ /**
+ * Return the node at which the DOMTreeWalker is currently positioned.
+ *
+ * @since DOM Level 2
+ */
+ virtual DOMNode* getCurrentNode()= 0;
+
+ // -----------------------------------------------------------------------
+ // Query methods
+ // -----------------------------------------------------------------------
+ /**
+ * Moves to and returns the closest visible ancestor node of the current
+ * node. If the search for parentNode attempts to step
+ * upward from the DOMTreeWalker's root node, or
+ * if it fails to find a visible ancestor node, this method retains the
+ * current position and returns null.
+ * @return The new parent node, or null if the current node
+ * has no parent in the DOMTreeWalker's logical view.
+ *
+ * @since DOM Level 2
+ */
+ virtual DOMNode* parentNode()= 0;
+
+ /**
+ * Moves the DOMTreeWalker to the first visible child of the
+ * current node, and returns the new node. If the current node has no
+ * visible children, returns null, and retains the current
+ * node.
+ * @return The new node, or null if the current node has no
+ * visible children in the DOMTreeWalker's logical view.
+ *
+ * @since DOM Level 2
+ */
+ virtual DOMNode* firstChild()= 0;
+
+ /**
+ * Moves the DOMTreeWalker to the last visible child of the
+ * current node, and returns the new node. If the current node has no
+ * visible children, returns null, and retains the current
+ * node.
+ * @return The new node, or null if the current node has no
+ * children in the DOMTreeWalker's logical view.
+ *
+ * @since DOM Level 2
+ */
+ virtual DOMNode* lastChild()= 0;
+
+ /**
+ * Moves the DOMTreeWalker to the previous sibling of the
+ * current node, and returns the new node. If the current node has no
+ * visible previous sibling, returns null, and retains the
+ * current node.
+ * @return The new node, or null if the current node has no
+ * previous sibling. in the DOMTreeWalker's logical view.
+ *
+ * @since DOM Level 2
+ */
+ virtual DOMNode* previousSibling()= 0;
+
+ /**
+ * Moves the DOMTreeWalker to the next sibling of the current
+ * node, and returns the new node. If the current node has no visible
+ * next sibling, returns null, and retains the current node.
+ * @return The new node, or null if the current node has no
+ * next sibling. in the DOMTreeWalker's logical view.
+ *
+ * @since DOM Level 2
+ */
+ virtual DOMNode* nextSibling()= 0;
+
+ /**
+ * Moves the DOMTreeWalker to the previous visible node in
+ * document order relative to the current node, and returns the new
+ * node. If the current node has no previous node, or if the search for
+ * previousNode attempts to step upward from the
+ * DOMTreeWalker's root node, returns
+ * null, and retains the current node.
+ * @return The new node, or null if the current node has no
+ * previous node in the DOMTreeWalker's logical view.
+ *
+ * @since DOM Level 2
+ */
+ virtual DOMNode* previousNode()= 0;
+
+ /**
+ * Moves the DOMTreeWalker to the next visible node in document
+ * order relative to the current node, and returns the new node. If the
+ * current node has no next node, or if the search for nextNode attempts
+ * to step upward from the DOMTreeWalker's root
+ * node, returns null, and retains the current node.
+ * @return The new node, or null if the current node has no
+ * next node in the DOMTreeWalker's logical view.
+ *
+ * @since DOM Level 2
+ */
+ virtual DOMNode* nextNode()= 0;
+
+ // -----------------------------------------------------------------------
+ // Setter methods
+ // -----------------------------------------------------------------------
+ /**
+ * The node at which the DOMTreeWalker is currently positioned.
+ *
Alterations to the DOM tree may cause the current node to no longer
+ * be accepted by the DOMTreeWalker's associated filter.
+ * currentNode may also be explicitly set to any node,
+ * whether or not it is within the subtree specified by the
+ * root node or would be accepted by the filter and
+ * whatToShow flags. Further traversal occurs relative to
+ * currentNode even if it is not part of the current view,
+ * by applying the filters in the requested direction; if no traversal
+ * is possible, currentNode is not changed.
+ * @exception DOMException
+ * NOT_SUPPORTED_ERR: Raised if an attempt is made to set
+ * currentNode to null.
+ *
+ * @since DOM Level 2
+ */
+ virtual void setCurrentNode(DOMNode* currentNode)= 0;
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Non-standard Extension
+ // -----------------------------------------------------------------------
+ /** @name Non-standard Extension */
+ //@{
+ /**
+ * Called to indicate that this TreeWalker 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;
+ //@}
+};
+
+#define GetDOMTreeWalkerMemoryManager GET_INDIRECT_MM(fCurrentNode)
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMTypeInfo.hpp b/include/xercesc/dom/DOMTypeInfo.hpp
new file mode 100644
index 0000000..4e22b8d
--- /dev/null
+++ b/include/xercesc/dom/DOMTypeInfo.hpp
@@ -0,0 +1,196 @@
+/*
+ * 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.
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMTYPEINFO_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMTYPEINFO_HPP
+
+//------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------
+#include
+
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+/**
+ * The DOMTypeInfo interface represent a type used by
+ * DOMElement or DOMAttr nodes, specified in the
+ * schemas associated with the document. The type is a pair of a namespace URI
+ * and name properties, and depends on the document's schema.
+ */
+class CDOM_EXPORT DOMTypeInfo
+{
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMTypeInfo() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMTypeInfo(const DOMTypeInfo &);
+ DOMTypeInfo & operator = (const DOMTypeInfo &);
+ //@}
+
+public:
+
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMTypeInfo() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Class Types
+ // -----------------------------------------------------------------------
+ /** @name Public Contants */
+ //@{
+ /**
+ * These are the available values for the derivationMethod parameter used by the
+ * method DOMTypeInfo::isDerivedFrom(). It is a set of possible types
+ * of derivation, and the values represent bit positions. If a bit in the derivationMethod
+ * parameter is set to 1, the corresponding type of derivation will be taken into account
+ * when evaluating the derivation between the reference type definition and the other type
+ * definition. When using the isDerivedFrom method, combining all of them in the
+ * derivationMethod parameter is equivalent to invoking the method for each of them separately
+ * and combining the results with the OR boolean function. This specification only defines
+ * the type of derivation for XML Schema.
+ *
+ * In addition to the types of derivation listed below, please note that:
+ * - any type derives from xsd:anyType.
+ * - any simple type derives from xsd:anySimpleType by restriction.
+ * - any complex type does not derive from xsd:anySimpleType by restriction.
+ *
+ * DERIVATION_EXTENSION:
+ * If the document's schema is an XML Schema [XML Schema Part 1], this constant represents the
+ * derivation by extension. The reference type definition is derived by extension from the other
+ * type definition if the other type definition can be reached recursively following the
+ * {base type definition} property from the reference type definition, and at least one of the
+ * derivation methods involved is an extension.
+ *
+ * DERIVATION_LIST:
+ * If the document's schema is an XML Schema [XML Schema Part 1], this constant represents the list.
+ * The reference type definition is derived by list from the other type definition if there exists
+ * two type definitions T1 and T2 such as the reference type definition is derived from T1 by
+ * DERIVATION_RESTRICTION or DERIVATION_EXTENSION, T2 is derived from the other type definition by
+ * DERIVATION_RESTRICTION, T1 has {variety} list, and T2 is the {item type definition}. Note that
+ * T1 could be the same as the reference type definition, and T2 could be the same as the other
+ * type definition.
+ *
+ * DERIVATION_RESTRICTION:
+ * If the document's schema is an XML Schema [XML Schema Part 1], this constant represents the
+ * derivation by restriction if complex types are involved, or a restriction if simple types are
+ * involved.
+ * The reference type definition is derived by restriction from the other type definition if the
+ * other type definition is the same as the reference type definition, or if the other type definition
+ * can be reached recursively following the {base type definition} property from the reference type
+ * definition, and all the derivation methods involved are restriction.
+ *
+ * DERIVATION_UNION:
+ * If the document's schema is an XML Schema [XML Schema Part 1], this constant represents the union
+ * if simple types are involved.
+ * The reference type definition is derived by union from the other type definition if there exists
+ * two type definitions T1 and T2 such as the reference type definition is derived from T1 by
+ * DERIVATION_RESTRICTION or DERIVATION_EXTENSION, T2 is derived from the other type definition by
+ * DERIVATION_RESTRICTION, T1 has {variety} union, and one of the {member type definitions} is T2.
+ * Note that T1 could be the same as the reference type definition, and T2 could be the same as the
+ * other type definition.
+ *
+ * @since DOM Level 3
+ *
+ */
+ enum DerivationMethods {
+ DERIVATION_RESTRICTION = 0x001,
+ DERIVATION_EXTENSION = 0x002,
+ DERIVATION_UNION = 0x004,
+ DERIVATION_LIST = 0x008
+ };
+ //@}
+
+ //@{
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+ /**
+ * Returns The name of a type declared for the associated DOMElement
+ * or DOMAttr, or null if unknown.
+ *
+ * @return The name of a type declared for the associated DOMElement
+ * or DOMAttribute, or null if unknown.
+ * @since DOM level 3
+ */
+ virtual const XMLCh* getTypeName() const = 0;
+
+ /**
+ * The namespace of the type declared for the associated DOMElement
+ * or DOMAttr or null if the DOMElement does not have
+ * declaration or if no namespace information is available.
+ *
+ * @return The namespace of the type declared for the associated DOMElement
+ * or DOMAttr or null if the DOMElement does not have
+ * declaration or if no namespace information is available.
+ * @since DOM level 3
+ */
+ virtual const XMLCh* getTypeNamespace() const = 0;
+ //@}
+
+ //@{
+ /**
+ * This method returns if there is a derivation between the reference type definition,
+ * i.e. the DOMTypeInfo on which the method is being called, and the other type definition,
+ * i.e. the one passed as parameters.
+ *
+ * @param typeNamespaceArg The namespace of the other type definition.
+ * @param typeNameArg The name of the other type definition.
+ * @param derivationMethod The type of derivation and conditions applied between two types,
+ * as described in the list of constants provided in this interface.
+ * @return If the document's schema is a DTD or no schema is associated with the document,
+ * this method will always return false.
+ * If the document's schema is an XML Schema, the method will true if the reference
+ * type definition is derived from the other type definition according to the derivation
+ * parameter. If the value of the parameter is 0 (no bit is set to 1 for the
+ * derivationMethod parameter), the method will return true if the other type definition
+ * can be reached by recursing any combination of {base type definition},
+ * {item type definition}, or {member type definitions} from the reference type definition.
+ * @since DOM level 3
+ */
+ virtual bool isDerivedFrom(const XMLCh* typeNamespaceArg,
+ const XMLCh* typeNameArg,
+ DerivationMethods derivationMethod) const = 0;
+ //@}
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
+/**
+ * End of file DOMTypeInfo.hpp
+ */
diff --git a/include/xercesc/dom/DOMUserDataHandler.hpp b/include/xercesc/dom/DOMUserDataHandler.hpp
new file mode 100644
index 0000000..74c24dd
--- /dev/null
+++ b/include/xercesc/dom/DOMUserDataHandler.hpp
@@ -0,0 +1,140 @@
+/*
+ * 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: DOMUserDataHandler.hpp 527149 2007-04-10 14:56:39Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMUSERDATAHANDLER_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMUSERDATAHANDLER_HPP
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+/**
+ * When associating an object to a key on a node using setUserData
+ * the application can provide a handler that gets called when the node the
+ * object is associated to is being cloned or imported. This can be used by
+ * the application to implement various behaviors regarding the data it
+ * associates to the DOM nodes. This interface defines that handler.
+ *
+ * See also the Document Object Model (DOM) Level 3 Core Specification.
+ * @since DOM Level 3
+ */
+class CDOM_EXPORT DOMUserDataHandler {
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMUserDataHandler() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMUserDataHandler(const DOMUserDataHandler &);
+ DOMUserDataHandler & operator = (const DOMUserDataHandler &);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMUserDataHandler() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Class Types
+ // -----------------------------------------------------------------------
+ /** @name Public Constants */
+ //@{
+ /**
+ * Operation Type
+ *
+ *
NODE_CLONED:
+ * The node is cloned.
+ *
+ * NODE_IMPORTED
+ * The node is imported.
+ *
+ * NODE_DELETED
+ * The node is deleted.
+ *
+ * NODE_RENAMED
+ * The node is renamed.
+ *
+ *
NODE_ADOPTED
+ * The node is adopted.
+ *
+ * @since DOM Level 3
+ */
+ enum DOMOperationType {
+ NODE_CLONED = 1,
+ NODE_IMPORTED = 2,
+ NODE_DELETED = 3,
+ NODE_RENAMED = 4,
+ NODE_ADOPTED = 5
+ };
+ //@}
+
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMUserDataHandler interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+ /**
+ * This method is called whenever the node for which this handler is
+ * registered is imported or cloned.
+ *
+ * @param operation Specifies the type of operation that is being
+ * performed on the node.
+ * @param key Specifies the key for which this handler is being called.
+ * @param data Specifies the data for which this handler is being called.
+ * @param src Specifies the node being cloned, adopted, imported, or renamed.
+ * This is null when the node is being deleted.
+ * @param dst Specifies the node newly created if any, or null.
+ *
+ * @since DOM Level 3
+ */
+ virtual void handle(DOMOperationType operation,
+ const XMLCh* const key,
+ void* data,
+ const DOMNode* src,
+ DOMNode* dst) = 0;
+
+ //@}
+
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
diff --git a/include/xercesc/dom/DOMXPathEvaluator.hpp b/include/xercesc/dom/DOMXPathEvaluator.hpp
new file mode 100644
index 0000000..b491c7e
--- /dev/null
+++ b/include/xercesc/dom/DOMXPathEvaluator.hpp
@@ -0,0 +1,180 @@
+/*
+ * 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: DOMXPathEvaluator.hpp 698579 2008-09-24 14:13:08Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHEVALUATOR_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMXPATHEVALUATOR_HPP
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+class DOMXPathNSResolver;
+class DOMXPathExpression;
+class DOMNode;
+
+/**
+ * The evaluation of XPath expressions is provided by DOMXPathEvaluator.
+ * In a DOM implementation which supports the XPath feature, the DOMXPathEvaluator
+ * interface will be implemented on the same object which implements the Document interface permitting
+ * it to be obtained by casting or by using the DOM Level 3 getFeature method. In this case the
+ * implementation obtained from the Document supports the XPath DOM module and is compatible
+ * with the XPath 1.0 specification.
+ * Evaluation of expressions with specialized extension functions or variables may not
+ * work in all implementations and is, therefore, not portable. XPathEvaluator implementations
+ * may be available from other sources that could provide specific support for specialized extension
+ * functions or variables as would be defined by other specifications.
+ * @since DOM Level 3
+ */
+class CDOM_EXPORT DOMXPathEvaluator
+{
+
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMXPathEvaluator() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMXPathEvaluator(const DOMXPathEvaluator &);
+ DOMXPathEvaluator& operator = (const DOMXPathEvaluator&);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMXPathEvaluator() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMXPathEvaluator interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+
+ /**
+ * Creates a parsed XPath expression with resolved namespaces. This is useful
+ * when an expression will be reused in an application since it makes it
+ * possible to compile the expression string into a more efficient internal
+ * form and preresolve all namespace prefixes which occur within the expression.
+ * @param expression of type XMLCh - The XPath expression string to be parsed.
+ * @param resolver of type XPathNSResolver - The resolver permits
+ * translation of all prefixes, including the xml namespace prefix, within the XPath expression
+ * into appropriate namespace URIs. If this is specified as null, any namespace
+ * prefix within the expression will result in DOMException being thrown with the
+ * code NAMESPACE_ERR.
+ * @return DOMXPathExpression The compiled form of the XPath expression.
+ * @exception DOMXPathException
+ * INVALID_EXPRESSION_ERR: Raised if the expression is not legal according to the
+ * rules of the DOMXPathEvaluator.
+ * @exception DOMException
+ * NAMESPACE_ERR: Raised if the expression contains namespace prefixes which cannot
+ * be resolved by the specified XPathNSResolver.
+ * @since DOM Level 3
+ */
+ virtual DOMXPathExpression* createExpression(const XMLCh *expression,
+ const DOMXPathNSResolver *resolver) = 0;
+
+
+ /** Adapts any DOM node to resolve namespaces so that an XPath expression can be
+ * easily evaluated relative to the context of the node where it appeared within
+ * the document. This adapter works like the DOM Level 3 method lookupNamespaceURI
+ * on nodes in resolving the namespaceURI from a given prefix using the current
+ * information available in the node's hierarchy at the time lookupNamespaceURI
+ * is called. also correctly resolving the implicit xml prefix.
+ * @param nodeResolver of type DOMNode The node to be used as a context
+ * for namespace resolution. If this parameter is null, an unpopulated
+ * DOMXPathNSResolver is returned, which can be populated using the
+ * Xerces-C extension DOMXPathNSResolver::addNamespaceBinding().
+ * @return DOMXPathNSResolver The object which resolves namespaces
+ * with respect to the definitions in scope for the specified node.
+ */
+ virtual DOMXPathNSResolver* createNSResolver(const DOMNode *nodeResolver) = 0;
+
+
+ /**
+ * Evaluates an XPath expression string and returns a result of the specified
+ * type if possible.
+ * @param expression of type XMLCh The XPath expression string to be parsed
+ * and evaluated.
+ * @param contextNode of type DOMNode The context is context node
+ * for the evaluation
+ * of this XPath expression. If the DOMXPathEvaluator was obtained by
+ * casting the DOMDocument then this must be owned by the same
+ * document and must be a DOMDocument, DOMElement,
+ * DOMAttribute, DOMText, DOMCDATASection,
+ * DOMComment, DOMProcessingInstruction, or
+ * XPathNamespace node. If the context node is a DOMText or
+ * a DOMCDATASection, then the context is interpreted as the whole
+ * logical text node as seen by XPath, unless the node is empty in which case it
+ * may not serve as the XPath context.
+ * @param resolver of type XPathNSResolver The resolver permits
+ * translation of all prefixes, including the xml namespace prefix, within
+ * the XPath expression into appropriate namespace URIs. If this is specified
+ * as null, any namespace prefix within the expression will result in
+ * DOMException being thrown with the code NAMESPACE_ERR.
+ * @param type - If a specific type is specified, then
+ * the result will be returned as the corresponding type. This must be one
+ * of the codes of the DOMXPathResult interface.
+ * @param result of type DOMXPathResult* - The result specifies a specific result object
+ * which may be reused and returned by this method. If this is specified as
+ * null or the implementation does not reuse the specified result, a new result
+ * object will be constructed and returned.
+ * @return DOMXPathResult* The result of the evaluation of the XPath expression.
+ * @exception DOMXPathException
+ * INVALID_EXPRESSION_ERR: Raised if the expression is not legal
+ * according to the rules of the DOMXPathEvaluator
+ * TYPE_ERR: Raised if the result cannot be converted to return the specified type.
+ * @exception DOMException
+ * NAMESPACE_ERR: Raised if the expression contains namespace prefixes
+ * which cannot be resolved by the specified XPathNSResolver.
+ * WRONG_DOCUMENT_ERR: The DOMNode is from a document that is not supported
+ * by this DOMXPathEvaluator.
+ * NOT_SUPPORTED_ERR: The DOMNode is not a type permitted as an XPath context
+ * node or the request type is not permitted by this DOMXPathEvaluator.
+ */
+ virtual DOMXPathResult* evaluate(const XMLCh *expression,
+ const DOMNode *contextNode,
+ const DOMXPathNSResolver *resolver,
+ DOMXPathResult::ResultType type,
+ DOMXPathResult* result) = 0;
+
+ //@}
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMXPathException.cpp b/include/xercesc/dom/DOMXPathException.cpp
new file mode 100644
index 0000000..8e4877e
--- /dev/null
+++ b/include/xercesc/dom/DOMXPathException.cpp
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+
+#include "DOMXPathException.hpp"
+#include
+#include
+#include
+#include "impl/DOMImplementationImpl.hpp"
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+DOMXPathException::DOMXPathException()
+: DOMException()
+{
+}
+
+
+DOMXPathException::DOMXPathException(short exCode,
+ short messageCode,
+ MemoryManager* const memoryManager)
+: DOMException(exCode, messageCode?messageCode:XMLDOMMsg::DOMXPATHEXCEPTION_ERRX+exCode-DOMXPathException::INVALID_EXPRESSION_ERR+1, memoryManager)
+{
+}
+
+
+DOMXPathException::DOMXPathException(const DOMXPathException &other)
+: DOMException(other)
+{
+}
+
+
+DOMXPathException::~DOMXPathException()
+{
+}
+
+XERCES_CPP_NAMESPACE_END
diff --git a/include/xercesc/dom/DOMXPathException.hpp b/include/xercesc/dom/DOMXPathException.hpp
new file mode 100644
index 0000000..3ad187e
--- /dev/null
+++ b/include/xercesc/dom/DOMXPathException.hpp
@@ -0,0 +1,105 @@
+/*
+ * 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: DOMXPathException.hpp 671894 2008-06-26 13:29:21Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHEXCEPTION_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMXPATHEXCEPTION_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+/**
+ * @since DOM Level 3
+ */
+class CDOM_EXPORT DOMXPathException : public DOMException
+{
+public:
+ //@{
+ /**
+ * ExceptionCode
+ *
INVALID_EXPRESSION_ERR The expression has a syntax error or otherwise
+ * is not a legal expression according to the rules of the specific
+ * DOMXPathEvaluator or contains specialized extension functions
+ * or variables not supported by this implementation.
+ *
TYPE_ERR The expression cannot be converted to return the specified type.
+ *
NO_RESULT_ERROR There is no current result in the result object.
+ */
+ enum ExceptionCode {
+ INVALID_EXPRESSION_ERR = 51,
+ TYPE_ERR = 52,
+ NO_RESULT_ERROR = 53
+ };
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // Constructors
+ // -----------------------------------------------------------------------
+ /** @name Constructors */
+ //@{
+ /**
+ * Default constructor for DOMXPathException.
+ *
+ */
+ DOMXPathException();
+
+ /**
+ * Constructor which takes an error code and a message.
+ *
+ * @param code The error code which indicates the exception
+ * @param messageCode The string containing the error message
+ * @param memoryManager The memory manager used to (de)allocate memory
+ */
+ DOMXPathException(short code,
+ short messageCode = 0,
+ MemoryManager* const memoryManager = XMLPlatformUtils::fgMemoryManager);
+
+ /**
+ * Copy constructor.
+ *
+ * @param other The object to be copied.
+ */
+ DOMXPathException(const DOMXPathException &other);
+
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Destructors
+ // -----------------------------------------------------------------------
+ /** @name Destructor. */
+ //@{
+ /**
+ * Destructor for DOMXPathException.
+ *
+ */
+ virtual ~DOMXPathException();
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ DOMXPathException& operator = (const DOMXPathException&);
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMXPathExpression.hpp b/include/xercesc/dom/DOMXPathExpression.hpp
new file mode 100644
index 0000000..0bf34b2
--- /dev/null
+++ b/include/xercesc/dom/DOMXPathExpression.hpp
@@ -0,0 +1,129 @@
+/*
+ * 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: DOMXPathExpression.hpp 698579 2008-09-24 14:13:08Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHEXPRESSION_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMXPATHEXPRESSION_HPP
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+class DOMNode;
+
+/**
+ * The DOMXPathExpression interface represents a parsed and resolved XPath expression.
+ * @since DOM Level 3
+ */
+class CDOM_EXPORT DOMXPathExpression
+{
+
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMXPathExpression() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMXPathExpression(const DOMXPathExpression &);
+ DOMXPathExpression& operator = (const DOMXPathExpression&);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMXPathExpression() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMXPathExpression interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+
+ /**
+ * Evaluates this XPath expression and returns a result.
+ * @param contextNode of type DOMNode The context is context
+ * node for the evaluation of this XPath expression.
+ * If the XPathEvaluator was obtained by casting the Document then this must
+ * be owned by the same document and must be a DOMDocument, DOMElement,
+ * DOMAttribute, DOMText, DOMCDATASection,
+ * DOMComment, DOMProcessingInstruction, or
+ * XPathNamespace. If the context node is a DOMText or a
+ * DOMCDATASection, then the context is interpreted as the whole logical
+ * text node as seen by XPath, unless the node is empty in which case it may not
+ * serve as the XPath context.
+ * @param type If a specific type is specified, then the result
+ * will be coerced to return the specified type relying on XPath conversions and fail
+ * if the desired coercion is not possible. This must be one of the type codes of DOMXPathResult.
+ * @param result of type DOMXPathResult* The result specifies a specific result object which
+ * may be reused and returned by this method. If this is specified as nullor the
+ * implementation does not reuse the specified result, a new result object will be constructed
+ * and returned.
+ * @return DOMXPathResult* The result of the evaluation of the XPath expression.
+ * @exception DOMXPathException
+ * TYPE_ERR: Raised if the result cannot be converted to return the specified type.
+ * @exception DOMException
+ * WRONG_DOCUMENT_ERR: The DOMNode is from a document that is not supported by
+ * the XPathEvaluator that created this DOMXPathExpression.
+ * NOT_SUPPORTED_ERR: The DOMNode is not a type permitted as an XPath context node or the
+ * request type is not permitted by this DOMXPathExpression.
+ */
+
+ virtual DOMXPathResult* evaluate(const DOMNode *contextNode,
+ DOMXPathResult::ResultType type,
+ DOMXPathResult* result) const = 0;
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Non-standard Extension
+ // -----------------------------------------------------------------------
+ /** @name Non-standard Extension */
+ //@{
+ /**
+ * Called to indicate that this DOMXPathExpression 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
diff --git a/include/xercesc/dom/DOMXPathNSResolver.hpp b/include/xercesc/dom/DOMXPathNSResolver.hpp
new file mode 100644
index 0000000..b12d5a8
--- /dev/null
+++ b/include/xercesc/dom/DOMXPathNSResolver.hpp
@@ -0,0 +1,130 @@
+/*
+ * 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: DOMXPathNSResolver.hpp 698579 2008-09-24 14:13:08Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHNSRESOLVER_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMXPATHNSRESOLVER_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+/**
+ * The DOMXPathNSResolver interface permit prefix strings
+ * in the expression to be properly bound to namespaceURI strings.
+ * DOMXPathEvaluator can construct an implementation of
+ * DOMXPathNSResolver from a node, or the interface may be
+ * implemented by any application.
+ * @since DOM Level 3
+ */
+class CDOM_EXPORT DOMXPathNSResolver
+{
+
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMXPathNSResolver() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMXPathNSResolver(const DOMXPathNSResolver &);
+ DOMXPathNSResolver& operator = (const DOMXPathNSResolver&);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMXPathNSResolver() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMDocument interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+
+ /** Look up the namespace URI associated to the given namespace prefix.
+ *
+ * @param prefix of type XMLCh - The prefix to look for. An empty or
+ * null string denotes the default namespace.
+ * @return the associated namespace URI or null if none is found.
+ */
+ virtual const XMLCh* lookupNamespaceURI(const XMLCh* prefix) const = 0;
+ //@}
+
+
+ // -----------------------------------------------------------------------
+ // Non-standard extension
+ // -----------------------------------------------------------------------
+ /** @name Non-standard extension */
+ //@{
+
+ /**
+ * Non-standard extension
+ *
+ * XPath2 implementations require a reverse lookup in the static context.
+ * Look up the prefix associated with the namespace URI
+ * @param URI of type XMLCh - The namespace to look for.
+ * @return the associated prefix which can be an empty string if this
+ * is a default namespace or null if none is found.
+ */
+ virtual const XMLCh* lookupPrefix(const XMLCh* URI) const = 0;
+
+ /**
+ * Non-standard extension
+ *
+ * Associate the given namespace prefix to the namespace URI.
+ * @param prefix of type XMLCh - The namespace prefix to bind. An empty
+ * or null string denotes the default namespace.
+ * @param uri of type XMLCh - The associated namespace URI. If this
+ * argument is null or an empty string then the existing binding for this
+ * prefix is removed.
+ */
+ virtual void addNamespaceBinding(const XMLCh* prefix, const XMLCh* uri) = 0;
+
+ /**
+ * Called to indicate that this object (and its associated children) is no longer in use
+ * and that the implementation may relinquish any resources associated with it and
+ * its associated children.
+ *
+ * Access to a released object will lead to unexpected result.
+ */
+ virtual void release() = 0;
+
+ //@}
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMXPathNamespace.hpp b/include/xercesc/dom/DOMXPathNamespace.hpp
new file mode 100644
index 0000000..ae62341
--- /dev/null
+++ b/include/xercesc/dom/DOMXPathNamespace.hpp
@@ -0,0 +1,115 @@
+/*
+ * 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: DOMXPathNamespace.hpp 932887 2010-04-11 13:04:59Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHNAMESPACE_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMXPATHNAMESPACE_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+class DOMElement;
+
+/**
+ * The DOMXPathNamespace interface is returned by DOMXPathResult
+ * interfaces to represent the XPath namespace node type that DOM lacks. There is no
+ * public constructor for this node type. Attempts to place it into a hierarchy or a
+ * NamedNodeMap result in a DOMException with the code HIERARCHY_REQUEST_ERR. This node
+ * is read only, so methods or setting of attributes that would mutate the node result
+ * in a DOMException with the code NO_MODIFICATION_ALLOWED_ERR.
+ * The core specification describes attributes of the DOMNode interface that
+ * are different for different node types but does not describe XPATH_NAMESPACE_NODE,
+ * so here is a description of those attributes for this node type. All attributes of
+ * DOMNode not described in this section have a null or false value.
+ * ownerDocument matches the ownerDocument of the ownerElement even if the element is later adopted.
+ * nodeName is always the string "#namespace".
+ * prefix is the prefix of the namespace represented by the node.
+ * localName is the same as prefix.
+ * nodeType is equal to XPATH_NAMESPACE_NODE.
+ * namespaceURI is the namespace URI of the namespace represented by the node.
+ * nodeValue is the same as namespaceURI.
+ * adoptNode, cloneNode, and importNode fail on this node type by raising a DOMException with the code NOT_SUPPORTED_ERR.
+ * Note: In future versions of the XPath specification, the definition of a namespace node may
+ * be changed incompatibly, in which case incompatible changes to field values may be required to
+ * implement versions beyond XPath 1.0.
+ * @since DOM Level 3
+ */
+class CDOM_EXPORT DOMXPathNamespace : public DOMNode
+{
+
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMXPathNamespace() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMXPathNamespace(const DOMXPathNamespace &);
+ DOMXPathNamespace& operator = (const DOMXPathNamespace&);
+ //@}
+
+public:
+
+
+ enum XPathNodeType {
+ XPATH_NAMESPACE_NODE = 13
+ };
+
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMXPathNamespace() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMXPathNamespace interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+ /**
+ * The DOMElement on which the namespace was in scope when
+ * it was requested. This does not change on a returned namespace node
+ * even if the document changes such that the namespace goes out of
+ * scope on that element and this node is no longer found there by XPath.
+ * @since DOM Level 3
+ */
+ virtual DOMElement *getOwnerElement() const = 0;
+
+ //@}
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/DOMXPathResult.hpp b/include/xercesc/dom/DOMXPathResult.hpp
new file mode 100644
index 0000000..2e35eb3
--- /dev/null
+++ b/include/xercesc/dom/DOMXPathResult.hpp
@@ -0,0 +1,351 @@
+/*
+ * 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: DOMXPathResult.hpp 932887 2010-04-11 13:04:59Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMXPATHRESULT_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMXPATHRESULT_HPP
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+class DOMXPathNSResolver;
+class DOMXPathExpression;
+class DOMTypeInfo;
+class DOMNode;
+
+/**
+ * The DOMXPathResult interface represents the result of the
+ * evaluation of an XPath 1.0 or XPath 2.0 expression within the context
+ * of a particular node. Since evaluation of an XPath expression can result
+ * in various result types, this object makes it possible to discover and
+ * manipulate the type and value of the result.
+ *
+ * Note that some function signatures were changed compared to the
+ * DOM Level 3 in order to accommodate XPath 2.0.
+ *
+ * @since DOM Level 3
+ */
+class CDOM_EXPORT DOMXPathResult
+{
+
+protected:
+ // -----------------------------------------------------------------------
+ // Hidden constructors
+ // -----------------------------------------------------------------------
+ /** @name Hidden constructors */
+ //@{
+ DOMXPathResult() {};
+ //@}
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ /** @name Unimplemented constructors and operators */
+ //@{
+ DOMXPathResult(const DOMXPathResult &);
+ DOMXPathResult& operator = (const DOMXPathResult&);
+ //@}
+
+public:
+ // -----------------------------------------------------------------------
+ // All constructors are hidden, just the destructor is available
+ // -----------------------------------------------------------------------
+ /** @name Destructor */
+ //@{
+ /**
+ * Destructor
+ *
+ */
+ virtual ~DOMXPathResult() {};
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Class Types
+ // -----------------------------------------------------------------------
+ /** @name Public Constants */
+ //@{
+ /**
+ * ANY_TYPE
+ *
[XPath 1.0] This code does not represent a specific type. An evaluation of an XPath
+ * expression will never produce this type. If this type is requested, then
+ * the evaluation returns whatever type naturally results from evaluation
+ * of the expression.
+ * If the natural result is a node set when ANY_TYPE was requested, then
+ * UNORDERED_NODE_ITERATOR_TYPE is always the resulting type. Any other
+ * representation of a node set must be explicitly requested.
+ *
ANY_UNORDERED_NODE_TYPE
+ *
[XPath 1.0] The result is a node set as defined by XPath 1.0 and will be accessed
+ * as a single node, which may be null if the node set is empty. Document
+ * modification does not invalidate the node, but may mean that the result
+ * node no longer corresponds to the current document. This is a convenience
+ * that permits optimization since the implementation can stop once any node
+ * in the resulting set has been found.
+ * If there is more than one node in the actual result, the single node
+ * returned might not be the first in document order.
+ *
BOOLEAN_TYPE
+ *
[XPath 1.0] The result is a boolean as defined by XPath 1.0. Document modification
+ * does not invalidate the boolean, but may mean that reevaluation would not
+ * yield the same boolean.
+ *
FIRST_ORDERED_NODE_TYPE
+ *
[XPath 1.0] The result is a node set as defined by XPath 1.0 and will be accessed
+ * as a single node, which may be null if the node set is empty. Document
+ * modification does not invalidate the node, but may mean that the result
+ * node no longer corresponds to the current document. This is a convenience
+ * that permits optimization since the implementation can stop once the first
+ * node in document order of the resulting set has been found.
+ * If there are more than one node in the actual result, the single node
+ * returned will be the first in document order.
+ *
NUMBER_TYPE
+ *
[XPath 1.0] The result is a number as defined by XPath 1.0. Document modification does
+ * not invalidate the number, but may mean that reevaluation would not yield the
+ * same number.
+ *
ORDERED_NODE_ITERATOR_TYPE
+ *
[XPath 1.0] The result is a node set as defined by XPath 1.0 that will be accessed
+ * iteratively, which will produce document-ordered nodes. Document modification
+ * invalidates the iteration.
+ *
ORDERED_NODE_SNAPSHOT_TYPE
+ *
[XPath 1.0] The result is a node set as defined by XPath 1.0 that will be accessed as a
+ * snapshot list of nodes that will be in original document order. Document
+ * modification does not invalidate the snapshot but may mean that reevaluation would
+ * not yield the same snapshot and nodes in the snapshot may have been altered, moved,
+ * or removed from the document.
+ *
STRING_TYPE
+ *
[XPath 1.0] The result is a string as defined by XPath 1.0. Document modification does not
+ * invalidate the string, but may mean that the string no longer corresponds to the
+ * current document.
+ *
UNORDERED_NODE_ITERATOR_TYPE
+ *
[XPath 1.0] The result is a node set as defined by XPath 1.0 that will be accessed iteratively,
+ * which may not produce nodes in a particular order. Document modification invalidates the iteration.
+ * This is the default type returned if the result is a node set and ANY_TYPE is requested.
+ *
UNORDERED_NODE_SNAPSHOT_TYPE
+ *
[XPath 1.0] The result is a node set as defined by XPath 1.0 that will be accessed as a
+ * snapshot list of nodes that may not be in a particular order. Document modification
+ * does not invalidate the snapshot but may mean that reevaluation would not yield the same
+ * snapshot and nodes in the snapshot may have been altered, moved, or removed from the document.
+ *
FIRST_RESULT_TYPE
+ *
[XPath 2.0] The result is a sequence as defined by XPath 2.0 and will be accessed
+ * as a single current value or there will be no current value if the sequence
+ * is empty. Document modification does not invalidate the value, but may mean
+ * that the result no longer corresponds to the current document. This is a
+ * convenience that permits optimization since the implementation can stop once
+ * the first item in the resulting sequence has been found. If there is more
+ * than one item in the actual result, the single item returned might not be
+ * the first in document order.
+ *
ITERATOR_RESULT_TYPE
+ *
[XPath 2.0] The result is a sequence as defined by XPath 2.0 that will be accessed
+ * iteratively. Document modification invalidates the iteration.
+ *
SNAPSHOT_RESULT_TYPE
+ *
[XPath 2.0] The result is a sequence as defined by XPath 2.0 that will be accessed
+ * as a snapshot list of values. Document modification does not invalidate the
+ * snapshot but may mean that reevaluation would not yield the same snapshot
+ * and any items in the snapshot may have been altered, moved, or removed from
+ * the document.
+ */
+ enum ResultType {
+ /* XPath 1.0 */
+ ANY_TYPE = 0,
+ NUMBER_TYPE = 1,
+ STRING_TYPE = 2,
+ BOOLEAN_TYPE = 3,
+ UNORDERED_NODE_ITERATOR_TYPE = 4,
+ ORDERED_NODE_ITERATOR_TYPE = 5,
+ UNORDERED_NODE_SNAPSHOT_TYPE = 6,
+ ORDERED_NODE_SNAPSHOT_TYPE = 7,
+ ANY_UNORDERED_NODE_TYPE = 8,
+ FIRST_ORDERED_NODE_TYPE = 9,
+ /* XPath 2.0 */
+ FIRST_RESULT_TYPE = 100,
+ ITERATOR_RESULT_TYPE = 101,
+ SNAPSHOT_RESULT_TYPE = 102
+ };
+ //@}
+
+
+ // -----------------------------------------------------------------------
+ // Virtual DOMXPathResult interface
+ // -----------------------------------------------------------------------
+ /** @name Functions introduced in DOM Level 3 */
+ //@{
+
+ /**
+ * Returns the result type of this result
+ * @return ResultType
+ * A code representing the type of this result, as defined by the type constants.
+ */
+ virtual ResultType getResultType() const = 0;
+
+ /**
+ * Returns the DOM type info of the current result node or value
+ * (XPath 2 only).
+ * @return typeInfo of type TypeInfo, readonly
+ */
+ virtual const DOMTypeInfo *getTypeInfo() const = 0;
+
+ /**
+ * Returns true if the result has a current result and the value is a
+ * node (XPath 2 only). This function is necessary to distinguish
+ * between a string value and a node of type string as returned by
+ * the getTypeInfo() function.
+ * @return isNode of type boolean, readonly
+ */
+ virtual bool isNode() const = 0;
+
+ /**
+ * Returns the boolean value of this result
+ * @return booleanValue of type boolean
+ * The value of this boolean result.
+ * @exception DOMXPathException
+ * TYPE_ERR: raised if ResultType is not BOOLEAN_TYPE (XPath 1.0) or
+ * if current result cannot be properly converted to boolean (XPath 2.0).
+ *
+ * NO_RESULT_ERROR: raised if there is no current result in the result object (XPath 2.0).
+ */
+ virtual bool getBooleanValue() const = 0;
+
+ /**
+ * Returns the integer value of this result (XPath 2 only).
+ * @return integerValue of type int
+ * The value of this integer result.
+ * @exception DOMXPathException
+ * TYPE_ERR: raised if current result cannot be properly converted to
+ * int (XPath 2.0).
+ *
+ * NO_RESULT_ERROR: raised if there is no current result in the result object (XPath 2.0).
+ */
+ virtual int getIntegerValue() const = 0;
+
+ /**
+ * Returns the number value of this result
+ * @return numberValue
+ * The value of this number result. If the native double type of the DOM
+ * binding does not directly support the exact IEEE 754 result of the XPath
+ * expression, then it is up to the definition of the binding to specify how
+ * the XPath number is converted to the native binding number.
+ * @exception DOMXPathException
+ * TYPE_ERR: raised if ResultType is not NUMBER_TYPE (XPath 1.0) or
+ * if current result cannot be properly converted to double (XPath 2.0).
+ *
+ * NO_RESULT_ERROR: raised if there is no current result in the result object (XPath 2.0).
+ */
+ virtual double getNumberValue() const = 0;
+
+ /**
+ * Returns the string value of this result
+ * @return stringValue
+ * The value of this string result.
+ * @exception DOMXPathException
+ * TYPE_ERR: raised if ResultType is not STRING_TYPE (XPath 1.0) or
+ * if current result cannot be properly converted to string (XPath 2.0).
+ *
+ * NO_RESULT_ERROR: raised if there is no current result in the result object (XPath 2.0).
+ */
+ virtual const XMLCh* getStringValue() const = 0;
+
+ /**
+ * Returns the node value of this result
+ * @return nodeValue
+ * The value of this node result, which may be null.
+ * @exception DOMXPathException
+ * TYPE_ERR: raised if ResultType is not ANY_UNORDERED_NODE_TYPE,
+ * FIRST_ORDERED_NODE_TYPE, UNORDERED_NODE_ITERATOR_TYPE,
+ * ORDERED_NODE_ITERATOR_TYPE, UNORDERED_NODE_SNAPSHOT_TYPE, or
+ * ORDERED_NODE_SNAPSHOT_TYPE (XPath 1.0) or if current result is
+ * not a node (XPath 2.0).
+ *
+ * NO_RESULT_ERROR: raised if there is no current result in the result
+ * object.
+ */
+ virtual DOMNode* getNodeValue() const = 0;
+
+ /**
+ * Iterates and returns true if the current result is the next item from the
+ * sequence or false if there are no more items.
+ * @return boolean True if the current result is the next item from the sequence
+ * or false if there are no more items.
+ * @exception XPathException
+ * TYPE_ERR: raised if ResultType is not UNORDERED_NODE_ITERATOR_TYPE or
+ * ORDERED_NODE_ITERATOR_TYPE (XPath 1.0) or if ResultType is not
+ * ITERATOR_RESULT_TYPE (XPath 2.0).
+ * @exception DOMException
+ * INVALID_STATE_ERR: The document has been mutated since the result was returned.
+ */
+ virtual bool iterateNext() = 0;
+
+ /**
+ * Signifies that the iterator has become invalid.
+ * @return invalidIteratorState
+ * True if ResultType is UNORDERED_NODE_ITERATOR_TYPE or
+ * ORDERED_NODE_ITERATOR_TYPE (XPath 1.0) or ITERATOR_RESULT_TYPE (XPath 2.0)
+ * and the document has been modified since this result was returned.
+ * @exception XPathException
+ * TYPE_ERR: raised if ResultType is not UNORDERED_NODE_ITERATOR_TYPE or
+ * ORDERED_NODE_ITERATOR_TYPE (XPath 1.0) or if ResultType is not
+ * ITERATOR_RESULT_TYPE (XPath 2.0).
+ */
+ virtual bool getInvalidIteratorState() const = 0;
+
+ /**
+ * Sets the current result to the indexth item in the snapshot collection. If
+ * index is greater than or equal to the number of items in the list, this method
+ * returns false. Unlike the iterator result, the snapshot does not become
+ * invalid, but may not correspond to the current document if it is mutated.
+ * @param index of type XMLSize_t - Index into the snapshot collection.
+ * @return boolean True if the current result is the next item from the sequence
+ * or false if there are no more items.
+ * @exception XPathException
+ * TYPE_ERR: raised if ResultType is not UNORDERED_NODE_SNAPSHOT_TYPE or
+ * ORDERED_NODE_SNAPSHOT_TYPE (XPath 1.0) or if ResultType is not
+ * SNAPSHOT_RESULT_TYPE (XPath 2.0).
+ */
+ virtual bool snapshotItem(XMLSize_t index) = 0;
+
+ /**
+ * The number of items in the result snapshot. Valid values for snapshotItem
+ * indices are 0 to snapshotLength-1 inclusive.
+ * @return snapshotLength of type XMLSize_t
+ * @exception XPathException
+ * TYPE_ERR: raised if ResultType is not UNORDERED_NODE_SNAPSHOT_TYPE or
+ * ORDERED_NODE_SNAPSHOT_TYPE (XPath 1.0) or if ResultType is not
+ * SNAPSHOT_RESULT_TYPE (XPath 2.0).
+ */
+ virtual XMLSize_t getSnapshotLength() const = 0;
+
+ //@}
+
+ // -----------------------------------------------------------------------
+ // Non-standard Extension
+ // -----------------------------------------------------------------------
+ /** @name Non-standard Extension */
+ //@{
+ /**
+ * Called to indicate that this DOMXPathResult 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
diff --git a/include/xercesc/dom/StDOMNode.hpp b/include/xercesc/dom/StDOMNode.hpp
new file mode 100644
index 0000000..c28248a
--- /dev/null
+++ b/include/xercesc/dom/StDOMNode.hpp
@@ -0,0 +1,95 @@
+/*
+ * 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: StDOMNode.hpp 570480 2007-08-28 16:36:34Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_STDOMNODE_HPP)
+#define XERCESC_INCLUDE_GUARD_STDOMNODE_HPP
+
+#include
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+/* This class is a smart pointer implementation over DOMNode interface and
+** classes derived from it. It takes care of reference counting automatically.
+** Reference counting is optional so use of this class is experimental.
+*/
+template class StDOMNode {
+ T* m_node;
+
+ static inline void INCREFCOUNT(T *x) { if (x != (T*)0) x->incRefCount(); }
+ static inline void DECREFCOUNT(T *x) { if (x != (T*)0) x->decRefCount(); }
+
+public:
+ inline StDOMNode(T* node = (T*)0) : m_node(node) { INCREFCOUNT(m_node); }
+ inline StDOMNode(const StDOMNode& stNode) : m_node(stNode.m_node) { INCREFCOUNT(m_node); }
+ inline ~StDOMNode() { DECREFCOUNT(m_node); }
+
+ inline T* operator= (T *node)
+ {
+ if (m_node != node) {
+ DECREFCOUNT(m_node);
+ m_node = node;
+ INCREFCOUNT(m_node);
+ }
+ return (m_node);
+ }
+
+ inline bool operator!= (T* node) const { return (m_node != node); }
+ inline bool operator== (T* node) const { return (m_node == node); }
+
+ inline T& operator* () { return (*m_node); }
+ inline const T& operator* () const { return (*m_node); }
+ inline T* operator-> () const { return (m_node); }
+ inline operator T*() const { return (m_node); }
+ inline void ClearNode() { operator=((T*)(0)); }
+};
+
+#if defined(XML_DOMREFCOUNT_EXPERIMENTAL)
+ typedef StDOMNode DOMNodeSPtr;
+#else
+ typedef DOMNode* DOMNodeSPtr;
+#endif
+
+/* StDOMNode is a smart pointer implementation over DOMNode interface and
+** classes derived from it. It takes care of reference counting automatically.
+** Reference counting is optional so use of this class is experimental.
+*/
+#if defined(XML_DOMREFCOUNT_EXPERIMENTAL)
+ typedef StDOMNode DOMAttrSPtr;
+#else
+ typedef DOMAttr* DOMAttrSPtr;
+#endif
+
+/* StDOMNode is a smart pointer implementation over DOMNode interface and
+** classes derived from it. It takes care of reference counting automatically.
+** Reference counting is optional so use of this class is experimental.
+*/
+#if defined(XML_DOMREFCOUNT_EXPERIMENTAL)
+ typedef StDOMNode DOMElementSPtr;
+#else
+ typedef DOMElement* DOMElementSPtr;
+#endif
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
diff --git a/include/xercesc/dom/impl/DOMAttrImpl.cpp b/include/xercesc/dom/impl/DOMAttrImpl.cpp
new file mode 100644
index 0000000..7bd1409
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMAttrImpl.cpp
@@ -0,0 +1,362 @@
+/*
+ * 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: DOMAttrImpl.cpp 678709 2008-07-22 10:56:56Z borisk $
+ */
+
+#include
+#include
+
+#include "DOMAttrImpl.hpp"
+#include "DOMStringPool.hpp"
+#include "DOMDocumentImpl.hpp"
+#include "DOMCasts.hpp"
+#include "DOMTypeInfoImpl.hpp"
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+DOMAttrImpl::DOMAttrImpl(DOMDocument *ownerDoc, const XMLCh *aName)
+ : fNode(ownerDoc), fParent (ownerDoc), fSchemaType(0)
+{
+ DOMDocumentImpl *docImpl = (DOMDocumentImpl *)ownerDoc;
+ fName = docImpl->getPooledString(aName);
+ fNode.isSpecified(true);
+}
+
+DOMAttrImpl::DOMAttrImpl(const DOMAttrImpl &other, bool /*deep*/)
+ : DOMAttr(other)
+ , fNode(other.fNode)
+ , fParent (other.fParent)
+ , fName(other.fName)
+ , fSchemaType(other.fSchemaType)
+{
+ if (other.fNode.isSpecified())
+ fNode.isSpecified(true);
+ else
+ fNode.isSpecified(false);
+
+ if (other.fNode.isIdAttr())
+ {
+ fNode.isIdAttr(true);
+ DOMDocumentImpl *doc = (DOMDocumentImpl *)fParent.fOwnerDocument;
+ doc->getNodeIDMap()->add(this);
+ }
+
+ fParent.cloneChildren(&other);
+}
+
+
+DOMAttrImpl::~DOMAttrImpl() {
+}
+
+
+DOMNode * DOMAttrImpl::cloneNode(bool deep) const
+{
+ DOMNode* newNode = new (fParent.fOwnerDocument, DOMDocumentImpl::ATTR_OBJECT) DOMAttrImpl(*this, deep);
+ fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode);
+ return newNode;
+}
+
+
+const XMLCh * DOMAttrImpl::getNodeName() const{
+ return fName;
+}
+
+DOMNode::NodeType DOMAttrImpl::getNodeType() const {
+ return DOMNode::ATTRIBUTE_NODE;
+}
+
+
+const XMLCh * DOMAttrImpl::getName() const {
+ return fName;
+}
+
+
+const XMLCh * DOMAttrImpl::getNodeValue() const
+{
+ return getValue();
+}
+
+
+bool DOMAttrImpl::getSpecified() const
+{
+ return fNode.isSpecified();
+}
+
+
+
+
+const XMLCh * DOMAttrImpl::getValue() const
+{
+ if (fParent.fFirstChild == 0) {
+ return XMLUni::fgZeroLenString; // return "";
+ }
+
+ // Simple case where attribute value is just a single text node
+ DOMNode *node = castToChildImpl(fParent.fFirstChild)->nextSibling;
+ if (node == 0 && fParent.fFirstChild->getNodeType() == DOMNode::TEXT_NODE) {
+ return fParent.fFirstChild->getNodeValue();
+ }
+
+ //
+ // Complicated case where attribute value is a DOM tree
+ //
+ // According to the spec, the child nodes of the Attr node may be either
+ // Text or EntityReference nodes.
+ //
+ // The parser will not create such thing, this is for those created by users.
+ //
+ // In such case, we have to visit each child to retrieve the text
+ //
+
+ DOMDocumentImpl* doc = (DOMDocumentImpl*)fParent.fOwnerDocument;
+
+ XMLBuffer buf(1023, doc->getMemoryManager());
+ for (node = fParent.fFirstChild; node != 0; node = castToChildImpl(node)->nextSibling)
+ getTextValue(node, buf);
+
+ return doc->getPooledString(buf.getRawBuffer());
+}
+
+void DOMAttrImpl::getTextValue(DOMNode* node, XMLBuffer& buf) const
+{
+ if (node->getNodeType() == DOMNode::TEXT_NODE)
+ buf.append(node->getNodeValue());
+ else if (node->getNodeType() == DOMNode::ENTITY_REFERENCE_NODE)
+ {
+ for (node = node->getFirstChild(); node != 0; node = castToChildImpl(node)->nextSibling)
+ {
+ getTextValue(node, buf);
+ }
+ }
+
+ return;
+}
+
+
+void DOMAttrImpl::setNodeValue(const XMLCh *val)
+{
+ setValue(val);
+}
+
+
+
+void DOMAttrImpl::setSpecified(bool arg)
+{
+ fNode.isSpecified(arg);
+}
+
+
+
+void DOMAttrImpl::setValue(const XMLCh *val)
+{
+ if (fNode.isReadOnly())
+ {
+ throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
+ }
+
+ // If this attribute was of type ID and in the map, take it out,
+ // then put it back in with the new name. For now, we don't worry
+ // about what happens if the new name conflicts
+ //
+ DOMDocumentImpl *doc = (DOMDocumentImpl *)fParent.fOwnerDocument;
+ if (fNode.isIdAttr())
+ doc->getNodeIDMap()->remove(this);
+
+ DOMNode *kid;
+ while ((kid = fParent.fFirstChild) != 0) // Remove existing kids
+ {
+ DOMNode* node = removeChild(kid);
+ if (node)
+ node->release();
+ }
+
+ if (val != 0) // Create and add the new one
+ fParent.appendChildFast(doc->createTextNode(val));
+ fNode.isSpecified(true);
+ fParent.changed();
+
+ if (fNode.isIdAttr())
+ doc->getNodeIDMap()->add(this);
+
+}
+
+void DOMAttrImpl::setValueFast(const XMLCh *val)
+{
+ if (val != 0)
+ fParent.appendChildFast(fParent.fOwnerDocument->createTextNode(val));
+
+ fNode.isSpecified (true);
+}
+
+
+
+//Introduced in DOM Level 2
+
+DOMElement *DOMAttrImpl::getOwnerElement() const
+{
+ // if we have an owner, ownerNode is our ownerElement, otherwise it's
+ // our ownerDocument and we don't have an ownerElement
+ return (DOMElement *) (fNode.isOwned() ? fNode.fOwnerNode : 0);
+}
+
+
+//internal use by parser only
+void DOMAttrImpl::setOwnerElement(DOMElement *ownerElem)
+{
+ fNode.fOwnerNode = ownerElem;
+ // revisit. Is this backwards? isOwned(true)?
+ fNode.isOwned(false);
+}
+
+
+//For DOM Level 3
+
+void DOMAttrImpl::release()
+{
+ if (fNode.isOwned() && !fNode.isToBeReleased())
+ throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
+
+ DOMDocumentImpl* doc = (DOMDocumentImpl*)fParent.fOwnerDocument;
+ if (doc) {
+ fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
+ fParent.release();
+ doc->release(this, DOMMemoryManager::ATTR_OBJECT);
+ }
+ else {
+ // shouldn't reach here
+ throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
+ }
+}
+
+
+bool DOMAttrImpl::isId() const {
+ return fNode.isIdAttr();
+}
+
+
+DOMNode* DOMAttrImpl::rename(const XMLCh* namespaceURI, const XMLCh* name)
+{
+ DOMElement* el = getOwnerElement();
+ DOMDocumentImpl* doc = (DOMDocumentImpl*)fParent.fOwnerDocument;
+
+ if (el)
+ el->removeAttributeNode(this);
+
+ if (!namespaceURI || !*namespaceURI) {
+ fName = doc->getPooledString(name);
+
+ if (el)
+ el->setAttributeNode(this);
+
+ // and fire user data NODE_RENAMED event
+ castToNodeImpl(this)->callUserDataHandlers(DOMUserDataHandler::NODE_RENAMED, this, this);
+
+ return this;
+ }
+ else {
+
+ // create a new AttrNS
+ DOMAttr* newAttr = doc->createAttributeNS(namespaceURI, name);
+
+ // transfer the userData
+ doc->transferUserData(castToNodeImpl(this), castToNodeImpl(newAttr));
+
+ // move children to new node
+ DOMNode* child = getFirstChild();
+ while (child) {
+ removeChild(child);
+ newAttr->appendChild(child);
+ child = getFirstChild();
+ }
+
+ // reattach attr to element
+ if (el)
+ el->setAttributeNodeNS(newAttr);
+
+ // and fire user data NODE_RENAMED event
+ castToNodeImpl(newAttr)->callUserDataHandlers(DOMUserDataHandler::NODE_RENAMED, this, newAttr);
+
+ return newAttr;
+ }
+}
+
+const DOMTypeInfo *DOMAttrImpl::getSchemaTypeInfo() const
+{
+ if(!fSchemaType)
+ return &DOMTypeInfoImpl::g_DtdNotValidatedAttribute;
+
+ return fSchemaType;
+}
+
+
+void DOMAttrImpl::setSchemaTypeInfo(const DOMTypeInfoImpl* typeInfo)
+{
+ fSchemaType = typeInfo;
+}
+
+bool DOMAttrImpl::isSupported(const XMLCh *feature, const XMLCh *version) const
+{
+ // check for '+DOMPSVITypeInfo'
+ if(feature && *feature=='+' && XMLString::equals(feature+1, XMLUni::fgXercescInterfacePSVITypeInfo))
+ return true;
+ return fNode.isSupported (feature, version);
+}
+
+void* DOMAttrImpl::getFeature(const XMLCh* feature, const XMLCh* version) const
+{
+ if(XMLString::equals(feature, XMLUni::fgXercescInterfacePSVITypeInfo))
+ return (DOMPSVITypeInfo*)fSchemaType;
+ return fNode.getFeature(feature, version);
+}
+
+ DOMNode* DOMAttrImpl::appendChild(DOMNode *newChild) {return fParent.appendChild (newChild); }
+ DOMNamedNodeMap* DOMAttrImpl::getAttributes() const {return fNode.getAttributes (); }
+ DOMNodeList* DOMAttrImpl::getChildNodes() const {return fParent.getChildNodes (); }
+ DOMNode* DOMAttrImpl::getFirstChild() const {return fParent.getFirstChild (); }
+ DOMNode* DOMAttrImpl::getLastChild() const {return fParent.getLastChild (); }
+ const XMLCh* DOMAttrImpl::getLocalName() const {return fNode.getLocalName (); }
+ const XMLCh* DOMAttrImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); }
+ DOMNode* DOMAttrImpl::getNextSibling() const {return fNode.getNextSibling (); }
+ DOMDocument* DOMAttrImpl::getOwnerDocument() const {return fParent.fOwnerDocument; }
+ const XMLCh* DOMAttrImpl::getPrefix() const {return fNode.getPrefix (); }
+ DOMNode* DOMAttrImpl::getParentNode() const {return fNode.getParentNode (); }
+ DOMNode* DOMAttrImpl::getPreviousSibling() const {return fNode.getPreviousSibling (); }
+ bool DOMAttrImpl::hasChildNodes() const {return fParent.hasChildNodes (); }
+ DOMNode* DOMAttrImpl::insertBefore(DOMNode *newChild, DOMNode *refChild)
+ {return fParent.insertBefore (newChild, refChild); }
+ void DOMAttrImpl::normalize() {fParent.normalize (); }
+ DOMNode* DOMAttrImpl::removeChild(DOMNode *oldChild) {return fParent.removeChild (oldChild); }
+ DOMNode* DOMAttrImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild)
+ {return fParent.replaceChild (newChild, oldChild); }
+ void DOMAttrImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); }
+ bool DOMAttrImpl::hasAttributes() const {return fNode.hasAttributes(); }
+ bool DOMAttrImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); }
+ bool DOMAttrImpl::isEqualNode(const DOMNode* arg) const {return fParent.isEqualNode(arg); }
+ void* DOMAttrImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler)
+ {return fNode.setUserData(key, data, handler); }
+ void* DOMAttrImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); }
+ const XMLCh* DOMAttrImpl::getBaseURI() const {return fNode.getBaseURI(); }
+ short DOMAttrImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); }
+ const XMLCh* DOMAttrImpl::getTextContent() const {return fNode.getTextContent(); }
+ void DOMAttrImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); }
+ const XMLCh* DOMAttrImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); }
+ bool DOMAttrImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); }
+ const XMLCh* DOMAttrImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); }
+
+XERCES_CPP_NAMESPACE_END
diff --git a/include/xercesc/dom/impl/DOMAttrImpl.hpp b/include/xercesc/dom/impl/DOMAttrImpl.hpp
new file mode 100644
index 0000000..e4fc0fa
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMAttrImpl.hpp
@@ -0,0 +1,137 @@
+/*
+ * 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: DOMAttrImpl.hpp 678709 2008-07-22 10:56:56Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMATTRIMPL_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMATTRIMPL_HPP
+
+//
+// This file is part of the internal implementation of the C++ XML DOM.
+// It should NOT be included or used directly by application programs.
+//
+// Applications should include the file for the entire
+// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
+// name is substituded for the *.
+//
+
+
+#include
+#include "DOMParentNode.hpp"
+#include "DOMNodeImpl.hpp"
+#include "DOMDocumentImpl.hpp"
+#include
+#include
+#include "DOMNodeIDMap.hpp"
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+class DOMElementImpl;
+class DOMTypeInfoImpl;
+
+class CDOM_EXPORT DOMAttrImpl: public DOMAttr {
+
+public:
+ DOMNodeImpl fNode;
+ DOMParentNode fParent;
+ const XMLCh *fName;
+
+protected:
+ const DOMTypeInfoImpl *fSchemaType;
+
+public:
+ DOMAttrImpl(DOMDocument *ownerDocument, const XMLCh *aName);
+ DOMAttrImpl(const DOMAttrImpl &other, bool deep=false);
+ virtual ~DOMAttrImpl();
+
+public:
+ // Add all functions that are pure virtual in DOMNODE
+ DOMNODE_FUNCTIONS;
+
+public:
+ virtual const XMLCh * getName() const;
+ virtual bool getSpecified() const;
+ virtual const XMLCh * getValue() const;
+ virtual void setSpecified(bool arg);
+ virtual void setValue(const XMLCh * value);
+ virtual DOMElement * getOwnerElement() const;
+ virtual bool isId() const;
+ virtual const DOMTypeInfo* getSchemaTypeInfo() const;
+
+ void setOwnerElement(DOMElement *ownerElem); //internal use only
+
+ // helper function for DOM Level 3 renameNode
+ virtual DOMNode* rename(const XMLCh* namespaceURI, const XMLCh* name);
+
+ //helper function for DOM Level 3 TypeInfo
+ virtual void setSchemaTypeInfo(const DOMTypeInfoImpl* typeInfo);
+
+ // helper method that sets this attr to an idnode and places it into the document map
+ virtual void addAttrToIDNodeMap();
+
+ // helper to remove this attr from from the id map if it is in there
+ virtual void removeAttrFromIDNodeMap();
+
+public:
+ // Set attribute value fast. Assumptions:
+ //
+ // - node is not read-only
+ // - no ID management is performed
+ // - this attribute does not have a value
+ //
+ virtual void setValueFast (const XMLCh * value);
+
+protected:
+ void getTextValue(DOMNode* node, XMLBuffer& buf) const;
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ DOMAttrImpl& operator=(const DOMAttrImpl&);
+};
+
+inline void DOMAttrImpl::removeAttrFromIDNodeMap()
+{
+ if (fNode.isIdAttr()) {
+ ((DOMDocumentImpl *)fParent.fOwnerDocument)->getNodeIDMap()->remove(this);
+ fNode.isIdAttr(false);
+ }
+}
+
+inline void DOMAttrImpl::addAttrToIDNodeMap()
+{
+ if (fNode.isIdAttr())
+ return;
+
+ fNode.isIdAttr(true);
+
+ // REVIST For now, we don't worry about what happens if the new
+ // name conflicts as per setValue
+ DOMDocumentImpl *doc = (DOMDocumentImpl *)(fParent.fOwnerDocument);
+
+ if (doc->fNodeIDMap == 0)
+ doc->fNodeIDMap = new (doc) DOMNodeIDMap(500, doc);
+
+ doc->getNodeIDMap()->add(this);
+}
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/impl/DOMAttrMapImpl.cpp b/include/xercesc/dom/impl/DOMAttrMapImpl.cpp
new file mode 100644
index 0000000..6ae5e51
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMAttrMapImpl.cpp
@@ -0,0 +1,494 @@
+/*
+ * 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: DOMAttrMapImpl.cpp 678709 2008-07-22 10:56:56Z borisk $
+ */
+
+#include "DOMCasts.hpp"
+#include "DOMNodeImpl.hpp"
+#include "DOMNodeVector.hpp"
+#include "DOMAttrMapImpl.hpp"
+#include "DOMAttrImpl.hpp"
+#include "DOMElementImpl.hpp"
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+DOMAttrMapImpl::DOMAttrMapImpl(DOMNode *ownerNod)
+{
+ this->fOwnerNode=ownerNod;
+ this->fNodes = 0;
+ hasDefaults(false);
+}
+
+DOMAttrMapImpl::DOMAttrMapImpl(DOMNode *ownerNod, const DOMAttrMapImpl *defaults)
+{
+ this->fOwnerNode=ownerNod;
+ this->fNodes = 0;
+ hasDefaults(false);
+ if (defaults != 0)
+ {
+ if (defaults->getLength() > 0)
+ {
+ hasDefaults(true);
+ cloneContent(defaults);
+ }
+ }
+}
+
+DOMAttrMapImpl::~DOMAttrMapImpl()
+{
+}
+
+void DOMAttrMapImpl::cloneContent(const DOMAttrMapImpl *srcmap)
+{
+ if ((srcmap != 0) && (srcmap->fNodes != 0))
+ {
+ if (fNodes != 0)
+ fNodes->reset();
+ else
+ {
+ XMLSize_t size = srcmap->fNodes->size();
+ if(size > 0) {
+ DOMDocumentImpl *doc = (DOMDocumentImpl*)fOwnerNode->getOwnerDocument();
+ fNodes = new (doc) DOMNodeVector(doc, size);
+ }
+ }
+
+ for (XMLSize_t i = 0; i < srcmap->fNodes->size(); i++)
+ {
+ DOMNode *n = srcmap->fNodes->elementAt(i);
+ DOMNode *clone = n->cloneNode(true);
+ castToNodeImpl(clone)->isSpecified(castToNodeImpl(n)->isSpecified());
+ castToNodeImpl(clone)->fOwnerNode = fOwnerNode;
+ castToNodeImpl(clone)->isOwned(true);
+ fNodes->addElement(clone);
+ }
+ }
+}
+
+DOMAttrMapImpl *DOMAttrMapImpl::cloneAttrMap(DOMNode *ownerNode_p)
+{
+ DOMAttrMapImpl *newmap = new (castToNodeImpl(ownerNode_p)->getOwnerDocument()) DOMAttrMapImpl(ownerNode_p);
+ newmap->cloneContent(this);
+ // newmap->attrDefaults = this->attrDefaults; // revisit
+ return newmap;
+}
+
+void DOMAttrMapImpl::setReadOnly(bool readOnl, bool deep)
+{
+ // this->fReadOnly=readOnl;
+ if(deep && fNodes!=0)
+ {
+ XMLSize_t sz = fNodes->size();
+ for (XMLSize_t i=0; ielementAt(i))->setReadOnly(readOnl, deep);
+ }
+ }
+}
+
+bool DOMAttrMapImpl::readOnly() {
+ return castToNodeImpl(fOwnerNode)->isReadOnly();
+}
+
+int DOMAttrMapImpl::findNamePoint(const XMLCh *name) const
+{
+ // Binary search
+ int i=0;
+ if(fNodes!=0)
+ {
+ int first=0,last=(int)fNodes->size()-1;
+
+ while(first<=last)
+ {
+ i=(first+last)/2;
+ int test = XMLString::compareString(name, fNodes->elementAt(i)->getNodeName());
+ if(test==0)
+ return i; // Name found
+ else if(test<0)
+ last=i-1;
+ else
+ first=i+1;
+ }
+ if(first>i) i=first;
+ }
+ /********************
+ // Linear search
+ int i = 0;
+ if (fNodes != 0)
+ for (i = 0; i < fNodes.size(); ++i)
+ {
+ int test = name.compareTo(((NodeImpl *) (fNodes.elementAt(i))).getNodeName());
+ if (test == 0)
+ return i;
+ else
+ if (test < 0)
+ {
+ break; // Found insertpoint
+ }
+ }
+
+ *******************/
+ return -1 - i; // not-found has to be encoded.
+}
+
+DOMNode * DOMAttrMapImpl::getNamedItem(const XMLCh *name) const
+{
+ int i=findNamePoint(name);
+ return (i<0) ? 0 : fNodes->elementAt(i);
+}
+
+DOMNode *DOMAttrMapImpl::setNamedItem(DOMNode *arg)
+{
+ if (arg->getNodeType() != DOMNode::ATTRIBUTE_NODE)
+ throw DOMException(DOMException::HIERARCHY_REQUEST_ERR, 0, GetDOMNamedNodeMapMemoryManager);
+
+ DOMDocument *doc = fOwnerNode->getOwnerDocument();
+ DOMNodeImpl *argImpl = castToNodeImpl(arg);
+ if(argImpl->getOwnerDocument() != doc)
+ throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMNamedNodeMapMemoryManager);
+ if (this->readOnly())
+ throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
+ if ((arg->getNodeType() == DOMNode::ATTRIBUTE_NODE) && argImpl->isOwned() && (argImpl->fOwnerNode != fOwnerNode))
+ throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR,0, GetDOMNamedNodeMapMemoryManager);
+
+ argImpl->fOwnerNode = fOwnerNode;
+ argImpl->isOwned(true);
+ int i=findNamePoint(arg->getNodeName());
+ DOMNode * previous=0;
+ if(i>=0)
+ {
+ previous = fNodes->elementAt(i);
+ fNodes->setElementAt(arg,i);
+ }
+ else
+ {
+ i=-1-i; // Insert point (may be end of list)
+ if(0==fNodes)
+ {
+ fNodes=new ((DOMDocumentImpl*)doc) DOMNodeVector(doc);
+ }
+ fNodes->insertElementAt(arg,i);
+ }
+ if (previous != 0) {
+ castToNodeImpl(previous)->fOwnerNode = doc;
+ castToNodeImpl(previous)->isOwned(false);
+ }
+
+ return previous;
+}
+
+//Introduced in DOM Level 2
+
+int DOMAttrMapImpl::findNamePoint(const XMLCh *namespaceURI,
+ const XMLCh *localName) const
+{
+ if (fNodes == 0)
+ return -1;
+ // This is a linear search through the same fNodes Vector.
+ // The Vector is sorted on the DOM Level 1 nodename.
+ // The DOM Level 2 NS keys are namespaceURI and Localname,
+ // so we must linear search thru it.
+ // In addition, to get this to work with fNodes without any namespace
+ // (namespaceURI and localNames are both 0) we then use the nodeName
+ // as a secondary key.
+ const XMLSize_t len = fNodes -> size();
+ for (XMLSize_t i = 0; i < len; ++i) {
+ DOMNode *node = fNodes -> elementAt(i);
+ const XMLCh * nNamespaceURI = node->getNamespaceURI();
+ const XMLCh * nLocalName = node->getLocalName();
+ if (!XMLString::equals(nNamespaceURI, namespaceURI)) //URI not match
+ continue;
+ else {
+ if (XMLString::equals(localName, nLocalName)
+ ||
+ (nLocalName == 0 && XMLString::equals(localName, node->getNodeName())))
+ return (int)i;
+ }
+ }
+ return -1; //not found
+}
+
+DOMNode *DOMAttrMapImpl::getNamedItemNS(const XMLCh *namespaceURI,
+ const XMLCh *localName) const
+{
+ int i = findNamePoint(namespaceURI, localName);
+ return i < 0 ? 0 : fNodes -> elementAt(i);
+}
+
+DOMNode *DOMAttrMapImpl::setNamedItemNS(DOMNode* arg)
+{
+ if (arg->getNodeType() != DOMNode::ATTRIBUTE_NODE)
+ throw DOMException(DOMException::HIERARCHY_REQUEST_ERR, 0, GetDOMNamedNodeMapMemoryManager);
+
+ DOMDocument *doc = fOwnerNode->getOwnerDocument();
+ DOMNodeImpl *argImpl = castToNodeImpl(arg);
+ if (argImpl->getOwnerDocument() != doc)
+ throw DOMException(DOMException::WRONG_DOCUMENT_ERR,0, GetDOMNamedNodeMapMemoryManager);
+ if (this->readOnly())
+ throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
+ if (argImpl->isOwned())
+ throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR,0, GetDOMNamedNodeMapMemoryManager);
+
+ argImpl->fOwnerNode = fOwnerNode;
+ argImpl->isOwned(true);
+ int i=findNamePoint(arg->getNamespaceURI(), arg->getLocalName());
+ DOMNode *previous=0;
+ if(i>=0) {
+ previous = fNodes->elementAt(i);
+ fNodes->setElementAt(arg,i);
+ } else {
+ i=findNamePoint(arg->getNodeName()); // Insert point (may be end of list)
+ if (i<0)
+ i = -1 - i;
+ if(0==fNodes)
+ fNodes=new ((DOMDocumentImpl*)doc) DOMNodeVector(doc);
+ fNodes->insertElementAt(arg,i);
+ }
+ if (previous != 0) {
+ castToNodeImpl(previous)->fOwnerNode = doc;
+ castToNodeImpl(previous)->isOwned(false);
+ }
+
+ return previous;
+}
+
+DOMNode *DOMAttrMapImpl::removeNamedItem(const XMLCh *name)
+{
+ if (this->readOnly())
+ throw DOMException(
+ DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
+ int i=findNamePoint(name);
+ DOMNode *removed = 0;
+
+ if(i<0)
+ throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager);
+
+ removed = fNodes->elementAt(i);
+ fNodes->removeElementAt(i);
+ castToNodeImpl(removed)->fOwnerNode = fOwnerNode->getOwnerDocument();
+ castToNodeImpl(removed)->isOwned(false);
+
+ // Replace it if it had a default value
+ // (DOM spec level 1 - Element Interface)
+ if (hasDefaults() && (removed != 0))
+ {
+ DOMAttrMapImpl* defAttrs = ((DOMElementImpl*)fOwnerNode)->getDefaultAttributes();
+ DOMAttr* attr = (DOMAttr*)(defAttrs->getNamedItem(name));
+ if (attr != 0)
+ {
+ DOMAttr* newAttr = (DOMAttr*)attr->cloneNode(true);
+ setNamedItem(newAttr);
+ }
+ }
+
+ return removed;
+}
+
+DOMNode *DOMAttrMapImpl::removeNamedItemNS(const XMLCh *namespaceURI, const XMLCh *localName)
+{
+ if (this->readOnly())
+ throw DOMException(
+ DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
+ int i = findNamePoint(namespaceURI, localName);
+ if (i < 0)
+ throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager);
+
+ DOMNode * removed = fNodes -> elementAt(i);
+ fNodes -> removeElementAt(i); //remove n from nodes
+ castToNodeImpl(removed)->fOwnerNode = fOwnerNode->getOwnerDocument();
+ castToNodeImpl(removed)->isOwned(false);
+
+ // Replace it if it had a default value
+ // (DOM spec level 2 - Element Interface)
+
+ if (hasDefaults() && (removed != 0))
+ {
+ DOMAttrMapImpl* defAttrs = ((DOMElementImpl*)fOwnerNode)->getDefaultAttributes();
+ DOMAttr* attr = (DOMAttr*)(defAttrs->getNamedItemNS(namespaceURI, localName));
+ if (attr != 0)
+ {
+ DOMAttr* newAttr = (DOMAttr*)attr->cloneNode(true);
+ setNamedItemNS(newAttr);
+ }
+ }
+
+ return removed;
+}
+
+// remove the name using index
+// avoid calling findNamePoint again if the index is already known
+DOMNode * DOMAttrMapImpl::removeNamedItemAt(XMLSize_t index)
+{
+ if (this->readOnly())
+ throw DOMException(
+ DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
+
+ DOMNode *removed = item(index);
+ if(!removed)
+ throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager);
+
+ fNodes->removeElementAt(index);
+ castToNodeImpl(removed)->fOwnerNode = fOwnerNode->getOwnerDocument();
+ castToNodeImpl(removed)->isOwned(false);
+
+ // Replace it if it had a default value
+ // (DOM spec level 1 - Element Interface)
+ if (hasDefaults() && (removed != 0))
+ {
+ DOMAttrMapImpl* defAttrs = ((DOMElementImpl*)fOwnerNode)->getDefaultAttributes();
+
+ const XMLCh* localName = removed->getLocalName();
+ DOMAttr* attr = 0;
+ if (localName)
+ attr = (DOMAttr*)(defAttrs->getNamedItemNS(removed->getNamespaceURI(), localName));
+ else
+ attr = (DOMAttr*)(defAttrs->getNamedItem(((DOMAttr*)removed)->getName()));
+
+ if (attr != 0)
+ {
+ DOMAttr* newAttr = (DOMAttr*)attr->cloneNode(true);
+ setNamedItem(newAttr);
+ }
+ }
+
+ return removed;
+}
+
+/**
+ * Get this AttributeMap in sync with the given "defaults" map.
+ * @param defaults The default attributes map to sync with.
+ */
+void DOMAttrMapImpl::reconcileDefaultAttributes(const DOMAttrMapImpl* defaults) {
+
+ // remove any existing default
+ XMLSize_t nsize = getLength();
+ for (XMLSize_t i = nsize; i > 0; i--) {
+ DOMAttr* attr = (DOMAttr*)item(i-1);
+ if (!attr->getSpecified()) {
+ removeNamedItemAt(i-1);
+ }
+ }
+
+ hasDefaults(false);
+
+ // add the new defaults
+ if (defaults) {
+ hasDefaults(true);
+
+ if (nsize == 0) {
+ cloneContent(defaults);
+ }
+ else {
+ XMLSize_t dsize = defaults->getLength();
+ for (XMLSize_t n = 0; n < dsize; n++) {
+ DOMAttr* attr = (DOMAttr*)defaults->item(n);
+
+ DOMAttr* newAttr = (DOMAttr*)attr->cloneNode(true);
+ setNamedItemNS(newAttr);
+ DOMAttrImpl* newAttrImpl = (DOMAttrImpl*) newAttr;
+ newAttrImpl->setSpecified(false);
+ }
+ }
+ }
+} // reconcileDefaults()
+
+
+/**
+ * Move specified attributes from the given map to this one
+ */
+void DOMAttrMapImpl::moveSpecifiedAttributes(DOMAttrMapImpl* srcmap) {
+ XMLSize_t nsize = srcmap->getLength();
+
+ for (XMLSize_t i = nsize; i > 0; i--) {
+ DOMAttr* attr = (DOMAttr*)srcmap->item(i-1);
+ if (attr->getSpecified()) {
+ srcmap->removeNamedItemAt(i-1);
+ }
+
+ if (attr->getLocalName())
+ setNamedItemNS(attr);
+ else
+ setNamedItem(attr);
+ }
+} // moveSpecifiedAttributes(AttributeMap):void
+
+XMLSize_t DOMAttrMapImpl::getLength() const
+{
+ return (fNodes != 0) ? fNodes->size() : 0;
+}
+
+DOMNode * DOMAttrMapImpl::item(XMLSize_t index) const
+{
+ return (fNodes != 0 && index < fNodes->size()) ?
+ fNodes->elementAt(index) : 0;
+}
+
+void DOMAttrMapImpl::setNamedItemFast(DOMNode *arg)
+{
+ DOMNodeImpl *argImpl = castToNodeImpl(arg);
+
+ argImpl->fOwnerNode = fOwnerNode;
+ argImpl->isOwned(true);
+ int i = findNamePoint(arg->getNodeName());
+
+ if(i >= 0)
+ fNodes->setElementAt(arg, i);
+ else
+ {
+ i= -1 -i;
+ fNodes->insertElementAt(arg, i);
+ }
+}
+
+void DOMAttrMapImpl::setNamedItemNSFast(DOMNode* arg)
+{
+ DOMNodeImpl *argImpl = castToNodeImpl(arg);
+
+ argImpl->fOwnerNode = fOwnerNode;
+ argImpl->isOwned(true);
+ int i=findNamePoint(arg->getNamespaceURI(), arg->getLocalName());
+
+ if(i >= 0)
+ {
+ fNodes->setElementAt(arg,i);
+ }
+ else
+ {
+ i = findNamePoint(arg->getNodeName());
+
+ if (i < 0)
+ i = -1 - i;
+
+ fNodes->insertElementAt(arg,i);
+ }
+}
+
+void DOMAttrMapImpl::reserve (XMLSize_t n)
+{
+ if (fNodes == 0)
+ {
+ DOMDocumentImpl* doc = (DOMDocumentImpl*)fOwnerNode->getOwnerDocument();
+ fNodes = new (doc) DOMNodeVector(doc, n);
+ }
+}
+
+XERCES_CPP_NAMESPACE_END
diff --git a/include/xercesc/dom/impl/DOMAttrMapImpl.hpp b/include/xercesc/dom/impl/DOMAttrMapImpl.hpp
new file mode 100644
index 0000000..2d22543
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMAttrMapImpl.hpp
@@ -0,0 +1,125 @@
+/*
+ * 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: DOMAttrMapImpl.hpp 678709 2008-07-22 10:56:56Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMATTRMAPIMPL_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMATTRMAPIMPL_HPP
+
+//
+// This file is part of the internal implementation of the C++ XML DOM.
+// It should NOT be included or used directly by application programs.
+//
+// Applications should include the file for the entire
+// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
+// name is substituded for the *.
+//
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+class DOMNode;
+class DOMNodeVector;
+
+class CDOM_EXPORT DOMAttrMapImpl : public DOMNamedNodeMap
+{
+protected:
+ DOMNodeVector* fNodes;
+ DOMNode* fOwnerNode; // the node this map belongs to
+ bool attrDefaults;
+
+ virtual void cloneContent(const DOMAttrMapImpl *srcmap);
+
+ bool readOnly(); // revisit. Look at owner node read-only.
+
+public:
+ DOMAttrMapImpl(DOMNode *ownerNod);
+
+ // revisit. This "copy" constructor is used for cloning an Element with Attributes,
+ // and for setting up default attributes. It's probably not right
+ // for one or the other or both.
+ DOMAttrMapImpl(DOMNode *ownerNod, const DOMAttrMapImpl *defaults);
+ DOMAttrMapImpl();
+
+ virtual ~DOMAttrMapImpl();
+ virtual DOMAttrMapImpl *cloneAttrMap(DOMNode *ownerNode);
+ virtual bool hasDefaults();
+ virtual void hasDefaults(bool value);
+ virtual int findNamePoint(const XMLCh *name) const;
+ virtual int findNamePoint(const XMLCh *namespaceURI,
+ const XMLCh *localName) const;
+ virtual DOMNode* removeNamedItemAt(XMLSize_t index);
+ virtual void setReadOnly(bool readOnly, bool deep);
+
+
+ virtual XMLSize_t getLength() const;
+ virtual DOMNode* item(XMLSize_t index) const;
+
+ virtual DOMNode* getNamedItem(const XMLCh *name) const;
+ virtual DOMNode* setNamedItem(DOMNode *arg);
+ virtual DOMNode* removeNamedItem(const XMLCh *name);
+
+ virtual DOMNode* getNamedItemNS(const XMLCh *namespaceURI,
+ const XMLCh *localName) const;
+ virtual DOMNode* setNamedItemNS(DOMNode *arg);
+ virtual DOMNode* removeNamedItemNS(const XMLCh *namespaceURI, const XMLCh *localName);
+
+ // Fast versions of the above functions which bypass validity checks.
+ // It also assumes that fNode is not 0 (call reserve) and that there
+ // is no previous node with this name. These are used in parsing.
+ //
+ void setNamedItemFast(DOMNode *arg);
+ void setNamedItemNSFast(DOMNode *arg);
+
+ // Tries to reserve space for the specified number of elements.
+ // Currently only works on newly-created instances (fNodes == 0).
+ //
+ void reserve (XMLSize_t);
+
+ void reconcileDefaultAttributes(const DOMAttrMapImpl* defaults);
+ void moveSpecifiedAttributes(DOMAttrMapImpl* srcmap);
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ DOMAttrMapImpl(const DOMAttrMapImpl &);
+ DOMAttrMapImpl & operator = (const DOMAttrMapImpl &);
+};
+
+// ---------------------------------------------------------------------------
+// DOMAttrMapImpl: Getters & Setters
+// ---------------------------------------------------------------------------
+
+inline bool DOMAttrMapImpl::hasDefaults()
+{
+ return attrDefaults;
+}
+
+inline void DOMAttrMapImpl::hasDefaults(bool value)
+{
+ attrDefaults = value;
+}
+
+XERCES_CPP_NAMESPACE_END
+
+
+#endif
diff --git a/include/xercesc/dom/impl/DOMAttrNSImpl.cpp b/include/xercesc/dom/impl/DOMAttrNSImpl.cpp
new file mode 100644
index 0000000..4402d0d
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMAttrNSImpl.cpp
@@ -0,0 +1,247 @@
+/*
+ * 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: DOMAttrNSImpl.cpp 901107 2010-01-20 08:45:02Z borisk $
+ */
+
+#include
+#include "DOMAttrNSImpl.hpp"
+#include "DOMDocumentImpl.hpp"
+#include
+#include
+#include
+
+#include "assert.h"
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+DOMAttrNSImpl::DOMAttrNSImpl(DOMDocument *ownerDoc, const XMLCh *nam) :
+DOMAttrImpl(ownerDoc, nam)
+{
+ this->fNamespaceURI=0; //DOM Level 2
+ this->fLocalName=0; //DOM Level 2
+ this->fPrefix=0;
+}
+
+//Introduced in DOM Level 2
+DOMAttrNSImpl::DOMAttrNSImpl(DOMDocument *ownerDoc,
+ const XMLCh *namespaceURI,
+ const XMLCh *qualifiedName) :
+DOMAttrImpl(ownerDoc, qualifiedName)
+{
+ setName(namespaceURI, qualifiedName);
+}
+
+DOMAttrNSImpl::
+DOMAttrNSImpl(DOMDocument *ownerDoc,
+ const XMLCh *namespaceURI,
+ const XMLCh *prefix,
+ const XMLCh *localName,
+ const XMLCh *qualifiedName)
+ : DOMAttrImpl(ownerDoc, qualifiedName)
+{
+ DOMDocumentImpl* docImpl = (DOMDocumentImpl*)fParent.fOwnerDocument;
+
+ if (prefix == 0 || *prefix == 0)
+ {
+ fPrefix = 0;
+ fLocalName = fName;
+ }
+ else
+ {
+ fPrefix = docImpl->getPooledString(prefix);
+ fLocalName = docImpl->getPooledString(localName);
+ }
+
+ // DOM Level 3: namespace URI is never empty string.
+ //
+ const XMLCh * URI = DOMNodeImpl::mapPrefix
+ (
+ fPrefix,
+ (!namespaceURI || !*namespaceURI) ? 0 : namespaceURI,
+ DOMNode::ATTRIBUTE_NODE
+ );
+ this -> fNamespaceURI = (URI == 0) ? 0 : docImpl->getPooledString(URI);
+}
+
+DOMAttrNSImpl::DOMAttrNSImpl(const DOMAttrNSImpl &other, bool deep) :
+DOMAttrImpl(other, deep)
+{
+ this->fNamespaceURI = other.fNamespaceURI; //DOM Level 2
+ this->fLocalName = other.fLocalName; //DOM Level 2
+ this->fPrefix = other.fPrefix;
+}
+
+DOMNode * DOMAttrNSImpl::cloneNode(bool deep) const
+{
+ DOMNode* newNode = new (fParent.fOwnerDocument, DOMMemoryManager::ATTR_NS_OBJECT) DOMAttrNSImpl(*this, deep);
+ fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode);
+ return newNode;
+}
+
+const XMLCh * DOMAttrNSImpl::getNamespaceURI() const
+{
+ return fNamespaceURI;
+}
+
+const XMLCh * DOMAttrNSImpl::getPrefix() const
+{
+ return fPrefix;
+}
+
+const XMLCh * DOMAttrNSImpl::getLocalName() const
+{
+ return fLocalName;
+}
+
+void DOMAttrNSImpl::setPrefix(const XMLCh *prefix)
+{
+ const XMLCh * xmlns = DOMNodeImpl::getXmlnsString();
+
+ if (fNode.isReadOnly())
+ throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
+ if (fNamespaceURI == 0 || fNamespaceURI[0] == chNull || XMLString::equals(fLocalName, xmlns))
+ throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
+
+ if (prefix == 0 || prefix[0] == chNull) {
+ fName = fLocalName;
+ fPrefix = 0;
+ return;
+ }
+
+ DOMDocumentImpl* doc = (DOMDocumentImpl*) fParent.fOwnerDocument;
+
+ if (!doc->isXMLName(prefix))
+ throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, GetDOMNodeMemoryManager);
+
+ const XMLCh * xml = DOMNodeImpl::getXmlString();
+ const XMLCh * xmlURI = DOMNodeImpl::getXmlURIString();
+ const XMLCh * xmlnsURI = DOMNodeImpl::getXmlnsURIString();
+
+ if ((XMLString::equals(prefix, xml) &&
+ !XMLString::equals(fNamespaceURI, xmlURI))
+ || (XMLString::equals(prefix, xmlns) &&
+ !XMLString::equals(fNamespaceURI, xmlnsURI)))
+ throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
+
+ if (XMLString::indexOf(prefix, chColon) != -1) {
+ throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
+ }
+
+ this-> fPrefix = doc->getPooledString(prefix);
+
+ XMLSize_t prefixLen = XMLString::stringLen(prefix);
+ XMLSize_t newQualifiedNameLen = prefixLen+1+XMLString::stringLen(fLocalName);
+ XMLCh* newName;
+ XMLCh temp[256];
+ if (newQualifiedNameLen >= 255)
+ newName = (XMLCh*) doc->getMemoryManager()->allocate
+ (
+ newQualifiedNameLen * sizeof(XMLCh)
+ );//new XMLCh[newQualifiedNameLen];
+ else
+ newName = temp;
+
+ // newName = prefix + chColon + fLocalName;
+ XMLString::copyString(newName, prefix);
+ newName[prefixLen] = chColon;
+ XMLString::copyString(&newName[prefixLen+1], fLocalName);
+
+ fName = doc->getPooledString(newName);
+
+ if (newQualifiedNameLen >= 255)
+ doc->getMemoryManager()->deallocate(newName);//delete[] newName;
+
+}
+
+void DOMAttrNSImpl::release()
+{
+ if (fNode.isOwned() && !fNode.isToBeReleased())
+ throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
+
+ DOMDocumentImpl* doc = (DOMDocumentImpl*)fParent.fOwnerDocument;
+ if (doc) {
+ fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
+ fParent.release();
+ doc->release(this, DOMMemoryManager::ATTR_NS_OBJECT);
+ }
+ else {
+ // shouldn't reach here
+ throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
+ }
+}
+
+
+DOMNode* DOMAttrNSImpl::rename(const XMLCh* namespaceURI, const XMLCh* name)
+{
+ DOMElement* el = getOwnerElement();
+ if (el)
+ el->removeAttributeNode(this);
+
+ setName(namespaceURI, name);
+
+ if (el)
+ el->setAttributeNodeNS(this);
+
+ return this;
+}
+
+void DOMAttrNSImpl::setName(const XMLCh* namespaceURI, const XMLCh* qualifiedName)
+{
+ DOMDocumentImpl* ownerDoc = (DOMDocumentImpl *)fParent.fOwnerDocument;
+ const XMLCh * xmlns = DOMNodeImpl::getXmlnsString();
+ const XMLCh * xmlnsURI = DOMNodeImpl::getXmlnsURIString();
+ this->fName = ownerDoc->getPooledString(qualifiedName);
+
+ int index = DOMDocumentImpl::indexofQualifiedName(qualifiedName);
+ if (index < 0)
+ throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
+
+ bool xmlnsAlone = false; //true if attribute name is "xmlns"
+ if (index == 0)
+ { //qualifiedName contains no ':'
+ if (XMLString::equals(this->fName, xmlns)) {
+ if (!XMLString::equals(namespaceURI, xmlnsURI))
+ throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
+ xmlnsAlone = true;
+ }
+ fPrefix = 0;
+ fLocalName = fName;
+ }
+ else
+ {
+ fPrefix = ownerDoc->getPooledNString(fName, index);
+ fLocalName = ownerDoc->getPooledString(fName+index+1);
+
+ // Before we carry on, we should check if the prefix or localName are valid XMLName
+ if (!ownerDoc->isXMLName(fPrefix) || !ownerDoc->isXMLName(fLocalName))
+ throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
+ }
+
+ // DOM Level 3: namespace URI is never empty string.
+ const XMLCh * URI = xmlnsAlone ? xmlnsURI
+ : DOMNodeImpl::mapPrefix
+ (
+ fPrefix,
+ (!namespaceURI || !*namespaceURI) ? 0 : namespaceURI,
+ DOMNode::ATTRIBUTE_NODE
+ );
+ this -> fNamespaceURI = (URI == 0) ? 0 : ownerDoc->getPooledString(URI);
+}
+
+XERCES_CPP_NAMESPACE_END
diff --git a/include/xercesc/dom/impl/DOMAttrNSImpl.hpp b/include/xercesc/dom/impl/DOMAttrNSImpl.hpp
new file mode 100644
index 0000000..64470e6
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMAttrNSImpl.hpp
@@ -0,0 +1,85 @@
+/*
+ * 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: DOMAttrNSImpl.hpp 678709 2008-07-22 10:56:56Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMATTRNSIMPL_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMATTRNSIMPL_HPP
+
+//
+// This file is part of the internal implementation of the C++ XML DOM.
+// It should NOT be included or used directly by application programs.
+//
+// Applications should include the file for the entire
+// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
+// name is substituded for the *.
+//
+
+#include "DOMAttrImpl.hpp"
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class CDOM_EXPORT DOMAttrNSImpl: public DOMAttrImpl {
+protected:
+ //Introduced in DOM Level 2
+ const XMLCh * fNamespaceURI; //namespace URI of this node
+ const XMLCh * fLocalName; //local part of qualified name
+ const XMLCh * fPrefix; // prefix part of qualified name
+ // revisit - can return local part
+ // by pointing into the qualified (L1) name.
+
+public:
+ DOMAttrNSImpl(DOMDocument *ownerDoc, const XMLCh *name);
+ DOMAttrNSImpl(DOMDocument *ownerDoc, //DOM Level 2
+ const XMLCh *namespaceURI, const XMLCh *qualifiedName);
+ DOMAttrNSImpl(const DOMAttrNSImpl &other, bool deep=false);
+
+ // Fast construction without any checks for name validity. Used in
+ // parsing. Note that if prefix is not specified and localName is
+ // 'xmlns', this constructor expects proper namespaceURI.
+ //
+ DOMAttrNSImpl(DOMDocument *ownerDoc,
+ const XMLCh *namespaceURI,
+ const XMLCh *prefix, // Null or empty - no prefix.
+ const XMLCh *localName,
+ const XMLCh *qualifiedName);
+
+ virtual DOMNode * cloneNode(bool deep) const;
+ //Introduced in DOM Level 2
+ virtual const XMLCh * getNamespaceURI() const;
+ virtual const XMLCh * getPrefix() const;
+ virtual const XMLCh * getLocalName() const;
+ virtual void setPrefix(const XMLCh *prefix);
+ virtual void release();
+
+ // helper function for DOM Level 3 renameNode
+ virtual DOMNode* rename(const XMLCh* namespaceURI, const XMLCh* name);
+ void setName(const XMLCh* namespaceURI, const XMLCh* name);
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ DOMAttrNSImpl & operator = (const DOMAttrNSImpl &);
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/impl/DOMCDATASectionImpl.cpp b/include/xercesc/dom/impl/DOMCDATASectionImpl.cpp
new file mode 100644
index 0000000..42c2e3a
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMCDATASectionImpl.cpp
@@ -0,0 +1,321 @@
+/*
+ * 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: DOMCDATASectionImpl.cpp 1027995 2010-10-27 15:09:39Z amassari $
+ */
+
+#include "DOMCDATASectionImpl.hpp"
+#include "DOMNodeImpl.hpp"
+#include "DOMRangeImpl.hpp"
+#include "DOMDocumentImpl.hpp"
+#include "DOMCasts.hpp"
+#include "DOMStringPool.hpp"
+#include
+#include
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+DOMCDATASectionImpl::DOMCDATASectionImpl(DOMDocument *ownerDoc,
+ const XMLCh *dat)
+ : fNode(ownerDoc), fCharacterData(ownerDoc, dat)
+{
+ fNode.setIsLeafNode(true);
+}
+
+DOMCDATASectionImpl::
+DOMCDATASectionImpl(DOMDocument *ownerDoc, const XMLCh* data, XMLSize_t n)
+ : fNode(ownerDoc), fCharacterData(ownerDoc, data, n)
+{
+ fNode.setIsLeafNode(true);
+}
+
+DOMCDATASectionImpl::DOMCDATASectionImpl(const DOMCDATASectionImpl &other, bool /*deep*/)
+ : DOMCDATASection(other),
+ fNode(*castToNodeImpl(&other)),
+ fChild(*castToChildImpl(&other)),
+ fCharacterData(other.fCharacterData)
+{
+ // revisit. Something nees to make "deep" work.
+}
+
+
+DOMCDATASectionImpl::~DOMCDATASectionImpl()
+{
+}
+
+
+DOMNode *DOMCDATASectionImpl::cloneNode(bool deep) const
+{
+ DOMNode* newNode = new (this->getOwnerDocument(), DOMMemoryManager::CDATA_SECTION_OBJECT) DOMCDATASectionImpl(*this, deep);
+ fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode);
+ return newNode;
+}
+
+
+const XMLCh * DOMCDATASectionImpl::getNodeName() const {
+ static const XMLCh gcdata_section[] = {chPound, chLatin_c, chLatin_d, chLatin_a, chLatin_t, chLatin_a,
+ chDash, chLatin_s, chLatin_e, chLatin_c, chLatin_t, chLatin_i, chLatin_o, chLatin_n, 0};
+ return gcdata_section;
+}
+
+
+DOMNode::NodeType DOMCDATASectionImpl::getNodeType() const {
+ return DOMNode::CDATA_SECTION_NODE;
+}
+
+
+bool DOMCDATASectionImpl::isIgnorableWhitespace() const
+{
+ return fNode.ignorableWhitespace();
+}
+
+
+//
+// splitText. revist - factor into a common function for use
+// here and in DOMTextImpl
+//
+DOMText *DOMCDATASectionImpl::splitText(XMLSize_t offset)
+{
+ if (fNode.isReadOnly())
+ {
+ throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
+ }
+ XMLSize_t len = fCharacterData.fDataBuf->getLen();
+ if (offset > len)
+ throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMNodeMemoryManager);
+
+ DOMDocumentImpl *doc = (DOMDocumentImpl *)getOwnerDocument();
+ DOMText *newText =
+ doc->createCDATASection(this->substringData(offset, len - offset));
+
+ DOMNode *parent = getParentNode();
+ if (parent != 0)
+ parent->insertBefore(newText, getNextSibling());
+
+ fCharacterData.fDataBuf->chop(offset);
+
+ if (doc != 0) {
+ Ranges* ranges = doc->getRanges();
+ if (ranges != 0) {
+ XMLSize_t sz = ranges->size();
+ if (sz != 0) {
+ for (XMLSize_t i =0; ielementAt(i)->updateSplitInfo( this, newText, offset);
+ }
+ }
+ }
+ }
+
+ return newText;
+}
+
+
+bool DOMCDATASectionImpl::getIsElementContentWhitespace() const
+{
+ return isIgnorableWhitespace();
+}
+
+const XMLCh* DOMCDATASectionImpl::getWholeText() const
+{
+ DOMDocument *doc = getOwnerDocument();
+ if (!doc) {
+ throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, GetDOMNodeMemoryManager);
+ return 0;
+ }
+ DOMNode* root=doc->getDocumentElement();
+ DOMTreeWalker* pWalker=doc->createTreeWalker(root!=NULL?root:(DOMNode*)this, DOMNodeFilter::SHOW_ALL, NULL, true);
+ pWalker->setCurrentNode((DOMNode*)this);
+ // Logically-adjacent text nodes are Text or CDATASection nodes that can be visited sequentially in document order or in
+ // reversed document order without entering, exiting, or passing over Element, Comment, or ProcessingInstruction nodes.
+ DOMNode* prevNode;
+ while((prevNode=pWalker->previousNode())!=NULL)
+ {
+ if(prevNode->getNodeType()==ELEMENT_NODE || prevNode->getNodeType()==COMMENT_NODE || prevNode->getNodeType()==PROCESSING_INSTRUCTION_NODE)
+ break;
+ }
+ XMLBuffer buff(1023, GetDOMNodeMemoryManager);
+ DOMNode* nextNode;
+ while((nextNode=pWalker->nextNode())!=NULL)
+ {
+ if(nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE)
+ break;
+ if(nextNode->getNodeType()==TEXT_NODE || nextNode->getNodeType()==CDATA_SECTION_NODE)
+ buff.append(nextNode->getNodeValue());
+ }
+ pWalker->release();
+
+ XMLCh* wholeString = (XMLCh*)((DOMDocumentImpl*)doc)->allocate((buff.getLen()+1) * sizeof(XMLCh));
+ XMLString::copyString(wholeString, buff.getRawBuffer());
+ return wholeString;
+}
+
+DOMText* DOMCDATASectionImpl::replaceWholeText(const XMLCh* newText)
+{
+ DOMDocument *doc = getOwnerDocument();
+ DOMTreeWalker* pWalker=doc->createTreeWalker(doc->getDocumentElement(), DOMNodeFilter::SHOW_ALL, NULL, true);
+ pWalker->setCurrentNode((DOMNode*)this);
+ // Logically-adjacent text nodes are Text or CDATASection nodes that can be visited sequentially in document order or in
+ // reversed document order without entering, exiting, or passing over Element, Comment, or ProcessingInstruction nodes.
+ DOMNode* pFirstTextNode=this;
+ DOMNode* prevNode;
+ while((prevNode=pWalker->previousNode())!=NULL)
+ {
+ if(prevNode->getNodeType()==ELEMENT_NODE || prevNode->getNodeType()==COMMENT_NODE || prevNode->getNodeType()==PROCESSING_INSTRUCTION_NODE)
+ break;
+ pFirstTextNode=prevNode;
+ }
+ // before doing any change we need to check if we are going to remove an entity reference that doesn't contain just text
+ DOMNode* pCurrentNode=pWalker->getCurrentNode();
+ DOMNode* nextNode;
+ while((nextNode=pWalker->nextNode())!=NULL)
+ {
+ if(nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE)
+ break;
+ if(nextNode->getNodeType()==ENTITY_REFERENCE_NODE)
+ {
+ DOMTreeWalker* pInnerWalker=doc->createTreeWalker(nextNode, DOMNodeFilter::SHOW_ALL, NULL, true);
+ while(pInnerWalker->nextNode())
+ {
+ short nodeType=pInnerWalker->getCurrentNode()->getNodeType();
+ if(nodeType!=ENTITY_REFERENCE_NODE && nodeType!=TEXT_NODE && nodeType!=CDATA_SECTION_NODE)
+ throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
+ }
+ pInnerWalker->release();
+ }
+ }
+ DOMText* retVal=NULL;
+ // if the first node in the chain is a text node, replace its content, otherwise create a new node
+ if(newText && *newText)
+ {
+ if(!castToNodeImpl(pFirstTextNode)->isReadOnly() && (pFirstTextNode->getNodeType()==TEXT_NODE || pFirstTextNode->getNodeType()==CDATA_SECTION_NODE))
+ {
+ pFirstTextNode->setNodeValue(newText);
+ retVal=(DOMText*)pFirstTextNode;
+ }
+ else
+ {
+ if(getNodeType()==TEXT_NODE)
+ retVal=doc->createTextNode(newText);
+ else
+ retVal=doc->createCDATASection(newText);
+ pFirstTextNode->getParentNode()->insertBefore(retVal, pFirstTextNode);
+ }
+ }
+ // now delete all the following text nodes
+ pWalker->setCurrentNode(pCurrentNode);
+ while((nextNode=pWalker->nextNode())!=NULL)
+ {
+ if(nextNode->getNodeType()==ELEMENT_NODE || nextNode->getNodeType()==COMMENT_NODE || nextNode->getNodeType()==PROCESSING_INSTRUCTION_NODE)
+ break;
+ if(nextNode!=retVal)
+ {
+ // keep the tree walker valid
+ pWalker->previousNode();
+ nextNode->getParentNode()->removeChild(nextNode);
+ nextNode->release();
+ }
+ }
+ pWalker->release();
+ return retVal;
+}
+
+
+void DOMCDATASectionImpl::release()
+{
+ if (fNode.isOwned() && !fNode.isToBeReleased())
+ throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
+
+ DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
+
+ if (doc) {
+ fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
+ fCharacterData.releaseBuffer();
+ doc->release(this, DOMMemoryManager::CDATA_SECTION_OBJECT);
+ }
+ else {
+ // shouldn't reach here
+ throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
+ }
+}
+
+
+//
+// Delegation stubs for other DOM_Node inherited functions.
+//
+ DOMNode* DOMCDATASectionImpl::appendChild(DOMNode *newChild) {return fNode.appendChild (newChild); }
+ DOMNamedNodeMap* DOMCDATASectionImpl::getAttributes() const {return fNode.getAttributes (); }
+ DOMNodeList* DOMCDATASectionImpl::getChildNodes() const {return fNode.getChildNodes (); }
+ DOMNode* DOMCDATASectionImpl::getFirstChild() const {return fNode.getFirstChild (); }
+ DOMNode* DOMCDATASectionImpl::getLastChild() const {return fNode.getLastChild (); }
+ const XMLCh* DOMCDATASectionImpl::getLocalName() const {return fNode.getLocalName (); }
+ const XMLCh* DOMCDATASectionImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); }
+ DOMNode* DOMCDATASectionImpl::getNextSibling() const {return fChild.getNextSibling (); }
+ const XMLCh* DOMCDATASectionImpl::getNodeValue() const {return fCharacterData.getNodeValue (); }
+ DOMDocument* DOMCDATASectionImpl::getOwnerDocument() const {return fNode.getOwnerDocument(); }
+ const XMLCh* DOMCDATASectionImpl::getPrefix() const {return fNode.getPrefix (); }
+ DOMNode* DOMCDATASectionImpl::getParentNode() const {return fChild.getParentNode (this); }
+ DOMNode* DOMCDATASectionImpl::getPreviousSibling() const {return fChild.getPreviousSibling (this); }
+ bool DOMCDATASectionImpl::hasChildNodes() const {return fNode.hasChildNodes (); }
+ DOMNode* DOMCDATASectionImpl::insertBefore(DOMNode *newChild, DOMNode *refChild)
+ {return fNode.insertBefore (newChild, refChild); }
+ void DOMCDATASectionImpl::normalize() {fNode.normalize (); }
+ DOMNode* DOMCDATASectionImpl::removeChild(DOMNode *oldChild) {return fNode.removeChild (oldChild); }
+ DOMNode* DOMCDATASectionImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild)
+ {return fNode.replaceChild (newChild, oldChild); }
+ bool DOMCDATASectionImpl::isSupported(const XMLCh *feature, const XMLCh *version) const
+ {return fNode.isSupported (feature, version); }
+ void DOMCDATASectionImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); }
+ bool DOMCDATASectionImpl::hasAttributes() const {return fNode.hasAttributes(); }
+ bool DOMCDATASectionImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); }
+ bool DOMCDATASectionImpl::isEqualNode(const DOMNode* arg) const {return fNode.isEqualNode(arg); }
+ void* DOMCDATASectionImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler)
+ {return fNode.setUserData(key, data, handler); }
+ void* DOMCDATASectionImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); }
+ const XMLCh* DOMCDATASectionImpl::getBaseURI() const {return fNode.getBaseURI(); }
+ short DOMCDATASectionImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); }
+ const XMLCh* DOMCDATASectionImpl::getTextContent() const {return fNode.getTextContent(); }
+ void DOMCDATASectionImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); }
+ const XMLCh* DOMCDATASectionImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); }
+ bool DOMCDATASectionImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); }
+ const XMLCh* DOMCDATASectionImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); }
+ void* DOMCDATASectionImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); }
+
+
+
+//
+// Delegation of CharacerData functions.
+//
+
+
+ const XMLCh* DOMCDATASectionImpl::getData() const {return fCharacterData.getData();}
+ XMLSize_t DOMCDATASectionImpl::getLength() const {return fCharacterData.getLength();}
+ const XMLCh* DOMCDATASectionImpl::substringData(XMLSize_t offset, XMLSize_t count) const
+ {return fCharacterData.substringData(this, offset, count);}
+ void DOMCDATASectionImpl::appendData(const XMLCh *arg) {fCharacterData.appendData(this, arg);}
+ void DOMCDATASectionImpl::insertData(XMLSize_t offset, const XMLCh *arg)
+ {fCharacterData.insertData(this, offset, arg);}
+ void DOMCDATASectionImpl::deleteData(XMLSize_t offset, XMLSize_t count)
+ {fCharacterData.deleteData(this, offset, count);}
+ void DOMCDATASectionImpl::replaceData(XMLSize_t offset, XMLSize_t count, const XMLCh *arg)
+ {fCharacterData.replaceData(this, offset, count, arg);}
+ void DOMCDATASectionImpl::setData(const XMLCh *data) {fCharacterData.setData(this, data);}
+ void DOMCDATASectionImpl::setNodeValue(const XMLCh *nodeValue) {fCharacterData.setNodeValue (this, nodeValue); }
+
+XERCES_CPP_NAMESPACE_END
diff --git a/include/xercesc/dom/impl/DOMCDATASectionImpl.hpp b/include/xercesc/dom/impl/DOMCDATASectionImpl.hpp
new file mode 100644
index 0000000..b8711ae
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMCDATASectionImpl.hpp
@@ -0,0 +1,98 @@
+/*
+ * 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: DOMCDATASectionImpl.hpp 678709 2008-07-22 10:56:56Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMCDATASECTIONIMPL_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMCDATASECTIONIMPL_HPP
+
+//
+// This file is part of the internal implementation of the C++ XML DOM.
+// It should NOT be included or used directly by application programs.
+//
+// Applications should include the file for the entire
+// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
+// name is substituded for the *.
+//
+
+
+#include
+#include
+#include "DOMNodeImpl.hpp"
+#include "DOMChildNode.hpp"
+#include "DOMParentNode.hpp"
+#include "DOMCharacterDataImpl.hpp"
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class CDOM_EXPORT DOMCDATASectionImpl: public DOMCDATASection {
+protected:
+ DOMNodeImpl fNode;
+ DOMChildNode fChild;
+ DOMCharacterDataImpl fCharacterData;
+
+
+public:
+ DOMCDATASectionImpl(DOMDocument *ownerDoc, const XMLCh* data);
+ DOMCDATASectionImpl(DOMDocument *ownerDoc, const XMLCh* data, XMLSize_t n);
+ DOMCDATASectionImpl(const DOMCDATASectionImpl &other, bool deep = false);
+
+ virtual ~DOMCDATASectionImpl();
+
+ // Functions inherited from TEXT
+ virtual DOMText* splitText(XMLSize_t offset);
+ // DOM Level 3
+ virtual bool getIsElementContentWhitespace() const;
+ virtual const XMLCh* getWholeText() const;
+ virtual DOMText* replaceWholeText(const XMLCh* content);
+
+ // non-standard extension
+ virtual bool isIgnorableWhitespace() const;
+
+
+public:
+ // Declare all of the functions from DOMNode.
+ DOMNODE_FUNCTIONS;
+
+public:
+ // Functions introduced by DOMCharacterData
+ virtual const XMLCh* getData() const;
+ virtual XMLSize_t getLength() const;
+ virtual const XMLCh* substringData(XMLSize_t offset,
+ XMLSize_t count) const;
+ virtual void appendData(const XMLCh *arg);
+ virtual void insertData(XMLSize_t offset, const XMLCh *arg);
+ virtual void deleteData(XMLSize_t offset,
+ XMLSize_t count);
+ virtual void replaceData(XMLSize_t offset,
+ XMLSize_t count,
+ const XMLCh *arg);
+ virtual void setData(const XMLCh *data);
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ DOMCDATASectionImpl & operator = (const DOMCDATASectionImpl &);
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/impl/DOMCasts.hpp b/include/xercesc/dom/impl/DOMCasts.hpp
new file mode 100644
index 0000000..6350278
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMCasts.hpp
@@ -0,0 +1,146 @@
+/*
+ * 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: DOMCasts.hpp 673975 2008-07-04 09:23:56Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMCASTS_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMCASTS_HPP
+
+//
+// This file is part of the internal implementation of the C++ XML DOM.
+// It should NOT be included or used directly by application programs.
+//
+// Applications should include the file for the entire
+// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
+// name is substituded for the *.
+//
+
+//
+// Define inline casting functions to convert from
+// (DOMNode *) to DOMParentNode or DOMChildNode *.
+//
+// This requires knowledge of the structure of the fields of
+// for all node types. There are three categories -
+//
+// Nodetypes that can have children and can be a child themselves.
+// e.g. Elements
+//
+// Object
+// DOMNodeImpl fNode;
+// DOMParentNode fParent;
+// DOMChildNode fChild;
+// ... // other fields, depending on node type.
+//
+// Nodetypes that can not have children, e.g. TEXT
+//
+// Object
+// DOMNodeImpl fNode;
+// DOMChildNode fChild;
+// ... // other fields, depending on node type
+//
+// Nodetypes that can not be a child of other nodes, but that can
+// have children (are a parent) e.g. ATTR
+// Object
+// DOMNodeImpl fNode;
+// DOMParentNode fParent
+// ... // other fields, depending on node type
+//
+// The casting functions make these assumptions:
+// 1. The cast is possible. Using code will not attempt to
+// cast to something that does not exist, such as the child
+// part of an ATTR
+//
+// 2. The nodes belong to this implementation.
+//
+// Some of the casts use the LEAFNODE flag in the common fNode part to
+// determine whether an fParent field exists, and thus the
+// position of the fChild part within the node.
+//
+// These functions also cast off const. It was either do that, or make
+// a second overloaded set that took and returned const arguements.
+//
+
+//
+// Note that using offsetof, or taking the offset of an object member at
+// a 0 address, is now undefined in C++. And gcc now warns about this behavior.
+// This is because doing do so is unreliable for some types of objects.
+// See: http://gcc.gnu.org/ml/gcc/2004-06/msg00227.html
+// : http://gcc.gnu.org/ml/gcc-bugs/2000-03/msg00805.html
+// The casting code below works around gcc's warnings by using a dummy
+// pointer, which the compiler cannot tell is null. The defeats the warning,
+// but also masks the potential problem.
+// The gcc option -Wno-invalid-offsetof may also be used to turn off this warning.
+//
+
+#include "DOMElementImpl.hpp"
+#include "DOMTextImpl.hpp"
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+static inline DOMNodeImpl *castToNodeImpl(const DOMNode *p)
+{
+ DOMElementImpl *pE = (DOMElementImpl *)p;
+ return &(pE->fNode);
+}
+
+
+static inline DOMParentNode *castToParentImpl(const DOMNode *p) {
+ DOMElementImpl *pE = (DOMElementImpl *)p;
+ return &(pE->fParent);
+}
+
+
+static inline DOMChildNode *castToChildImpl(const DOMNode *p) {
+ DOMElementImpl *pE = (DOMElementImpl *)p;
+ if (pE->fNode.isLeafNode()) {
+ DOMTextImpl *pT = (DOMTextImpl *)p;
+ return &(pT->fChild);
+ }
+ return &(pE->fChild);
+}
+
+
+static inline DOMNode *castToNode(const DOMParentNode *p ) {
+ DOMElementImpl* dummy = 0;
+ XMLSize_t parentOffset = (char *)&(dummy->fParent) - (char *)dummy;
+ char *retPtr = (char *)p - parentOffset;
+ return (DOMNode *)retPtr;
+}
+
+static inline DOMNode *castToNode(const DOMNodeImpl *p) {
+ DOMElementImpl* dummy = 0;
+ XMLSize_t nodeImplOffset = (char *)&(dummy->fNode) - (char *)dummy;
+ char *retPtr = (char *)p - nodeImplOffset;
+ return (DOMNode *)retPtr;
+}
+
+
+static inline DOMNodeImpl *castToNodeImpl(const DOMParentNode *p)
+{
+ DOMElementImpl* dummy = 0;
+ XMLSize_t nodeImplOffset = (char *)&(dummy->fNode) - (char *)dummy;
+ XMLSize_t parentOffset = (char *)&(dummy->fParent) - (char *)dummy;
+ char *retPtr = (char *)p - parentOffset + nodeImplOffset;
+ return (DOMNodeImpl *)retPtr;
+}
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/impl/DOMCharacterDataImpl.cpp b/include/xercesc/dom/impl/DOMCharacterDataImpl.cpp
new file mode 100644
index 0000000..bf093ca
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMCharacterDataImpl.cpp
@@ -0,0 +1,318 @@
+/*
+ * 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: DOMCharacterDataImpl.cpp 678766 2008-07-22 14:00:16Z borisk $
+ */
+
+#include "DOMCharacterDataImpl.hpp"
+#include
+#include
+#include "DOMRangeImpl.hpp"
+#include "DOMDocumentImpl.hpp"
+#include "DOMCasts.hpp"
+#include "DOMStringPool.hpp"
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+DOMCharacterDataImpl::DOMCharacterDataImpl(DOMDocument *doc, const XMLCh *dat)
+{
+ fDoc = (DOMDocumentImpl*)doc;
+
+ XMLSize_t len=XMLString::stringLen(dat);
+ fDataBuf = fDoc->popBuffer(len+1);
+ if (!fDataBuf)
+ fDataBuf = new (fDoc) DOMBuffer(fDoc, len+15);
+ fDataBuf->set(dat, len);
+}
+
+DOMCharacterDataImpl::
+DOMCharacterDataImpl(DOMDocument *doc, const XMLCh* dat, XMLSize_t len)
+{
+ fDoc = (DOMDocumentImpl*)doc;
+
+ fDataBuf = fDoc->popBuffer(len+1);
+
+ if (!fDataBuf)
+ fDataBuf = new (fDoc) DOMBuffer(fDoc, len+15);
+
+ fDataBuf->set(dat, len);
+}
+
+DOMCharacterDataImpl::DOMCharacterDataImpl(const DOMCharacterDataImpl &other)
+{
+ fDoc = (DOMDocumentImpl*)other.fDoc;
+
+ XMLSize_t len=other.getLength();
+ fDataBuf = fDoc->popBuffer(len+1);
+ if (!fDataBuf)
+ fDataBuf = new (fDoc) DOMBuffer(fDoc, len+15);
+ fDataBuf->set(other.fDataBuf->getRawBuffer(), len);
+}
+
+
+DOMCharacterDataImpl::~DOMCharacterDataImpl() {
+}
+
+
+const XMLCh * DOMCharacterDataImpl::getNodeValue() const
+{
+ return fDataBuf->getRawBuffer();
+}
+
+
+void DOMCharacterDataImpl::setNodeValue(const DOMNode *node, const XMLCh *value)
+{
+ if (castToNodeImpl(node)->isReadOnly())
+ throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
+ fDataBuf->set(value);
+
+ DOMDocumentImpl *doc = (DOMDocumentImpl *)node->getOwnerDocument();
+ if (doc != 0) {
+ Ranges* ranges = doc->getRanges();
+ if (ranges != 0) {
+ XMLSize_t sz = ranges->size();
+ if (sz != 0) {
+ for (XMLSize_t i =0; ielementAt(i)->receiveReplacedText((DOMNode*)node);
+ }
+ }
+ }
+ }
+}
+
+
+void DOMCharacterDataImpl::appendData(const DOMNode *node, const XMLCh *dat)
+{
+ if(castToNodeImpl(node)->isReadOnly())
+ throw DOMException(
+ DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
+
+ fDataBuf->append(dat);
+}
+
+void DOMCharacterDataImpl::appendData(const DOMNode *node, const XMLCh *dat, XMLSize_t n)
+{
+ if(castToNodeImpl(node)->isReadOnly())
+ throw DOMException(
+ DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
+
+ fDataBuf->append(dat, n);
+}
+
+void DOMCharacterDataImpl::deleteData(const DOMNode *node, XMLSize_t offset, XMLSize_t count)
+{
+ if (castToNodeImpl(node)->isReadOnly())
+ throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
+
+ // Note: the C++ XMLCh * operation throws the correct DOMExceptions
+ // when parameter values are bad.
+ //
+
+ XMLSize_t len = this->fDataBuf->getLen();
+ if (offset > len)
+ throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMCharacterDataImplMemoryManager);
+
+
+
+ // Cap the value of delLength to avoid trouble with overflows
+ // in the following length computations.
+ if (count > len)
+ count = len;
+
+ // If the length of data to be deleted would extend off the end
+ // of the string, cut it back to stop at the end of string.
+ if (offset + count >= len)
+ count = len - offset;
+
+ XMLSize_t newLen = len - count;
+
+ XMLCh* newString;
+ XMLCh temp[4096];
+ if (newLen >= 4095)
+ newString = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate
+ (
+ (newLen+1) * sizeof(XMLCh)
+ );//new XMLCh[newLen+1];
+ else
+ newString = temp;
+
+ XMLString::copyNString(newString, fDataBuf->getRawBuffer(), offset);
+ XMLString::copyString(newString+offset, fDataBuf->getRawBuffer()+offset+count);
+
+ fDataBuf->set(newString);
+
+ if (newLen >= 4095)
+ XMLPlatformUtils::fgMemoryManager->deallocate(newString);//delete[] newString;
+
+ // We don't delete the old string (doesn't work), or alter
+ // the old string (may be shared)
+ // It just hangs around, possibly orphaned.
+
+ DOMDocumentImpl *doc = (DOMDocumentImpl *)node->getOwnerDocument();
+ if (doc != 0) {
+ Ranges* ranges = doc->getRanges();
+ if (ranges != 0) {
+ XMLSize_t sz = ranges->size();
+ if (sz != 0) {
+ for (XMLSize_t i =0; ielementAt(i)->updateRangeForDeletedText( (DOMNode*)node, offset, count);
+ }
+ }
+ }
+ }
+}
+
+
+
+const XMLCh *DOMCharacterDataImpl::getData() const
+{
+ return fDataBuf->getRawBuffer();
+}
+
+
+//
+// getCharDataLength - return the length of the character data string.
+//
+XMLSize_t DOMCharacterDataImpl::getLength() const
+{
+ return fDataBuf->getLen();
+}
+
+
+
+void DOMCharacterDataImpl::insertData(const DOMNode *node, XMLSize_t offset, const XMLCh *dat)
+{
+ if (castToNodeImpl(node)->isReadOnly())
+ throw DOMException(
+ DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
+
+ // Note: the C++ XMLCh * operation throws the correct DOMExceptions
+ // when parameter values are bad.
+ //
+
+ XMLSize_t len = fDataBuf->getLen();
+ if (offset > len)
+ throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMCharacterDataImplMemoryManager);
+
+ XMLSize_t datLen = XMLString::stringLen(dat);
+
+ XMLSize_t newLen = len + datLen;
+
+ XMLCh* newString;
+ XMLCh temp[4096];
+ if (newLen >= 4095)
+ newString = (XMLCh*) XMLPlatformUtils::fgMemoryManager->allocate
+ (
+ (newLen + 1) * sizeof(XMLCh)
+ );//new XMLCh[newLen+1];
+ else
+ newString = temp;
+
+ XMLString::copyNString(newString, fDataBuf->getRawBuffer(), offset);
+ XMLString::copyNString(newString+offset, dat, datLen);
+ XMLString::copyString(newString+offset+datLen, fDataBuf->getRawBuffer()+offset);
+
+ fDataBuf->set(newString);
+
+ if (newLen >= 4095)
+ XMLPlatformUtils::fgMemoryManager->deallocate(newString);//delete[] newString;
+
+ DOMDocumentImpl *doc = (DOMDocumentImpl *)node->getOwnerDocument();
+ if (doc != 0) {
+ Ranges* ranges = doc->getRanges();
+ if (ranges != 0) {
+ XMLSize_t sz = ranges->size();
+ if (sz != 0) {
+ for (XMLSize_t i =0; ielementAt(i)->updateRangeForInsertedText( (DOMNode*)node, offset, datLen);
+ }
+ }
+ }
+ }
+}
+
+
+
+void DOMCharacterDataImpl::replaceData(const DOMNode *node, XMLSize_t offset, XMLSize_t count,
+ const XMLCh *dat)
+{
+ if (castToNodeImpl(node)->isReadOnly())
+ throw DOMException(
+ DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
+
+ deleteData(node, offset, count);
+ insertData(node, offset, dat);
+}
+
+
+
+
+void DOMCharacterDataImpl::setData(const DOMNode *node, const XMLCh *arg)
+{
+ setNodeValue(node, arg);
+}
+
+
+
+
+
+const XMLCh * DOMCharacterDataImpl::substringData(const DOMNode *node, XMLSize_t offset,
+ XMLSize_t count) const
+{
+
+ // Note: the C++ XMLCh * operation throws the correct DOMExceptions
+ // when parameter values are bad.
+ //
+
+
+ XMLSize_t len = fDataBuf->getLen();
+
+ if (offset > len)
+ throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMCharacterDataImplMemoryManager);
+
+ DOMDocumentImpl *doc = (DOMDocumentImpl *)node->getOwnerDocument();
+
+ XMLCh* newString;
+ XMLCh temp[4096];
+ if (len >= 4095)
+ newString = (XMLCh*) doc->getMemoryManager()->allocate
+ (
+ (len + 1) * sizeof(XMLCh)
+ );//new XMLCh[len+1];
+ else
+ newString = temp;
+
+ XMLString::copyNString(newString, fDataBuf->getRawBuffer()+offset, count);
+ newString[count] = chNull;
+
+ const XMLCh* retString = doc->getPooledString(newString);
+
+ if (len >= 4095)
+ doc->getMemoryManager()->deallocate(newString);//delete[] newString;
+
+ return retString;
+
+}
+
+
+void DOMCharacterDataImpl::releaseBuffer() {
+ fDoc->releaseBuffer(fDataBuf);
+}
+
+XERCES_CPP_NAMESPACE_END
diff --git a/include/xercesc/dom/impl/DOMCharacterDataImpl.hpp b/include/xercesc/dom/impl/DOMCharacterDataImpl.hpp
new file mode 100644
index 0000000..64bdf5e
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMCharacterDataImpl.hpp
@@ -0,0 +1,89 @@
+/*
+ * 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: DOMCharacterDataImpl.hpp 678709 2008-07-22 10:56:56Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMCHARACTERDATAIMPL_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMCHARACTERDATAIMPL_HPP
+
+//
+// This file is part of the internal implementation of the C++ XML DOM.
+// It should NOT be included or used directly by application programs.
+//
+// Applications should include the file for the entire
+// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
+// name is substituded for the *.
+//
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMNode;
+class DOMDocument;
+class DOMDocumentImpl;
+class DOMBuffer;
+
+// Instances of DOMCharacterDataImpl appear as members of node types
+// that implement the DOMCharacterData interfaces.
+// Operations in those classes are delegated to this class.
+//
+class CDOM_EXPORT DOMCharacterDataImpl
+{
+public:
+ DOMBuffer* fDataBuf;
+ // for the buffer bid
+ DOMDocumentImpl* fDoc;
+
+public:
+ DOMCharacterDataImpl(DOMDocument *doc, const XMLCh *dat);
+ DOMCharacterDataImpl(DOMDocument *doc, const XMLCh* data, XMLSize_t n);
+ DOMCharacterDataImpl(const DOMCharacterDataImpl &other);
+ ~DOMCharacterDataImpl();
+ const XMLCh * getNodeValue() const;
+ void setNodeValue(const XMLCh * value);
+ void appendData(const DOMNode *node, const XMLCh *data);
+ void appendData(const DOMNode *node, const XMLCh *data, XMLSize_t n);
+ void deleteData(const DOMNode *node, XMLSize_t offset, XMLSize_t count);
+ const XMLCh* getData() const;
+ XMLSize_t getLength() const;
+ void insertData(const DOMNode *node, XMLSize_t offset, const XMLCh * data);
+ void replaceData(const DOMNode *node, XMLSize_t offset, XMLSize_t count, const XMLCh * data);
+ void setData(const DOMNode *node, const XMLCh * arg);
+ void setNodeValue(const DOMNode *node, const XMLCh *value);
+
+
+ const XMLCh* substringData(const DOMNode *node, XMLSize_t offset, XMLSize_t count) const;
+ void releaseBuffer();
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ DOMCharacterDataImpl & operator = (const DOMCharacterDataImpl &);
+};
+
+#define GetDOMCharacterDataImplMemoryManager GET_DIRECT_MM(fDoc)
+
+XERCES_CPP_NAMESPACE_END
+
+
+#endif
diff --git a/include/xercesc/dom/impl/DOMChildNode.cpp b/include/xercesc/dom/impl/DOMChildNode.cpp
new file mode 100644
index 0000000..0ed42f6
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMChildNode.cpp
@@ -0,0 +1,78 @@
+/*
+ * 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: DOMChildNode.cpp 471747 2006-11-06 14:31:56Z amassari $
+ */
+
+// This class only adds the ability to have siblings
+
+#include
+#include "DOMNodeImpl.hpp"
+#include "DOMChildNode.hpp"
+#include "DOMCasts.hpp"
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+DOMChildNode::DOMChildNode()
+{
+ this->previousSibling = 0;
+ this->nextSibling = 0;
+}
+
+// This only makes a shallow copy, cloneChildren must also be called for a
+// deep clone
+DOMChildNode::DOMChildNode(const DOMChildNode &)
+{
+ // Need to break the association w/ original siblings and parent
+ this->previousSibling = 0;
+ this->nextSibling = 0;
+}
+
+DOMChildNode::~DOMChildNode() {
+}
+
+
+DOMNode * DOMChildNode::getNextSibling() const {
+ return nextSibling;
+}
+
+//
+// Note: for getParentNode and getPreviousSibling(), below, an
+// extra paramter "thisNode" is required. This is because there
+// is no way to cast from a DOMChildNode pointer back to the
+// DOMNodeImpl that it is part of. Our "this" may or may not
+// be preceded by a fParent in the object layout, and there's no
+// practical way to tell, so we just take an extra parameter instead.
+
+DOMNode * DOMChildNode::getParentNode(const DOMNode *thisNode) const
+{
+ // if we have an owner, ownerNode is our parent, otherwise it's
+ // our ownerDocument and we don't have a parent
+ DOMNodeImpl *thisNodeImpl = castToNodeImpl(thisNode);
+ return thisNodeImpl->isOwned() ? thisNodeImpl->fOwnerNode : 0;
+}
+
+DOMNode * DOMChildNode::getPreviousSibling(const DOMNode *thisNode) const {
+ // if we are the firstChild, previousSibling actually refers to our
+ // parent's lastChild, but we hide that
+ return castToNodeImpl(thisNode)->isFirstChild() ? 0 : previousSibling;
+}
+
+XERCES_CPP_NAMESPACE_END
+
diff --git a/include/xercesc/dom/impl/DOMChildNode.hpp b/include/xercesc/dom/impl/DOMChildNode.hpp
new file mode 100644
index 0000000..e7c1812
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMChildNode.hpp
@@ -0,0 +1,72 @@
+/*
+ * 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: DOMChildNode.hpp 527149 2007-04-10 14:56:39Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMCHILDNODE_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMCHILDNODE_HPP
+
+//
+// This file is part of the internal implementation of the C++ XML DOM.
+// It should NOT be included or used directly by application programs.
+//
+// Applications should include the file for the entire
+// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
+// name is substituded for the *.
+//
+
+/**
+ * ChildNode adds to NodeImpl the capability of being a child, this is having
+ * siblings.
+ **/
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMDocument;
+class DOMNode;
+
+
+class CDOM_EXPORT DOMChildNode {
+
+public:
+ DOMNode *previousSibling;
+ DOMNode *nextSibling;
+
+ DOMChildNode();
+ DOMChildNode(const DOMChildNode &other);
+ ~DOMChildNode();
+
+ DOMNode * getNextSibling() const;
+ DOMNode * getParentNode(const DOMNode *thisNode) const;
+ DOMNode * getPreviousSibling(const DOMNode *thisNode) const;
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ DOMChildNode & operator = (const DOMChildNode &);
+};
+
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/impl/DOMCommentImpl.cpp b/include/xercesc/dom/impl/DOMCommentImpl.cpp
new file mode 100644
index 0000000..b8fa540
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMCommentImpl.cpp
@@ -0,0 +1,189 @@
+/*
+ * 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: DOMCommentImpl.cpp 678381 2008-07-21 10:15:01Z borisk $
+ */
+
+#include "DOMCommentImpl.hpp"
+#include "DOMCharacterDataImpl.hpp"
+#include "DOMStringPool.hpp"
+#include "DOMCasts.hpp"
+#include "DOMDocumentImpl.hpp"
+#include "DOMRangeImpl.hpp"
+#include
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+DOMCommentImpl::DOMCommentImpl(DOMDocument *ownerDoc, const XMLCh *dat)
+ : fNode(ownerDoc), fCharacterData(ownerDoc, dat)
+{
+ fNode.setIsLeafNode(true);
+}
+
+
+DOMCommentImpl::DOMCommentImpl(const DOMCommentImpl &other, bool)
+
+ : fNode(other.fNode),
+ fChild(other.fChild),
+ fCharacterData(other.fCharacterData)
+{
+ fNode.setIsLeafNode(true);
+}
+
+
+DOMCommentImpl::~DOMCommentImpl() {
+}
+
+
+
+DOMNode * DOMCommentImpl::cloneNode(bool deep) const
+{
+ DOMNode* newNode = new (getOwnerDocument(), DOMMemoryManager::COMMENT_OBJECT) DOMCommentImpl(*this, deep);
+ fNode.callUserDataHandlers(DOMUserDataHandler::NODE_CLONED, this, newNode);
+ return newNode;
+}
+
+
+const XMLCh * DOMCommentImpl::getNodeName() const {
+ static const XMLCh gComment[] =
+ {chPound, chLatin_c, chLatin_o, chLatin_m, chLatin_m, chLatin_e,chLatin_n, chLatin_t, 0};
+ return gComment;
+}
+
+DOMNode::NodeType DOMCommentImpl::getNodeType() const {
+ return DOMNode::COMMENT_NODE;
+}
+
+void DOMCommentImpl::release()
+{
+ if (fNode.isOwned() && !fNode.isToBeReleased())
+ throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
+
+ DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
+ if (doc) {
+ fNode.callUserDataHandlers(DOMUserDataHandler::NODE_DELETED, 0, 0);
+ fCharacterData.releaseBuffer();
+ doc->release(this, DOMMemoryManager::COMMENT_OBJECT);
+ }
+ else {
+ // shouldn't reach here
+ throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
+ }
+}
+
+
+// Non standard extension for the range to work
+DOMComment *DOMCommentImpl::splitText(XMLSize_t offset)
+{
+ if (fNode.isReadOnly())
+ {
+ throw DOMException(
+ DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
+ }
+ XMLSize_t len = fCharacterData.fDataBuf->getLen();
+ if (offset > len)
+ throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMNodeMemoryManager);
+
+ DOMDocumentImpl *doc = (DOMDocumentImpl *)getOwnerDocument();
+ DOMComment *newText =
+ doc->createComment(this->substringData(offset, len - offset));
+
+ DOMNode *parent = getParentNode();
+ if (parent != 0)
+ parent->insertBefore(newText, getNextSibling());
+
+ fCharacterData.fDataBuf->chop(offset);
+
+ if (doc != 0) {
+ Ranges* ranges = doc->getRanges();
+ if (ranges != 0) {
+ XMLSize_t sz = ranges->size();
+ if (sz != 0) {
+ for (XMLSize_t i =0; ielementAt(i)->updateSplitInfo( this, newText, offset);
+ }
+ }
+ }
+ }
+
+ return newText;
+}
+
+
+ DOMNode* DOMCommentImpl::appendChild(DOMNode *newChild) {return fNode.appendChild (newChild); }
+ DOMNamedNodeMap* DOMCommentImpl::getAttributes() const {return fNode.getAttributes (); }
+ DOMNodeList* DOMCommentImpl::getChildNodes() const {return fNode.getChildNodes (); }
+ DOMNode* DOMCommentImpl::getFirstChild() const {return fNode.getFirstChild (); }
+ DOMNode* DOMCommentImpl::getLastChild() const {return fNode.getLastChild (); }
+ const XMLCh* DOMCommentImpl::getLocalName() const {return fNode.getLocalName (); }
+ const XMLCh* DOMCommentImpl::getNamespaceURI() const {return fNode.getNamespaceURI (); }
+ DOMNode* DOMCommentImpl::getNextSibling() const {return fChild.getNextSibling (); }
+ const XMLCh* DOMCommentImpl::getNodeValue() const {return fCharacterData.getNodeValue (); }
+ DOMDocument* DOMCommentImpl::getOwnerDocument() const {return fNode.getOwnerDocument (); }
+ const XMLCh* DOMCommentImpl::getPrefix() const {return fNode.getPrefix (); }
+ DOMNode* DOMCommentImpl::getParentNode() const {return fChild.getParentNode (this); }
+ DOMNode* DOMCommentImpl::getPreviousSibling() const {return fChild.getPreviousSibling (this); }
+ bool DOMCommentImpl::hasChildNodes() const {return fNode.hasChildNodes (); }
+ DOMNode* DOMCommentImpl::insertBefore(DOMNode *newChild, DOMNode *refChild)
+ {return fNode.insertBefore (newChild, refChild); }
+ void DOMCommentImpl::normalize() {fNode.normalize (); }
+ DOMNode* DOMCommentImpl::removeChild(DOMNode *oldChild) {return fNode.removeChild (oldChild); }
+ DOMNode* DOMCommentImpl::replaceChild(DOMNode *newChild, DOMNode *oldChild)
+ {return fNode.replaceChild (newChild, oldChild); }
+ bool DOMCommentImpl::isSupported(const XMLCh *feature, const XMLCh *version) const
+ {return fNode.isSupported (feature, version); }
+ void DOMCommentImpl::setPrefix(const XMLCh *prefix) {fNode.setPrefix(prefix); }
+ bool DOMCommentImpl::hasAttributes() const {return fNode.hasAttributes(); }
+ bool DOMCommentImpl::isSameNode(const DOMNode* other) const {return fNode.isSameNode(other); }
+ bool DOMCommentImpl::isEqualNode(const DOMNode* arg) const {return fNode.isEqualNode(arg); }
+ void* DOMCommentImpl::setUserData(const XMLCh* key, void* data, DOMUserDataHandler* handler)
+ {return fNode.setUserData(key, data, handler); }
+ void* DOMCommentImpl::getUserData(const XMLCh* key) const {return fNode.getUserData(key); }
+ const XMLCh* DOMCommentImpl::getBaseURI() const {return fNode.getBaseURI(); }
+ short DOMCommentImpl::compareDocumentPosition(const DOMNode* other) const {return fNode.compareDocumentPosition(other); }
+ const XMLCh* DOMCommentImpl::getTextContent() const {return fNode.getTextContent(); }
+ void DOMCommentImpl::setTextContent(const XMLCh* textContent){fNode.setTextContent(textContent); }
+ const XMLCh* DOMCommentImpl::lookupPrefix(const XMLCh* namespaceURI) const {return fNode.lookupPrefix(namespaceURI); }
+ bool DOMCommentImpl::isDefaultNamespace(const XMLCh* namespaceURI) const {return fNode.isDefaultNamespace(namespaceURI); }
+ const XMLCh* DOMCommentImpl::lookupNamespaceURI(const XMLCh* prefix) const {return fNode.lookupNamespaceURI(prefix); }
+ void* DOMCommentImpl::getFeature(const XMLCh* feature, const XMLCh* version) const {return fNode.getFeature(feature, version); }
+
+
+
+//
+// Delegation of CharacerData functions.
+//
+
+
+ const XMLCh* DOMCommentImpl::getData() const {return fCharacterData.getData();}
+ XMLSize_t DOMCommentImpl::getLength() const {return fCharacterData.getLength();}
+ const XMLCh* DOMCommentImpl::substringData(XMLSize_t offset, XMLSize_t count) const
+ {return fCharacterData.substringData(this, offset, count);}
+ void DOMCommentImpl::appendData(const XMLCh *arg) {fCharacterData.appendData(this, arg);}
+ void DOMCommentImpl::insertData(XMLSize_t offset, const XMLCh *arg)
+ {fCharacterData.insertData(this, offset, arg);}
+ void DOMCommentImpl::deleteData(XMLSize_t offset, XMLSize_t count)
+ {fCharacterData.deleteData(this, offset, count);}
+ void DOMCommentImpl::replaceData(XMLSize_t offset, XMLSize_t count, const XMLCh *arg)
+ {fCharacterData.replaceData(this, offset, count, arg);}
+ void DOMCommentImpl::setData(const XMLCh *data) {fCharacterData.setData(this, data);}
+ void DOMCommentImpl::setNodeValue(const XMLCh *nodeValue) {fCharacterData.setNodeValue (this, nodeValue); }
+
+XERCES_CPP_NAMESPACE_END
diff --git a/include/xercesc/dom/impl/DOMCommentImpl.hpp b/include/xercesc/dom/impl/DOMCommentImpl.hpp
new file mode 100644
index 0000000..e3cc62c
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMCommentImpl.hpp
@@ -0,0 +1,84 @@
+/*
+ * 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: DOMCommentImpl.hpp 676911 2008-07-15 13:27:32Z amassari $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMCOMMENTIMPL_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMCOMMENTIMPL_HPP
+
+//
+// This file is part of the internal implementation of the C++ XML DOM.
+// It should NOT be included or used directly by application programs.
+//
+// Applications should include the file for the entire
+// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
+// name is substituded for the *.
+//
+
+
+#include
+#include
+
+#include "DOMNodeImpl.hpp"
+#include "DOMChildNode.hpp"
+#include "DOMCharacterDataImpl.hpp"
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class CDOM_EXPORT DOMCommentImpl: public DOMComment {
+public:
+ DOMNodeImpl fNode;
+ DOMChildNode fChild;
+ DOMCharacterDataImpl fCharacterData;
+
+public:
+ DOMCommentImpl(DOMDocument *, const XMLCh *);
+ DOMCommentImpl(const DOMCommentImpl &other, bool deep);
+ virtual ~DOMCommentImpl();
+
+public:
+ // Declare all of the functions from DOMNode.
+ DOMNODE_FUNCTIONS;
+
+public:
+ // Functions from DOMCharacterData
+ virtual void appendData(const XMLCh *data);
+ virtual void deleteData(XMLSize_t offset, XMLSize_t count);
+ virtual const XMLCh * getData() const;
+ virtual XMLSize_t getLength() const;
+ virtual void insertData(XMLSize_t offset, const XMLCh * data);
+ virtual void replaceData(XMLSize_t offset, XMLSize_t count, const XMLCh * data);
+ virtual void setData(const XMLCh * arg);
+ virtual const XMLCh * substringData(XMLSize_t offset, XMLSize_t count) const;
+
+ // Non standard extension for the range to work
+ DOMComment* splitText(XMLSize_t offset);
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ DOMCommentImpl & operator = (const DOMCommentImpl &);
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
diff --git a/include/xercesc/dom/impl/DOMConfigurationImpl.cpp b/include/xercesc/dom/impl/DOMConfigurationImpl.cpp
new file mode 100644
index 0000000..fa4fb87
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMConfigurationImpl.cpp
@@ -0,0 +1,271 @@
+/*
+ * 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.
+ */
+
+#include "DOMConfigurationImpl.hpp"
+#include "DOMStringListImpl.hpp"
+#include
+#include
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+const unsigned short DOMConfigurationImpl::fDEFAULT_VALUES = 0x2596;
+
+DOMConfigurationImpl::DOMConfigurationImpl(MemoryManager* const manager): featureValues(fDEFAULT_VALUES),
+ fErrorHandler(0), fSchemaType(0), fSchemaLocation(0),
+ fSupportedParameters(0), fMemoryManager(manager)
+{
+ fSupportedParameters=new (fMemoryManager) DOMStringListImpl(17, fMemoryManager);
+ fSupportedParameters->add(XMLUni::fgDOMErrorHandler);
+ fSupportedParameters->add(XMLUni::fgDOMSchemaType);
+ fSupportedParameters->add(XMLUni::fgDOMSchemaLocation);
+ fSupportedParameters->add(XMLUni::fgDOMCanonicalForm);
+ fSupportedParameters->add(XMLUni::fgDOMCDATASections);
+ fSupportedParameters->add(XMLUni::fgDOMComments);
+ fSupportedParameters->add(XMLUni::fgDOMDatatypeNormalization);
+ fSupportedParameters->add(XMLUni::fgDOMWRTDiscardDefaultContent);
+ fSupportedParameters->add(XMLUni::fgDOMEntities);
+ fSupportedParameters->add(XMLUni::fgDOMInfoset);
+ fSupportedParameters->add(XMLUni::fgDOMNamespaces);
+ fSupportedParameters->add(XMLUni::fgDOMNamespaceDeclarations);
+ fSupportedParameters->add(XMLUni::fgDOMNormalizeCharacters);
+ fSupportedParameters->add(XMLUni::fgDOMSplitCDATASections);
+ fSupportedParameters->add(XMLUni::fgDOMValidate);
+ fSupportedParameters->add(XMLUni::fgDOMValidateIfSchema);
+ fSupportedParameters->add(XMLUni::fgDOMElementContentWhitespace);
+}
+
+DOMConfigurationImpl::~DOMConfigurationImpl() {
+ delete fSupportedParameters;
+}
+
+void DOMConfigurationImpl::setParameter(const XMLCh* name, const void* value) {
+ if(!canSetParameter(name, value)) {
+ throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, fMemoryManager);
+ }
+
+ if(XMLString::compareIStringASCII(name, XMLUni::fgDOMErrorHandler)==0) {
+ fErrorHandler = (DOMErrorHandler*)value;
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaType)==0) {
+ fSchemaType = (XMLCh*)value;
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaLocation)==0) {
+ fSchemaLocation = (XMLCh*)value;
+ } else { // canSetParameter above should take care of this case
+ throw DOMException(DOMException::NOT_FOUND_ERR, 0, fMemoryManager);
+ }
+
+}
+
+void DOMConfigurationImpl::setParameter(const XMLCh* name, bool value) {
+ if(!canSetParameter(name, value)) {
+ throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, fMemoryManager);
+ }
+
+ DOMConfigurationFeature whichFlag = getFeatureFlag(name);
+ if(value) {
+ featureValues |= whichFlag;
+ } else {
+ featureValues &= ~whichFlag;
+ }
+
+}
+
+// --------------------------------------
+// Getter Methods
+// --------------------------------------
+
+const void* DOMConfigurationImpl::getParameter(const XMLCh* name) const {
+ DOMConfigurationFeature whichFlag;
+ try {
+ whichFlag = getFeatureFlag(name);
+ if(featureValues & whichFlag) {
+ return (void*)true;
+ } else {
+ return (void*)false;
+ }
+ } catch (DOMException&) {
+ // must not be a boolean parameter
+ if(XMLString::compareIStringASCII(name, XMLUni::fgDOMErrorHandler)==0) {
+ return fErrorHandler;
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaType)==0) {
+ return fSchemaType;
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaLocation)==0) {
+ return fSchemaLocation;
+ } else {
+ throw DOMException(DOMException::NOT_FOUND_ERR, 0, fMemoryManager);
+ }
+ }
+
+}
+
+// -----------------------------------------
+// Query Methods
+// -----------------------------------------
+
+bool DOMConfigurationImpl::canSetParameter(const XMLCh* name, const void* /*value*/) const {
+
+ /**
+ * canSetParameter(name, value) returns false in two conditions:
+ * 1) if a [required] feature has no supporting code, then return false in
+ * both the true and false outcomes (This is in order to be either fully
+ * spec compliant, or not at all)
+ * 2) if an [optional] feature has no supporting code, then return false
+ **/
+
+ if(XMLString::compareIStringASCII(name, XMLUni::fgDOMErrorHandler)==0) {
+ return true; // required //
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaType)==0) {
+ return false; // optional //
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSchemaLocation)==0) {
+ return false; // optional //
+ }
+ return false;
+}
+
+bool DOMConfigurationImpl::canSetParameter(const XMLCh* name, bool booleanValue) const {
+ /**
+ * canSetParameter(name, value) returns false in two conditions:
+ * 1) if a [required] feature has no supporting code, then return false in
+ * both the true and false outcomes (This is in order to be either fully
+ * spec compliant, or not at all)
+ * 2) if an [optional] feature has no supporting code, then return false
+ **/
+
+ DOMConfigurationFeature whichFlag = getFeatureFlag(name);
+ switch (whichFlag) {
+ case FEATURE_CANONICAL_FORM:
+ if(booleanValue) return false; // optional //
+ else return true; // required //
+ case FEATURE_CDATA_SECTIONS:
+ return true;
+ case FEATURE_COMMENTS:
+ return true;
+ case FEATURE_DATATYPE_NORMALIZATION:
+ if(booleanValue) return false; // required //
+ else return true; // required //
+ case FEATURE_DISCARD_DEFAULT_CONTENT:
+ if(booleanValue) return false; // required //
+ else return true; // required //
+ case FEATURE_ENTITIES:
+ if(booleanValue) return true; // required //
+ else return true; // required //
+ case FEATURE_INFOSET:
+ if(booleanValue) return false; // required //
+ else return true; // no effect//
+ case FEATURE_NAMESPACES:
+ return true;
+ case FEATURE_NAMESPACE_DECLARATIONS:
+ if(booleanValue) return true; // optional //
+ else return false; // required //
+ case FEATURE_NORMALIZE_CHARACTERS:
+ if(booleanValue) return false; // optional //
+ else return true; // required //
+ case FEATURE_SPLIT_CDATA_SECTIONS:
+ //we dont report an error in the false case so we cant claim we do it
+ if(booleanValue) return false; // required //
+ else return false; // required //
+ case FEATURE_VALIDATE:
+ if(booleanValue) return false; // optional //
+ else return true; // required //
+ case FEATURE_VALIDATE_IF_SCHEMA:
+ if(booleanValue) return false; // optional //
+ else return true; // required //
+
+ case FEATURE_ELEMENT_CONTENT_WHITESPACE:
+ if(booleanValue) return true; // required //
+ else return false; // optional //
+ }
+ // should never be here
+ return false;
+}
+
+const DOMStringList* DOMConfigurationImpl::getParameterNames() const
+{
+ return fSupportedParameters;
+}
+
+// -------------------------------------------
+// Impl methods
+// -------------------------------------------
+
+DOMConfigurationImpl::DOMConfigurationFeature DOMConfigurationImpl::getFeatureFlag(const XMLCh* name) const {
+ if(XMLString::compareIStringASCII(name, XMLUni::fgDOMCanonicalForm)==0) {
+ return FEATURE_CANONICAL_FORM;
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMCDATASections )==0) {
+ return FEATURE_CDATA_SECTIONS;
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMComments)==0) {
+ return FEATURE_COMMENTS;
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMDatatypeNormalization)==0) {
+ return FEATURE_DATATYPE_NORMALIZATION;
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMWRTDiscardDefaultContent)==0) {
+ return FEATURE_DISCARD_DEFAULT_CONTENT;
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMEntities)==0) {
+ return FEATURE_ENTITIES;
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMInfoset)==0) {
+ return FEATURE_INFOSET;
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMNamespaces)==0) {
+ return FEATURE_NAMESPACES;
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMNamespaceDeclarations)==0) {
+ return FEATURE_NAMESPACE_DECLARATIONS;
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMNormalizeCharacters)==0) {
+ return FEATURE_NORMALIZE_CHARACTERS;
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMSplitCDATASections)==0) {
+ return FEATURE_SPLIT_CDATA_SECTIONS;
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMValidate)==0) {
+ return FEATURE_VALIDATE;
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMValidateIfSchema)==0) {
+ return FEATURE_VALIDATE_IF_SCHEMA;
+ } else if (XMLString::compareIStringASCII(name, XMLUni::fgDOMElementContentWhitespace)==0) {
+ return FEATURE_ELEMENT_CONTENT_WHITESPACE;
+ } else {
+ throw DOMException(DOMException::NOT_FOUND_ERR, 0, fMemoryManager);
+ }
+
+}
+
+DOMErrorHandler* DOMConfigurationImpl::getErrorHandler() const {
+ return fErrorHandler;
+}
+
+const XMLCh* DOMConfigurationImpl::getSchemaType() const {
+ return fSchemaType;
+}
+
+const XMLCh* DOMConfigurationImpl::getSchemaLocation() const {
+ return fSchemaLocation;
+}
+
+void DOMConfigurationImpl::setErrorHandler(DOMErrorHandler *erHandler) {
+ fErrorHandler = erHandler;
+}
+
+void DOMConfigurationImpl::setSchemaType(const XMLCh* st) {
+ fSchemaType = st;
+}
+
+void DOMConfigurationImpl::setSchemaLocation(const XMLCh* sl) {
+ fSchemaLocation = sl;
+}
+
+
+XERCES_CPP_NAMESPACE_END
+
+
+/**
+ * End of file DOMConfigurationImpl.cpp
+ */
diff --git a/include/xercesc/dom/impl/DOMConfigurationImpl.hpp b/include/xercesc/dom/impl/DOMConfigurationImpl.hpp
new file mode 100644
index 0000000..91033a1
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMConfigurationImpl.hpp
@@ -0,0 +1,150 @@
+/*
+ * 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.
+ */
+
+//
+// This file is part of the internal implementation of the C++ XML DOM.
+// It should NOT be included or used directly by application programs.
+//
+// Applications should include the file for the entire
+// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
+// name is substituded for the *.
+//
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMCONFIGURATIONIMPL_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMCONFIGURATIONIMPL_HPP
+
+//------------------------------------------------------------------------------------
+// Includes
+//------------------------------------------------------------------------------------
+#include
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+class DOMDocumentImpl;
+class DOMStringListImpl;
+
+class CDOM_EXPORT DOMConfigurationImpl : public DOMConfiguration
+{
+private:
+ //unimplemented
+ DOMConfigurationImpl(const DOMConfiguration &);
+ DOMConfigurationImpl & operator = (const DOMConfiguration &);
+
+
+public:
+
+ //-----------------------------------------------------------------------------------
+ // Constructor
+ //-----------------------------------------------------------------------------------
+ DOMConfigurationImpl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+ ~DOMConfigurationImpl();
+
+ enum DOMConfigurationFeature {
+ FEATURE_CANONICAL_FORM = 0x0001,
+ FEATURE_CDATA_SECTIONS = 0x0002,
+ FEATURE_COMMENTS = 0x0004,
+ FEATURE_DATATYPE_NORMALIZATION = 0x0008,
+ FEATURE_DISCARD_DEFAULT_CONTENT = 0x0010,
+ FEATURE_ENTITIES = 0x0020,
+ FEATURE_INFOSET = 0x0040,
+ FEATURE_NAMESPACES = 0x0080,
+ FEATURE_NAMESPACE_DECLARATIONS = 0x0100,
+ FEATURE_NORMALIZE_CHARACTERS = 0x0200,
+ FEATURE_SPLIT_CDATA_SECTIONS = 0x0400,
+ FEATURE_VALIDATE = 0x0800,
+ FEATURE_VALIDATE_IF_SCHEMA = 0x1000,
+ FEATURE_ELEMENT_CONTENT_WHITESPACE = 0x2000
+ };
+
+ unsigned short featureValues;
+
+ // -----------------------------------------------------------------------
+ // Setter methods
+ // -----------------------------------------------------------------------
+
+ virtual void setParameter(const XMLCh* name, const void* value);
+ virtual void setParameter(const XMLCh* name, bool value);
+
+ // -----------------------------------------------------------------------
+ // Getter methods
+ // -----------------------------------------------------------------------
+
+ virtual const void* getParameter(const XMLCh* name) const;
+
+
+ // -----------------------------------------------------------------------
+ // Query methods
+ // -----------------------------------------------------------------------
+
+ virtual bool canSetParameter(const XMLCh* name, const void* value) const;
+ virtual bool canSetParameter(const XMLCh* name, bool value) const;
+
+ virtual const DOMStringList* getParameterNames() const;
+
+ // ---------------------------------------------------------------------------
+ // Impl specific methods
+ // ---------------------------------------------------------------------------
+
+ /* specific get and set methods for non-boolean parameters
+ * */
+
+ DOMErrorHandler* getErrorHandler() const;
+
+ const XMLCh* getSchemaType() const;
+
+ const XMLCh* getSchemaLocation() const;
+
+ void setErrorHandler(DOMErrorHandler *erHandler);
+
+ void setSchemaType(const XMLCh* st);
+
+ void setSchemaLocation(const XMLCh* sl);
+
+ // The default values for the boolean parameters
+ // from CANONICAL_FORM to ELEMENT_CONTENT_WHITESPACE
+ // 10010110010110 = 0x2596
+ static const unsigned short fDEFAULT_VALUES;
+
+
+protected:
+ // implements a simple map between the name and its enum value
+ DOMConfigurationFeature getFeatureFlag(const XMLCh* name) const;
+
+ // the error handler
+ DOMErrorHandler* fErrorHandler;
+
+ // the schema type
+ const XMLCh* fSchemaType;
+
+ // the schema location
+ const XMLCh* fSchemaLocation;
+
+ // the list of supported parameters
+ DOMStringListImpl* fSupportedParameters;
+
+ MemoryManager* fMemoryManager;
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
+
+/**
+ * End of file DOMConfigurationImpl.hpp
+ */
diff --git a/include/xercesc/dom/impl/DOMDeepNodeListImpl.cpp b/include/xercesc/dom/impl/DOMDeepNodeListImpl.cpp
new file mode 100644
index 0000000..f48189f
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMDeepNodeListImpl.cpp
@@ -0,0 +1,219 @@
+/*
+ * 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: DOMDeepNodeListImpl.cpp 678381 2008-07-21 10:15:01Z borisk $
+ */
+
+#include "DOMDeepNodeListImpl.hpp"
+#include "DOMElementImpl.hpp"
+#include "DOMDocumentImpl.hpp"
+#include "DOMCasts.hpp"
+#include "DOMNodeImpl.hpp"
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+static const XMLCh kAstr[] = {chAsterisk, chNull};
+
+DOMDeepNodeListImpl::DOMDeepNodeListImpl(const DOMNode *rootNode,
+ const XMLCh *tagName)
+ : fRootNode(rootNode)
+ , fChanges(0)
+ , fCurrentNode(0)
+ , fCurrentIndexPlus1(0)
+ , fNamespaceURI(0)
+ , fMatchAllURI(false)
+ , fMatchURIandTagname(false)
+{
+ fTagName = ((DOMDocumentImpl *)(castToNodeImpl(rootNode)->getOwnerDocument()))->getPooledString(tagName);
+ fMatchAll = XMLString::equals(fTagName, kAstr);
+}
+
+
+//DOM Level 2
+DOMDeepNodeListImpl::DOMDeepNodeListImpl(const DOMNode *rootNode,
+ const XMLCh *namespaceURI,
+ const XMLCh *localName)
+ : fRootNode(rootNode)
+ , fChanges(0)
+ , fCurrentNode(0)
+ , fCurrentIndexPlus1(0)
+ , fMatchAllURI(false)
+ , fMatchURIandTagname(true)
+{
+ DOMDocumentImpl* doc = (DOMDocumentImpl *)castToNodeImpl(rootNode)->getOwnerDocument();
+
+ fTagName = doc->getPooledString(localName);
+ fMatchAll = XMLString::equals(fTagName, kAstr);
+ fMatchAllURI = XMLString::equals(namespaceURI, kAstr);
+ fNamespaceURI = doc->getPooledString(namespaceURI);
+}
+
+
+DOMDeepNodeListImpl::~DOMDeepNodeListImpl()
+{
+}
+
+XMLSize_t DOMDeepNodeListImpl::getLength() const
+{
+ // Reset cache to beginning of list
+ item(0);
+
+ // Preload all matching elements. (Stops when we run out of subtree!)
+ item(INT_MAX);
+ return fCurrentIndexPlus1;
+}
+
+
+DOMNode *DOMDeepNodeListImpl::item(XMLSize_t index) const
+{
+ return ((DOMDeepNodeListImpl*)this)->cacheItem(index);
+}
+
+// Start from the first child and count forward, 0-based. index>length-1
+// should return 0.
+//
+// Attempts to do only work actually requested, cache work already
+// done, and to flush that cache when the tree has changed.
+//
+// LIMITATION: ????? Unable to tell relevant tree-changes from
+// irrelevant ones. Doing so in a really useful manner would seem
+// to involve a tree-walk in its own right, or maintaining our data
+// in a parallel tree.
+DOMNode *DOMDeepNodeListImpl::cacheItem(XMLSize_t index)
+{
+ XMLSize_t currentIndexPlus1 = fCurrentIndexPlus1;
+ DOMNode *currentNode = fCurrentNode;
+
+ if (castToParentImpl(fRootNode)->changes() != fChanges)
+ {
+ // Tree changed. Do it all from scratch!
+ currentIndexPlus1 = 0;
+ currentNode = (DOMNode *)fRootNode;
+ fChanges = castToParentImpl(fRootNode)->changes();
+ }
+ else if (currentIndexPlus1 > index+1)
+ {
+ // Interested in something before cached node. Do it all from scratch!
+ currentIndexPlus1 = 0;
+ currentNode = (DOMNode *)fRootNode;
+ }
+ else if (index+1 == currentIndexPlus1)
+ {
+ // What luck! User is interested in cached node.
+ return currentNode;
+ }
+
+ DOMNode *nextNode = 0;
+
+// revisit - ???? How efficient is this loop? ????
+
+ // Start at the place in the tree at which we're
+ // currently pointing and count off nodes until we
+ // reach the node of interest or the end of the tree.
+ while (currentIndexPlus1 < index+1 && currentNode != 0)
+ {
+ nextNode = nextMatchingElementAfter(currentNode);
+ if (nextNode == 0)
+ break;
+ currentNode = nextNode;
+ currentIndexPlus1++;
+ }
+
+ fCurrentNode = currentNode;
+ fCurrentIndexPlus1 = currentIndexPlus1;
+
+ // If we found a node at the requested index, make that the current node
+ if (nextNode != 0)
+ {
+ return currentNode;
+ }
+
+ // If we didn't find a node at the requested index, return 0
+ return 0;
+}
+
+
+
+/* Iterative tree-walker. When you have a Parent link, there's often no
+need to resort to recursion. NOTE THAT only Element nodes are matched
+since we're specifically supporting getElementsByTagName().
+*/
+DOMNode *DOMDeepNodeListImpl::nextMatchingElementAfter(DOMNode *current)
+{
+ DOMNode *next;
+ while (current != 0)
+ {
+ // Look down to first child.
+ if (current->hasChildNodes())
+ {
+ current = current->getFirstChild();
+ }
+ // Look right to sibling (but not from root!)
+ else
+ {
+ if (current != fRootNode && 0 != (next = current->getNextSibling()))
+ {
+ current = next;
+ }
+ // Look up and right (but not past root!)
+ else
+ {
+ next = 0;
+ for (;
+ current != fRootNode; // Stop on return to starting point
+ current = current->getParentNode())
+ {
+ next = current->getNextSibling();
+ if (next != 0)
+ break;
+ }
+ current = next;
+ }
+ }
+
+ // Have we found an Element with the right tagName?
+ // ("*" matches anything.)
+ if (current != 0 && current != fRootNode &&
+ current->getNodeType() == DOMNode::ELEMENT_NODE) {
+ DOMElement *currElement = (DOMElement *)current;
+
+ if (!fMatchURIandTagname) { //DOM Level 1
+ if (fMatchAll ||
+ XMLString::equals(currElement->getTagName(), fTagName))
+ return current;
+ } else { //DOM Level 2
+ if (!fMatchAllURI &&
+ !XMLString::equals(current->getNamespaceURI(), fNamespaceURI))
+ continue;
+
+ if (fMatchAll ||
+ XMLString::equals(current->getLocalName(), fTagName))
+ return current;
+ }
+ }
+
+ // Otherwise continue walking the tree
+ }
+ // Fell out of tree-walk; no more instances found
+ return 0;
+}
+
+XERCES_CPP_NAMESPACE_END
diff --git a/include/xercesc/dom/impl/DOMDeepNodeListImpl.hpp b/include/xercesc/dom/impl/DOMDeepNodeListImpl.hpp
new file mode 100644
index 0000000..ea67066
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMDeepNodeListImpl.hpp
@@ -0,0 +1,80 @@
+/*
+ * 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: DOMDeepNodeListImpl.hpp 671894 2008-06-26 13:29:21Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_DOMDEEPNODELISTIMPL_HPP)
+#define XERCESC_INCLUDE_GUARD_DOMDEEPNODELISTIMPL_HPP
+
+//
+// This file is part of the internal implementation of the C++ XML DOM.
+// It should NOT be included or used directly by application programs.
+//
+// Applications should include the file for the entire
+// DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
+// name is substituded for the *.
+//
+
+#include
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+class DOMNode;
+
+
+class CDOM_EXPORT DOMDeepNodeListImpl: public DOMNodeList {
+protected:
+ const DOMNode* fRootNode;
+ const XMLCh* fTagName;
+ bool fMatchAll;
+ int fChanges;
+ DOMNode* fCurrentNode;
+ XMLSize_t fCurrentIndexPlus1;
+
+ //DOM Level 2
+ const XMLCh* fNamespaceURI;
+ bool fMatchAllURI;
+ bool fMatchURIandTagname; //match both namespaceURI and tagName
+
+public:
+ DOMDeepNodeListImpl(const DOMNode *rootNode, const XMLCh *tagName);
+ DOMDeepNodeListImpl(const DOMNode *rootNode, //DOM Level 2
+ const XMLCh *namespaceURI,
+ const XMLCh *localName);
+ virtual ~DOMDeepNodeListImpl();
+ virtual XMLSize_t getLength() const;
+ virtual DOMNode* item(XMLSize_t index) const;
+ DOMNode* cacheItem(XMLSize_t index);
+
+protected:
+ DOMNode* nextMatchingElementAfter(DOMNode *current);
+
+private:
+ // -----------------------------------------------------------------------
+ // Unimplemented constructors and operators
+ // -----------------------------------------------------------------------
+ DOMDeepNodeListImpl(const DOMDeepNodeListImpl &);
+ DOMDeepNodeListImpl & operator = (const DOMDeepNodeListImpl &);
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
diff --git a/include/xercesc/dom/impl/DOMDeepNodeListPool.c b/include/xercesc/dom/impl/DOMDeepNodeListPool.c
new file mode 100644
index 0000000..618c7c3
--- /dev/null
+++ b/include/xercesc/dom/impl/DOMDeepNodeListPool.c
@@ -0,0 +1,428 @@
+/*
+ * 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: DOMDeepNodeListPool.c 883368 2009-11-23 15:28:19Z amassari $
+ */
+
+
+// ---------------------------------------------------------------------------
+// Include
+// ---------------------------------------------------------------------------
+#include
+#if defined(XERCES_TMPLSINC)
+#include
+#endif
+
+#include
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+
+
+// ---------------------------------------------------------------------------
+// DOMDeepNodeListPool: Constructors and Destructor
+// ---------------------------------------------------------------------------
+template
+DOMDeepNodeListPool::DOMDeepNodeListPool( const XMLSize_t modulus
+ , const bool adoptElems
+ , const XMLSize_t initSize) :
+ fAdoptedElems(adoptElems)
+ , fBucketList(0)
+ , fHashModulus(modulus)
+ , fIdPtrs(0)
+ , fIdPtrsCount(initSize)
+ , fIdCounter(0)
+ , fMemoryManager(XMLPlatformUtils::fgMemoryManager)
+{
+ initialize(modulus);
+
+ //
+ // Allocate the initial id pointers array. We don't have to zero them
+ // out since the fIdCounter value tells us which ones are valid. The
+ // zeroth element is never used (and represents an invalid pool id.)
+ //
+ if (!fIdPtrsCount)
+ fIdPtrsCount = 256;
+
+ fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*));//new TVal*[fIdPtrsCount];
+ fIdPtrs[0] = 0;
+}
+
+template
+DOMDeepNodeListPool::DOMDeepNodeListPool( const XMLSize_t modulus
+ , const bool adoptElems
+ , const THasher& hasher
+ , const XMLSize_t initSize) :
+ fAdoptedElems(adoptElems)
+ , fBucketList(0)
+ , fHashModulus(modulus)
+ , fIdPtrs(0)
+ , fIdPtrsCount(initSize)
+ , fIdCounter(0)
+ , fMemoryManager(XMLPlatformUtils::fgMemoryManager)
+ , fHasher(hasher)
+{
+ initialize(modulus);
+
+ //
+ // Allocate the initial id pointers array. We don't have to zero them
+ // out since the fIdCounter value tells us which ones are valid. The
+ // zeroth element is never used (and represents an invalid pool id.)
+ //
+ if (!fIdPtrsCount)
+ fIdPtrsCount = 256;
+
+ fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*));//new TVal*[fIdPtrsCount];
+ fIdPtrs[0] = 0;
+}
+
+template
+DOMDeepNodeListPool::DOMDeepNodeListPool( const XMLSize_t modulus
+ , const XMLSize_t initSize) :
+ fAdoptedElems(true)
+ , fBucketList(0)
+ , fHashModulus(modulus)
+ , fIdPtrs(0)
+ , fIdPtrsCount(initSize)
+ , fIdCounter(0)
+ , fMemoryManager(XMLPlatformUtils::fgMemoryManager)
+{
+ initialize(modulus);
+
+ //
+ // Allocate the initial id pointers array. We don't have to zero them
+ // out since the fIdCounter value tells us which ones are valid. The
+ // zeroth element is never used (and represents an invalid pool id.)
+ //
+ if (!fIdPtrsCount)
+ fIdPtrsCount = 256;
+
+ fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*));//new TVal*[fIdPtrsCount];
+ fIdPtrs[0] = 0;
+}
+
+template
+void DOMDeepNodeListPool::initialize(const XMLSize_t modulus)
+{
+ if (modulus == 0)
+ ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::HshTbl_ZeroModulus, fMemoryManager);
+
+ // Allocate the bucket list and zero them
+ fBucketList = (DOMDeepNodeListPoolTableBucketElem**)
+ fMemoryManager->allocate
+ (
+ fHashModulus * sizeof(DOMDeepNodeListPoolTableBucketElem*)
+ );//new DOMDeepNodeListPoolTableBucketElem*[fHashModulus];
+ for (XMLSize_t index = 0; index < fHashModulus; index++)
+ fBucketList[index] = 0;
+}
+
+template
+DOMDeepNodeListPool::~DOMDeepNodeListPool()
+{
+ removeAll();
+
+ // Then delete the bucket list & hasher & id pointers list
+ fMemoryManager->deallocate(fIdPtrs);//delete [] fIdPtrs;
+ fMemoryManager->deallocate(fBucketList);//delete [] fBucketList;
+}
+
+
+// ---------------------------------------------------------------------------
+// DOMDeepNodeListPool: Element management
+// ---------------------------------------------------------------------------
+template
+bool DOMDeepNodeListPool::isEmpty() const
+{
+ // Just check the bucket list for non-empty elements
+ for (XMLSize_t buckInd = 0; buckInd < fHashModulus; buckInd++)
+ {
+ if (fBucketList[buckInd] != 0)
+ return false;
+ }
+ return true;
+}
+
+template
+bool DOMDeepNodeListPool::containsKey( const void* const key1
+ , const XMLCh* const key2
+ , const XMLCh* const key3) const
+{
+ XMLSize_t hashVal;
+ const DOMDeepNodeListPoolTableBucketElem* findIt = findBucketElem(key1, key2, key3, hashVal);
+ return (findIt != 0);
+}
+
+template
+void DOMDeepNodeListPool