You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@locus.apache.org on 2000/04/11 16:29:20 UTC
cvs commit: xml-xalan/c/src/XalanDOM XalanAttr.cpp XalanAttr.hpp XalanCDataSection.cpp XalanCDATASection.hpp XalanCharacterData.cpp XalanCharacterData.hpp XalanComment.cpp XalanComment.hpp XalanDocument.cpp XalanDocument.hpp XalanDocumentFragment.cpp XalanDocumentFragment.hpp XalanDocumentType.cpp XalanDocumentType.hpp XalanDOMDefinitions.hpp XalanDOMException.cpp XalanDOMException.hpp XalanDOMImplementation.cpp XalanDOMImplementation.hpp XalanDOMString.hpp XalanElement.cpp XalanElement.hpp XalanEntity.cpp XalanEntity.hpp XalanEntityReference.cpp XalanEntityReference.hpp XalanNamedNodeMap.cpp XalanNamedNodeMap.hpp XalanNode.cpp XalanNode.hpp XalanNodeList.cpp XalanNodeList.hpp XalanNodeListSurrogate.cpp XalanNodeListSurrogate.hpp XalanNotation.cpp XalanNotation.hpp XalanProcessingInstruction.cpp XalanProcessingInstruction.hpp XalanText.cpp XalanText.hpp
dbertoni 00/04/11 07:29:19
Added: c/src/XalanDOM XalanAttr.cpp XalanAttr.hpp
XalanCDataSection.cpp XalanCDATASection.hpp
XalanCharacterData.cpp XalanCharacterData.hpp
XalanComment.cpp XalanComment.hpp XalanDocument.cpp
XalanDocument.hpp XalanDocumentFragment.cpp
XalanDocumentFragment.hpp XalanDocumentType.cpp
XalanDocumentType.hpp XalanDOMDefinitions.hpp
XalanDOMException.cpp XalanDOMException.hpp
XalanDOMImplementation.cpp
XalanDOMImplementation.hpp XalanDOMString.hpp
XalanElement.cpp XalanElement.hpp XalanEntity.cpp
XalanEntity.hpp XalanEntityReference.cpp
XalanEntityReference.hpp XalanNamedNodeMap.cpp
XalanNamedNodeMap.hpp XalanNode.cpp XalanNode.hpp
XalanNodeList.cpp XalanNodeList.hpp
XalanNodeListSurrogate.cpp
XalanNodeListSurrogate.hpp XalanNotation.cpp
XalanNotation.hpp XalanProcessingInstruction.cpp
XalanProcessingInstruction.hpp XalanText.cpp
XalanText.hpp
Log:
Initial revision.
Revision Changes Path
1.1 xml-xalan/c/src/XalanDOM/XalanAttr.cpp
Index: XalanAttr.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanAttr.hpp"
XalanAttr::XalanAttr() :
XalanNode()
{
}
XalanAttr::~XalanAttr()
{
}
XalanAttr::XalanAttr(const XalanAttr& theSource) :
XalanNode(theSource)
{
}
XalanAttr&
XalanAttr::operator=(const XalanAttr& theSource)
{
XalanNode::operator=(theSource);
return *this;
}
bool
XalanAttr::operator==(const XalanAttr& /* theRHS */) const
{
return false;
}
1.1 xml-xalan/c/src/XalanDOM/XalanAttr.hpp
Index: XalanAttr.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANATTR_HEADER_GUARD_1357924680)
#define XALANATTR_HEADER_GUARD_1357924680
#include <XalanDom/XalanDOMDefinitions.hpp>
#include <XalanDom/XalanNode.hpp>
class XalanElement;
/*
* <meta name="usage" content="experimental"/>
*
* Base class for the DOM Attr interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanAttr : public XalanNode
{
public:
XalanAttr();
virtual
~XalanAttr();
// These interfaces are inherited from XalanNode...
virtual XalanDOMString
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
virtual XalanDOMString
getNodeValue() const = 0;
/**
* An enum value representing the type of the underlying object.
*/
virtual NodeType
getNodeType() const = 0;
/**
* Gets the parent of this node.
*
* All nodes, except <code>Document</code>,
* <code>DocumentFragment</code>, and <code>Attr</code> 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 <code>null</code> Node
* is returned.
*/
virtual XalanNode*
getParentNode() const = 0;
/**
* Gets a <code>NodeList</code> that contains all children of this node.
*
* If there
* are no children, this is a <code>NodeList</code> containing no nodes.
* The content of the returned <code>NodeList</code> 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 <code>NodeList</code> accessors; it is not a static snapshot of the
* content of the node. This is true for every <code>NodeList</code>,
* including the ones returned by the <code>getElementsByTagName</code>
* method.
*/
virtual const XalanNodeList*
getChildNodes() const = 0;
/**
* Gets the first child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getFirstChild() const = 0;
/**
* Gets the last child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getLastChild() const = 0;
/**
* Gets the node immediately preceding this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getPreviousSibling() const = 0;
/**
* Gets the node immediately following this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getNextSibling() const = 0;
/**
* Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it
* is an <code>Element</code>) or <code>null</code> otherwise.
*/
virtual const XalanNamedNodeMap*
getAttributes() const = 0;
/**
* Gets the <code>Document</code> object associated with this node.
*
* This is also
* the <code>Document</code> object used to create new nodes. When this
* node is a <code>Document</code> or a <code>DocumentType</code>
* which is not used with any <code>Document</code> yet, this is
* <code>null</code>.
*/
virtual XalanDocument*
getOwnerDocument() const = 0;
//@}
/** @name Cloning function. */
//@{
/**
* Returns a duplicate of this node.
*
* This function serves as a generic copy constructor for nodes.
*
* The duplicate node has no parent (
* <code>parentNode</code> returns <code>null</code>.).
* <br>Cloning an <code>Element</code> 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
* <code>Text</code> node. Cloning any other type of node simply returns a
* copy of this node.
* @param deep If <code>true</code>, recursively clone the subtree under the
* specified node; if <code>false</code>, clone only the node itself (and
* its attributes, if it is an <code>Element</code>).
* @return The duplicate node.
*/
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual XalanNode*
#else
virtual XalanAttr*
#endif
cloneNode(bool deep) const = 0;
//@}
/** @name Functions to modify the DOM Node. */
//@{
/**
* Inserts the node <code>newChild</code> before the existing child node
* <code>refChild</code>.
*
* If <code>refChild</code> is <code>null</code>,
* insert <code>newChild</code> at the end of the list of children.
* <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
* all of its children are inserted, in the same order, before
* <code>refChild</code>. If the <code>newChild</code> is already in the
* tree, it is first removed. Note that a <code>Node</code> 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.
*/
virtual XalanNode*
insertBefore(
XalanNode* newChild,
XalanNode* refChild) = 0;
/**
* Replaces the child node <code>oldChild</code> with <code>newChild</code>
* in the list of children, and returns the <code>oldChild</code> node.
*
* If <CODE>newChild</CODE> is a <CODE>DocumentFragment</CODE> object,
* <CODE>oldChild</CODE> is replaced by all of the <CODE>DocumentFragment</CODE>
* children, which are inserted in the same order.
*
* If the <code>newChild</code> 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.
*/
virtual XalanNode*
replaceChild(
XalanNode* newChild,
XalanNode* oldChild) = 0;
/**
* Removes the child node indicated by <code>oldChild</code> from the list
* of children, and returns it.
*
* @param oldChild The node being removed.
* @return The node removed.
*/
virtual XalanNode*
removeChild(XalanNode* oldChild) = 0;
/**
* Adds the node <code>newChild</code> to the end of the list of children of
* this node.
*
* If the <code>newChild</code> is already in the tree, it is
* first removed.
* @param newChild The node to add.If it is a <code>DocumentFragment</code>
* object, the entire contents of the document fragment are moved into
* the child list of this node
* @return The node added.
*/
virtual XalanNode*
appendChild(XalanNode* newChild) = 0;
//@}
/** @name Query functions. */
//@{
/**
* This is a convenience method to allow easy determination of whether a
* node has any children.
*
* @return <code>true</code> if the node has any children,
* <code>false</code> if the node has no children.
*/
virtual bool
hasChildNodes() const = 0;
//@}
/** @name Set functions. */
//@{
/**
* Sets the value of the node.
*
* Any node which can have a nodeValue (@see getNodeValue) 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.
*/
virtual void
setNodeValue(const XalanDOMString& nodeValue) = 0;
//@}
/** @name Functions introduced in DOM Level 2. */
//@{
/**
* Puts all <CODE>Text</CODE>
* nodes in the full depth of the sub-tree underneath this <CODE>Node</CODE>,
* including attribute nodes, into a "normal" form where only markup (e.g.,
* tags, comments, processing instructions, CDATA sections, and entity
* references) separates <CODE>Text</CODE>
* nodes, i.e., there are no adjacent <CODE>Text</CODE>
* 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.
* <P><B>Note:</B> In cases where the document contains <CODE>CDATASections</CODE>,
* the normalize operation alone may not be sufficient, since XPointers do
* not differentiate between <CODE>Text</CODE>
* nodes and <CODE>CDATASection</CODE> nodes.</P>
*/
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 <code>hasFeature</code> on
* <code>DOMImplementation</code>.
* @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 <code>true</code>.
* @return Returns <code>true</code> if the specified feature is supported
* on this node, <code>false</code> otherwise.
*/
virtual bool
supports(
const XalanDOMString& feature,
const XalanDOMString& version) const = 0;
/**
* Get the <em>namespace URI</em> of
* this node, or <code>null</code> if it is unspecified.
* <p>
* 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.
* <p>
* For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
* <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
virtual XalanDOMString
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
virtual XalanDOMString
getPrefix() const = 0;
/**
* Returns the local part of the <em>qualified name</em> of this node.
* <p>
* For nodes created with a DOM Level 1 method, such as
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
virtual XalanDOMString
getLocalName() const = 0;
/**
* Set the <em>namespace prefix</em> of this node.
* <p>
* Note that setting this attribute, when permitted, changes
* the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified
* name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE>
* attributes of the <CODE>Element</CODE> and <CODE>Attr</CODE>
* interfaces, when applicable.
* <p>
* 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
* <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
*
* @param prefix The prefix of this node.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified prefix contains
* an illegal character.
* <br>
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>
* NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is
* malformed, if the specified prefix is "xml" and the
* <CODE>namespaceURI</CODE> of this node is different from
* "http://www.w3.org/XML/1998/namespace", if specified prefix is
* "xmlns" and the <CODE>namespaceURI</CODE> is neither
* <CODE>null</CODE> nor an empty string, or if the
* <CODE>localName</CODE> is <CODE>null</CODE>.
*/
virtual void
setPrefix(const XalanDOMString& prefix) = 0;
//@}
// These interfaces are new to XalanAttr...
/** @name Getter functions */
//@{
/**
* Returns the name of this attribute.
*/
virtual XalanDOMString
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.
*/
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.
*/
virtual XalanDOMString
getValue() const = 0;
//@}
/** @name Setter functions */
//@{
/**
* 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
*/
virtual void
setValue(const XalanDOMString& value) = 0;
//@}
/** @name Functions introduced in DOM Level 2. */
//@{
/**
* The <code>Element</code> node this attribute is attached to or
* <code>null</code> if this attribute is not in use.
*/
virtual XalanElement*
getOwnerElement() const = 0;
//@}
protected:
XalanAttr(const XalanAttr& theSource);
XalanAttr&
operator=(const XalanAttr& theSource);
bool
operator==(const XalanAttr& theRHS) const;
private:
};
#endif // !defined(XALANATTR_HEADER_GUARD_1357924680)
1.1 xml-xalan/c/src/XalanDOM/XalanCDataSection.cpp
Index: XalanCDataSection.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanCDATASection.hpp"
XalanCDATASection::XalanCDATASection() :
XalanText()
{
}
XalanCDATASection::~XalanCDATASection()
{
}
XalanCDATASection::XalanCDATASection(const XalanCDATASection& theSource) :
XalanText(theSource)
{
}
XalanCDATASection&
XalanCDATASection::operator=(const XalanCDATASection& theSource)
{
XalanText::operator=(theSource);
return *this;
}
bool
XalanCDATASection::operator==(const XalanCDATASection& /* theRHS */) const
{
return false;
}
1.1 xml-xalan/c/src/XalanDOM/XalanCDATASection.hpp
Index: XalanCDATASection.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANCDATASECTION_HEADER_GUARD_1357924680)
#define XALANCDATASECTION_HEADER_GUARD_1357924680
#include <XalanDOM/XalanDOMDefinitions.hpp>
#include <XalanDOM/XalanText.hpp>
/*
* <meta name="usage" content="experimental"/>
*
* Base class for the DOM CDATASection interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanCDATASection : public XalanText
{
public:
XalanCDATASection();
virtual
~XalanCDATASection();
// These interfaces are inherited from XalanNode...
virtual XalanDOMString
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
virtual XalanDOMString
getNodeValue() const = 0;
/**
* An enum value representing the type of the underlying object.
*/
virtual NodeType
getNodeType() const = 0;
/**
* Gets the parent of this node.
*
* All nodes, except <code>Document</code>,
* <code>DocumentFragment</code>, and <code>Attr</code> 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 <code>null</code> Node
* is returned.
*/
virtual XalanNode*
getParentNode() const = 0;
/**
* Gets a <code>NodeList</code> that contains all children of this node.
*
* If there
* are no children, this is a <code>NodeList</code> containing no nodes.
* The content of the returned <code>NodeList</code> 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 <code>NodeList</code> accessors; it is not a static snapshot of the
* content of the node. This is true for every <code>NodeList</code>,
* including the ones returned by the <code>getElementsByTagName</code>
* method.
*/
virtual const XalanNodeList*
getChildNodes() const = 0;
/**
* Gets the first child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getFirstChild() const = 0;
/**
* Gets the last child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getLastChild() const = 0;
/**
* Gets the node immediately preceding this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getPreviousSibling() const = 0;
/**
* Gets the node immediately following this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getNextSibling() const = 0;
/**
* Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it
* is an <code>Element</code>) or <code>null</code> otherwise.
*/
virtual const XalanNamedNodeMap*
getAttributes() const = 0;
/**
* Gets the <code>Document</code> object associated with this node.
*
* This is also
* the <code>Document</code> object used to create new nodes. When this
* node is a <code>Document</code> or a <code>DocumentType</code>
* which is not used with any <code>Document</code> yet, this is
* <code>null</code>.
*/
virtual XalanDocument*
getOwnerDocument() const = 0;
//@}
/** @name Cloning function. */
//@{
/**
* Returns a duplicate of this node.
*
* This function serves as a generic copy constructor for nodes.
*
* The duplicate node has no parent (
* <code>parentNode</code> returns <code>null</code>.).
* <br>Cloning an <code>Element</code> 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
* <code>Text</code> node. Cloning any other type of node simply returns a
* copy of this node.
* @param deep If <code>true</code>, recursively clone the subtree under the
* specified node; if <code>false</code>, clone only the node itself (and
* its attributes, if it is an <code>Element</code>).
* @return The duplicate node.
*/
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual XalanNode*
#else
virtual XalanCDATASection*
#endif
cloneNode(bool deep) const = 0;
//@}
/** @name Functions to modify the DOM Node. */
//@{
/**
* Inserts the node <code>newChild</code> before the existing child node
* <code>refChild</code>.
*
* If <code>refChild</code> is <code>null</code>,
* insert <code>newChild</code> at the end of the list of children.
* <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
* all of its children are inserted, in the same order, before
* <code>refChild</code>. If the <code>newChild</code> is already in the
* tree, it is first removed. Note that a <code>Node</code> 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.
*/
virtual XalanNode*
insertBefore(
XalanNode* newChild,
XalanNode* refChild) = 0;
/**
* Replaces the child node <code>oldChild</code> with <code>newChild</code>
* in the list of children, and returns the <code>oldChild</code> node.
*
* If <CODE>newChild</CODE> is a <CODE>DocumentFragment</CODE> object,
* <CODE>oldChild</CODE> is replaced by all of the <CODE>DocumentFragment</CODE>
* children, which are inserted in the same order.
*
* If the <code>newChild</code> 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.
*/
virtual XalanNode*
replaceChild(
XalanNode* newChild,
XalanNode* oldChild) = 0;
/**
* Removes the child node indicated by <code>oldChild</code> from the list
* of children, and returns it.
*
* @param oldChild The node being removed.
* @return The node removed.
*/
virtual XalanNode*
removeChild(XalanNode* oldChild) = 0;
/**
* Adds the node <code>newChild</code> to the end of the list of children of
* this node.
*
* If the <code>newChild</code> is already in the tree, it is
* first removed.
* @param newChild The node to add.If it is a <code>DocumentFragment</code>
* object, the entire contents of the document fragment are moved into
* the child list of this node
* @return The node added.
*/
virtual XalanNode*
appendChild(XalanNode* newChild) = 0;
//@}
/** @name Query functions. */
//@{
/**
* This is a convenience method to allow easy determination of whether a
* node has any children.
*
* @return <code>true</code> if the node has any children,
* <code>false</code> if the node has no children.
*/
virtual bool
hasChildNodes() const = 0;
//@}
/** @name Set functions. */
//@{
/**
* Sets the value of the node.
*
* Any node which can have a nodeValue (@see getNodeValue) 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.
*/
virtual void
setNodeValue(const XalanDOMString& nodeValue) = 0;
//@}
/** @name Functions introduced in DOM Level 2. */
//@{
/**
* Puts all <CODE>Text</CODE>
* nodes in the full depth of the sub-tree underneath this <CODE>Node</CODE>,
* including attribute nodes, into a "normal" form where only markup (e.g.,
* tags, comments, processing instructions, CDATA sections, and entity
* references) separates <CODE>Text</CODE>
* nodes, i.e., there are no adjacent <CODE>Text</CODE>
* 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.
* <P><B>Note:</B> In cases where the document contains <CODE>CDATASections</CODE>,
* the normalize operation alone may not be sufficient, since XPointers do
* not differentiate between <CODE>Text</CODE>
* nodes and <CODE>CDATASection</CODE> nodes.</P>
*/
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 <code>hasFeature</code> on
* <code>DOMImplementation</code>.
* @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 <code>true</code>.
* @return Returns <code>true</code> if the specified feature is supported
* on this node, <code>false</code> otherwise.
*/
virtual bool
supports(
const XalanDOMString& feature,
const XalanDOMString& version) const = 0;
/**
* Get the <em>namespace URI</em> of
* this node, or <code>null</code> if it is unspecified.
* <p>
* 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.
* <p>
* For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
* <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
virtual XalanDOMString
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
virtual XalanDOMString
getPrefix() const = 0;
/**
* Returns the local part of the <em>qualified name</em> of this node.
* <p>
* For nodes created with a DOM Level 1 method, such as
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
virtual XalanDOMString
getLocalName() const = 0;
/**
* Set the <em>namespace prefix</em> of this node.
* <p>
* Note that setting this attribute, when permitted, changes
* the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified
* name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE>
* attributes of the <CODE>Element</CODE> and <CODE>Attr</CODE>
* interfaces, when applicable.
* <p>
* 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
* <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
*
* @param prefix The prefix of this node.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified prefix contains
* an illegal character.
* <br>
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>
* NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is
* malformed, if the specified prefix is "xml" and the
* <CODE>namespaceURI</CODE> of this node is different from
* "http://www.w3.org/XML/1998/namespace", if specified prefix is
* "xmlns" and the <CODE>namespaceURI</CODE> is neither
* <CODE>null</CODE> nor an empty string, or if the
* <CODE>localName</CODE> is <CODE>null</CODE>.
*/
virtual void
setPrefix(const XalanDOMString& prefix) = 0;
//@}
// These interfaces are inherited from XalanCharacterData...
/** @name Getter functions. */
//@{
/**
* 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 <code>CharacterData</code> node. However,
* implementation limits may mean that the entirety of a node's data may
* not fit into a single <code>XalanDOMString</code>. In such cases, the user
* may call <code>substringData</code> to retrieve the data in
* appropriately sized pieces.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
* @exception DOMException
* DOMSTRING_SIZE_ERR: Raised when it would return more characters than
* fit in a <code>XalanDOMString</code> variable on the implementation
* platform.
*/
virtual XalanDOMString
getData() const = 0;
/**
* Returns the number of characters that are available through <code>data</code> and
* the <code>substringData</code> method below.
*
* This may have the value
* zero, i.e., <code>CharacterData</code> nodes may be empty.
*/
virtual unsigned int
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 <code>offset</code> and
* <code>count</code> exceeds the <code>length</code>, 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 <code>data</code>, or if the
* specified <code>count</code> is negative.
* <br>DOMSTRING_SIZE_ERR: Raised if the specified range of text does not
* fit into a <code>XalanDOMString</code>.
*/
virtual XalanDOMString
substringData(
unsigned int offset,
unsigned int count) const = 0;
//@}
/** @name Functions that set or change data. */
//@{
/**
* Append the string to the end of the character data of the node.
*
* Upon success, <code>data</code> provides access to the concatenation of
* <code>data</code> and the <code>XalanDOMString</code> specified.
* @param arg The <code>XalanDOMString</code> to append.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
appendData(const XalanDOMString& arg) = 0;
/**
* Insert a string at the specified character offset.
*
* @param offset The character offset at which to insert.
* @param arg The <code>XalanDOMString</code> to insert.
* @exception DOMException
* INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
* than the number of characters in <code>data</code>.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
insertData(
unsigned int offset,
const XalanDOMString& arg) = 0;
/**
* Remove a range of characters from the node.
*
* Upon success,
* <code>data</code> and <code>length</code> reflect the change.
* @param offset The offset from which to remove characters.
* @param count The number of characters to delete. If the sum of
* <code>offset</code> and <code>count</code> exceeds <code>length</code>
* then all characters from <code>offset</code> 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 <code>data</code>, or if the
* specified <code>count</code> is negative.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
deleteData(
unsigned int offset,
unsigned int 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
* <code>offset</code> and <code>count</code> exceeds <code>length</code>
* , then all characters to the end of the data are replaced (i.e., the
* effect is the same as a <code>remove</code> method call with the same
* range, followed by an <code>append</code> method invocation).
* @param arg The <code>XalanDOMString</code> 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 <code>data</code>, or if the
* specified <code>count</code> is negative.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
replaceData(
unsigned int offset,
unsigned int count,
const XalanDOMString& arg) = 0;
//@}
// These interfaces are inherited from XalanText...
//@}
/** @name Functions to modify the Text node. */
//@{
/**
* Breaks this node into two nodes at the specified
* offset, keeping both in the tree as siblings.
*
* This node then only
* contains all the content up to the <code>offset</code> point. And a new
* node of the same nodeType, which is inserted as the next sibling of this
* node, contains all the content at and after the <code>offset</code>
* point. When the <code>offset</code> is equal to the lenght of this node,
* the new node has no data.
* @param offset The offset at which to split, starting from 0.
* @return The new <code>Text</code> node.
* @exception DOMException
* INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
* than the number of characters in <code>data</code>.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual XalanText*
splitText(unsigned int offset) = 0;
//@}
protected:
XalanCDATASection(const XalanCDATASection& theSource);
XalanCDATASection&
operator=(const XalanCDATASection& theSource);
bool
operator==(const XalanCDATASection& theRHS) const;
private:
};
#endif // !defined(XALANCDATASECTION_HEADER_GUARD_1357924680)
1.1 xml-xalan/c/src/XalanDOM/XalanCharacterData.cpp
Index: XalanCharacterData.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanCharacterData.hpp"
XalanCharacterData::XalanCharacterData() :
XalanNode()
{
}
XalanCharacterData::~XalanCharacterData()
{
}
XalanCharacterData::XalanCharacterData(const XalanCharacterData& theSource) :
XalanNode(theSource)
{
}
XalanCharacterData&
XalanCharacterData::operator=(const XalanCharacterData& theSource)
{
XalanNode::operator=(theSource);
return *this;
}
bool
XalanCharacterData::operator==(const XalanCharacterData& /* theRHS */) const
{
return false;
}
1.1 xml-xalan/c/src/XalanDOM/XalanCharacterData.hpp
Index: XalanCharacterData.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANCHARACTERDATA_HEADER_GUARD_1357924680)
#define XALANCHARACTERDATA_HEADER_GUARD_1357924680
#include <XalanDom/XalanDOMDefinitions.hpp>
#include <XalanDom/XalanNode.hpp>
/*
* <meta name="usage" content="experimental"/>
*
* Base class for the DOM CharacterData interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanCharacterData : public XalanNode
{
public:
XalanCharacterData();
virtual
~XalanCharacterData();
// These interfaces are inherited from XalanNode...
virtual XalanDOMString
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
virtual XalanDOMString
getNodeValue() const = 0;
/**
* An enum value representing the type of the underlying object.
*/
virtual NodeType
getNodeType() const = 0;
/**
* Gets the parent of this node.
*
* All nodes, except <code>Document</code>,
* <code>DocumentFragment</code>, and <code>Attr</code> 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 <code>null</code> Node
* is returned.
*/
virtual XalanNode*
getParentNode() const = 0;
/**
* Gets a <code>NodeList</code> that contains all children of this node.
*
* If there
* are no children, this is a <code>NodeList</code> containing no nodes.
* The content of the returned <code>NodeList</code> 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 <code>NodeList</code> accessors; it is not a static snapshot of the
* content of the node. This is true for every <code>NodeList</code>,
* including the ones returned by the <code>getElementsByTagName</code>
* method.
*/
virtual const XalanNodeList*
getChildNodes() const = 0;
/**
* Gets the first child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getFirstChild() const = 0;
/**
* Gets the last child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getLastChild() const = 0;
/**
* Gets the node immediately preceding this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getPreviousSibling() const = 0;
/**
* Gets the node immediately following this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getNextSibling() const = 0;
/**
* Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it
* is an <code>Element</code>) or <code>null</code> otherwise.
*/
virtual const XalanNamedNodeMap*
getAttributes() const = 0;
/**
* Gets the <code>Document</code> object associated with this node.
*
* This is also
* the <code>Document</code> object used to create new nodes. When this
* node is a <code>Document</code> or a <code>DocumentType</code>
* which is not used with any <code>Document</code> yet, this is
* <code>null</code>.
*/
virtual XalanDocument*
getOwnerDocument() const = 0;
//@}
/** @name Cloning function. */
//@{
/**
* Returns a duplicate of this node.
*
* This function serves as a generic copy constructor for nodes.
*
* The duplicate node has no parent (
* <code>parentNode</code> returns <code>null</code>.).
* <br>Cloning an <code>Element</code> 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
* <code>Text</code> node. Cloning any other type of node simply returns a
* copy of this node.
* @param deep If <code>true</code>, recursively clone the subtree under the
* specified node; if <code>false</code>, clone only the node itself (and
* its attributes, if it is an <code>Element</code>).
* @return The duplicate node.
*/
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual XalanNode*
#else
virtual XalanCharacterData*
#endif
cloneNode(bool deep) const = 0;
//@}
/** @name Functions to modify the DOM Node. */
//@{
/**
* Inserts the node <code>newChild</code> before the existing child node
* <code>refChild</code>.
*
* If <code>refChild</code> is <code>null</code>,
* insert <code>newChild</code> at the end of the list of children.
* <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
* all of its children are inserted, in the same order, before
* <code>refChild</code>. If the <code>newChild</code> is already in the
* tree, it is first removed. Note that a <code>Node</code> 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.
*/
virtual XalanNode*
insertBefore(
XalanNode* newChild,
XalanNode* refChild) = 0;
/**
* Replaces the child node <code>oldChild</code> with <code>newChild</code>
* in the list of children, and returns the <code>oldChild</code> node.
*
* If <CODE>newChild</CODE> is a <CODE>DocumentFragment</CODE> object,
* <CODE>oldChild</CODE> is replaced by all of the <CODE>DocumentFragment</CODE>
* children, which are inserted in the same order.
*
* If the <code>newChild</code> 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.
*/
virtual XalanNode*
replaceChild(
XalanNode* newChild,
XalanNode* oldChild) = 0;
/**
* Removes the child node indicated by <code>oldChild</code> from the list
* of children, and returns it.
*
* @param oldChild The node being removed.
* @return The node removed.
*/
virtual XalanNode*
removeChild(XalanNode* oldChild) = 0;
/**
* Adds the node <code>newChild</code> to the end of the list of children of
* this node.
*
* If the <code>newChild</code> is already in the tree, it is
* first removed.
* @param newChild The node to add.If it is a <code>DocumentFragment</code>
* object, the entire contents of the document fragment are moved into
* the child list of this node
* @return The node added.
*/
virtual XalanNode*
appendChild(XalanNode* newChild) = 0;
//@}
/** @name Query functions. */
//@{
/**
* This is a convenience method to allow easy determination of whether a
* node has any children.
*
* @return <code>true</code> if the node has any children,
* <code>false</code> if the node has no children.
*/
virtual bool
hasChildNodes() const = 0;
//@}
/** @name Set functions. */
//@{
/**
* Sets the value of the node.
*
* Any node which can have a nodeValue (@see getNodeValue) 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.
*/
virtual void
setNodeValue(const XalanDOMString& nodeValue) = 0;
//@}
/** @name Functions introduced in DOM Level 2. */
//@{
/**
* Puts all <CODE>Text</CODE>
* nodes in the full depth of the sub-tree underneath this <CODE>Node</CODE>,
* including attribute nodes, into a "normal" form where only markup (e.g.,
* tags, comments, processing instructions, CDATA sections, and entity
* references) separates <CODE>Text</CODE>
* nodes, i.e., there are no adjacent <CODE>Text</CODE>
* 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.
* <P><B>Note:</B> In cases where the document contains <CODE>CDATASections</CODE>,
* the normalize operation alone may not be sufficient, since XPointers do
* not differentiate between <CODE>Text</CODE>
* nodes and <CODE>CDATASection</CODE> nodes.</P>
*/
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 <code>hasFeature</code> on
* <code>DOMImplementation</code>.
* @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 <code>true</code>.
* @return Returns <code>true</code> if the specified feature is supported
* on this node, <code>false</code> otherwise.
*/
virtual bool
supports(
const XalanDOMString& feature,
const XalanDOMString& version) const = 0;
/**
* Get the <em>namespace URI</em> of
* this node, or <code>null</code> if it is unspecified.
* <p>
* 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.
* <p>
* For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
* <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
virtual XalanDOMString
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
virtual XalanDOMString
getPrefix() const = 0;
/**
* Returns the local part of the <em>qualified name</em> of this node.
* <p>
* For nodes created with a DOM Level 1 method, such as
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
virtual XalanDOMString
getLocalName() const = 0;
/**
* Set the <em>namespace prefix</em> of this node.
* <p>
* Note that setting this attribute, when permitted, changes
* the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified
* name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE>
* attributes of the <CODE>Element</CODE> and <CODE>Attr</CODE>
* interfaces, when applicable.
* <p>
* 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
* <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
*
* @param prefix The prefix of this node.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified prefix contains
* an illegal character.
* <br>
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>
* NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is
* malformed, if the specified prefix is "xml" and the
* <CODE>namespaceURI</CODE> of this node is different from
* "http://www.w3.org/XML/1998/namespace", if specified prefix is
* "xmlns" and the <CODE>namespaceURI</CODE> is neither
* <CODE>null</CODE> nor an empty string, or if the
* <CODE>localName</CODE> is <CODE>null</CODE>.
*/
virtual void
setPrefix(const XalanDOMString& prefix) = 0;
//@}
// These interfaces are new to XalanCharacterData...
/** @name Getter functions. */
//@{
/**
* 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 <code>CharacterData</code> node. However,
* implementation limits may mean that the entirety of a node's data may
* not fit into a single <code>XalanDOMString</code>. In such cases, the user
* may call <code>substringData</code> to retrieve the data in
* appropriately sized pieces.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
* @exception DOMException
* DOMSTRING_SIZE_ERR: Raised when it would return more characters than
* fit in a <code>XalanDOMString</code> variable on the implementation
* platform.
*/
virtual XalanDOMString
getData() const = 0;
/**
* Returns the number of characters that are available through <code>data</code> and
* the <code>substringData</code> method below.
*
* This may have the value
* zero, i.e., <code>CharacterData</code> nodes may be empty.
*/
virtual unsigned int
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 <code>offset</code> and
* <code>count</code> exceeds the <code>length</code>, 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 <code>data</code>, or if the
* specified <code>count</code> is negative.
* <br>DOMSTRING_SIZE_ERR: Raised if the specified range of text does not
* fit into a <code>XalanDOMString</code>.
*/
virtual XalanDOMString
substringData(
unsigned int offset,
unsigned int count) const = 0;
//@}
/** @name Functions that set or change data. */
//@{
/**
* Append the string to the end of the character data of the node.
*
* Upon success, <code>data</code> provides access to the concatenation of
* <code>data</code> and the <code>XalanDOMString</code> specified.
* @param arg The <code>XalanDOMString</code> to append.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
appendData(const XalanDOMString& arg) = 0;
/**
* Insert a string at the specified character offset.
*
* @param offset The character offset at which to insert.
* @param arg The <code>XalanDOMString</code> to insert.
* @exception DOMException
* INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
* than the number of characters in <code>data</code>.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
insertData(
unsigned int offset,
const XalanDOMString& arg) = 0;
/**
* Remove a range of characters from the node.
*
* Upon success,
* <code>data</code> and <code>length</code> reflect the change.
* @param offset The offset from which to remove characters.
* @param count The number of characters to delete. If the sum of
* <code>offset</code> and <code>count</code> exceeds <code>length</code>
* then all characters from <code>offset</code> 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 <code>data</code>, or if the
* specified <code>count</code> is negative.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
deleteData(
unsigned int offset,
unsigned int 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
* <code>offset</code> and <code>count</code> exceeds <code>length</code>
* , then all characters to the end of the data are replaced (i.e., the
* effect is the same as a <code>remove</code> method call with the same
* range, followed by an <code>append</code> method invocation).
* @param arg The <code>XalanDOMString</code> 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 <code>data</code>, or if the
* specified <code>count</code> is negative.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
replaceData(
unsigned int offset,
unsigned int count,
const XalanDOMString& arg) = 0;
//@}
protected:
XalanCharacterData(const XalanCharacterData& theSource);
XalanCharacterData&
operator=(const XalanCharacterData& theSource);
bool
operator==(const XalanCharacterData& theRHS) const;
private:
};
#endif // !defined(XALANCHARACTERDATA_HEADER_GUARD_1357924680)
1.1 xml-xalan/c/src/XalanDOM/XalanComment.cpp
Index: XalanComment.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanComment.hpp"
XalanComment::XalanComment() :
XalanCharacterData()
{
}
XalanComment::~XalanComment()
{
}
XalanComment::XalanComment(const XalanComment& theSource) :
XalanCharacterData(theSource)
{
}
XalanComment&
XalanComment::operator=(const XalanComment& theSource)
{
XalanCharacterData::operator=(theSource);
return *this;
}
bool
XalanComment::operator==(const XalanComment& /* theRHS */) const
{
return false;
}
1.1 xml-xalan/c/src/XalanDOM/XalanComment.hpp
Index: XalanComment.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANCOMMENT_HEADER_GUARD_1357924680)
#define XALANCOMMENT_HEADER_GUARD_1357924680
#include <XalanDom/XalanDOMDefinitions.hpp>
#include <XalanDom/XalanCharacterData.hpp>
/*
* <meta name="usage" content="experimental"/>
*
* Base class for the DOM Comment interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanComment : public XalanCharacterData
{
public:
XalanComment();
virtual
~XalanComment();
// These interfaces are inherited from XalanNode...
virtual XalanDOMString
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
virtual XalanDOMString
getNodeValue() const = 0;
/**
* An enum value representing the type of the underlying object.
*/
virtual NodeType
getNodeType() const = 0;
/**
* Gets the parent of this node.
*
* All nodes, except <code>Document</code>,
* <code>DocumentFragment</code>, and <code>Attr</code> 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 <code>null</code> Node
* is returned.
*/
virtual XalanNode*
getParentNode() const = 0;
/**
* Gets a <code>NodeList</code> that contains all children of this node.
*
* If there
* are no children, this is a <code>NodeList</code> containing no nodes.
* The content of the returned <code>NodeList</code> 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 <code>NodeList</code> accessors; it is not a static snapshot of the
* content of the node. This is true for every <code>NodeList</code>,
* including the ones returned by the <code>getElementsByTagName</code>
* method.
*/
virtual const XalanNodeList*
getChildNodes() const = 0;
/**
* Gets the first child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getFirstChild() const = 0;
/**
* Gets the last child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getLastChild() const = 0;
/**
* Gets the node immediately preceding this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getPreviousSibling() const = 0;
/**
* Gets the node immediately following this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getNextSibling() const = 0;
/**
* Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it
* is an <code>Element</code>) or <code>null</code> otherwise.
*/
virtual const XalanNamedNodeMap*
getAttributes() const = 0;
/**
* Gets the <code>Document</code> object associated with this node.
*
* This is also
* the <code>Document</code> object used to create new nodes. When this
* node is a <code>Document</code> or a <code>DocumentType</code>
* which is not used with any <code>Document</code> yet, this is
* <code>null</code>.
*/
virtual XalanDocument*
getOwnerDocument() const = 0;
//@}
/** @name Cloning function. */
//@{
/**
* Returns a duplicate of this node.
*
* This function serves as a generic copy constructor for nodes.
*
* The duplicate node has no parent (
* <code>parentNode</code> returns <code>null</code>.).
* <br>Cloning an <code>Element</code> 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
* <code>Text</code> node. Cloning any other type of node simply returns a
* copy of this node.
* @param deep If <code>true</code>, recursively clone the subtree under the
* specified node; if <code>false</code>, clone only the node itself (and
* its attributes, if it is an <code>Element</code>).
* @return The duplicate node.
*/
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual XalanNode*
#else
virtual XalanComment*
#endif
cloneNode(bool deep) const = 0;
//@}
/** @name Functions to modify the DOM Node. */
//@{
/**
* Inserts the node <code>newChild</code> before the existing child node
* <code>refChild</code>.
*
* If <code>refChild</code> is <code>null</code>,
* insert <code>newChild</code> at the end of the list of children.
* <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
* all of its children are inserted, in the same order, before
* <code>refChild</code>. If the <code>newChild</code> is already in the
* tree, it is first removed. Note that a <code>Node</code> 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.
*/
virtual XalanNode*
insertBefore(
XalanNode* newChild,
XalanNode* refChild) = 0;
/**
* Replaces the child node <code>oldChild</code> with <code>newChild</code>
* in the list of children, and returns the <code>oldChild</code> node.
*
* If <CODE>newChild</CODE> is a <CODE>DocumentFragment</CODE> object,
* <CODE>oldChild</CODE> is replaced by all of the <CODE>DocumentFragment</CODE>
* children, which are inserted in the same order.
*
* If the <code>newChild</code> 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.
*/
virtual XalanNode*
replaceChild(
XalanNode* newChild,
XalanNode* oldChild) = 0;
/**
* Removes the child node indicated by <code>oldChild</code> from the list
* of children, and returns it.
*
* @param oldChild The node being removed.
* @return The node removed.
*/
virtual XalanNode*
removeChild(XalanNode* oldChild) = 0;
/**
* Adds the node <code>newChild</code> to the end of the list of children of
* this node.
*
* If the <code>newChild</code> is already in the tree, it is
* first removed.
* @param newChild The node to add.If it is a <code>DocumentFragment</code>
* object, the entire contents of the document fragment are moved into
* the child list of this node
* @return The node added.
*/
virtual XalanNode*
appendChild(XalanNode* newChild) = 0;
//@}
/** @name Query functions. */
//@{
/**
* This is a convenience method to allow easy determination of whether a
* node has any children.
*
* @return <code>true</code> if the node has any children,
* <code>false</code> if the node has no children.
*/
virtual bool
hasChildNodes() const = 0;
//@}
/** @name Set functions. */
//@{
/**
* Sets the value of the node.
*
* Any node which can have a nodeValue (@see getNodeValue) 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.
*/
virtual void
setNodeValue(const XalanDOMString& nodeValue) = 0;
//@}
/** @name Functions introduced in DOM Level 2. */
//@{
/**
* Puts all <CODE>Text</CODE>
* nodes in the full depth of the sub-tree underneath this <CODE>Node</CODE>,
* including attribute nodes, into a "normal" form where only markup (e.g.,
* tags, comments, processing instructions, CDATA sections, and entity
* references) separates <CODE>Text</CODE>
* nodes, i.e., there are no adjacent <CODE>Text</CODE>
* 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.
* <P><B>Note:</B> In cases where the document contains <CODE>CDATASections</CODE>,
* the normalize operation alone may not be sufficient, since XPointers do
* not differentiate between <CODE>Text</CODE>
* nodes and <CODE>CDATASection</CODE> nodes.</P>
*/
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 <code>hasFeature</code> on
* <code>DOMImplementation</code>.
* @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 <code>true</code>.
* @return Returns <code>true</code> if the specified feature is supported
* on this node, <code>false</code> otherwise.
*/
virtual bool
supports(
const XalanDOMString& feature,
const XalanDOMString& version) const = 0;
/**
* Get the <em>namespace URI</em> of
* this node, or <code>null</code> if it is unspecified.
* <p>
* 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.
* <p>
* For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
* <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
virtual XalanDOMString
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
virtual XalanDOMString
getPrefix() const = 0;
/**
* Returns the local part of the <em>qualified name</em> of this node.
* <p>
* For nodes created with a DOM Level 1 method, such as
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
virtual XalanDOMString
getLocalName() const = 0;
/**
* Set the <em>namespace prefix</em> of this node.
* <p>
* Note that setting this attribute, when permitted, changes
* the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified
* name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE>
* attributes of the <CODE>Element</CODE> and <CODE>Attr</CODE>
* interfaces, when applicable.
* <p>
* 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
* <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
*
* @param prefix The prefix of this node.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified prefix contains
* an illegal character.
* <br>
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>
* NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is
* malformed, if the specified prefix is "xml" and the
* <CODE>namespaceURI</CODE> of this node is different from
* "http://www.w3.org/XML/1998/namespace", if specified prefix is
* "xmlns" and the <CODE>namespaceURI</CODE> is neither
* <CODE>null</CODE> nor an empty string, or if the
* <CODE>localName</CODE> is <CODE>null</CODE>.
*/
virtual void
setPrefix(const XalanDOMString& prefix) = 0;
//@}
// These interfaces are inherited from XalanCharacterData...
/** @name Getter functions. */
//@{
/**
* 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 <code>CharacterData</code> node. However,
* implementation limits may mean that the entirety of a node's data may
* not fit into a single <code>XalanDOMString</code>. In such cases, the user
* may call <code>substringData</code> to retrieve the data in
* appropriately sized pieces.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
* @exception DOMException
* DOMSTRING_SIZE_ERR: Raised when it would return more characters than
* fit in a <code>XalanDOMString</code> variable on the implementation
* platform.
*/
virtual XalanDOMString
getData() const = 0;
/**
* Returns the number of characters that are available through <code>data</code> and
* the <code>substringData</code> method below.
*
* This may have the value
* zero, i.e., <code>CharacterData</code> nodes may be empty.
*/
virtual unsigned int
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 <code>offset</code> and
* <code>count</code> exceeds the <code>length</code>, 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 <code>data</code>, or if the
* specified <code>count</code> is negative.
* <br>DOMSTRING_SIZE_ERR: Raised if the specified range of text does not
* fit into a <code>XalanDOMString</code>.
*/
virtual XalanDOMString
substringData(
unsigned int offset,
unsigned int count) const = 0;
//@}
/** @name Functions that set or change data. */
//@{
/**
* Append the string to the end of the character data of the node.
*
* Upon success, <code>data</code> provides access to the concatenation of
* <code>data</code> and the <code>XalanDOMString</code> specified.
* @param arg The <code>XalanDOMString</code> to append.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
appendData(const XalanDOMString& arg) = 0;
/**
* Insert a string at the specified character offset.
*
* @param offset The character offset at which to insert.
* @param arg The <code>XalanDOMString</code> to insert.
* @exception DOMException
* INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
* than the number of characters in <code>data</code>.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
insertData(
unsigned int offset,
const XalanDOMString& arg) = 0;
/**
* Remove a range of characters from the node.
*
* Upon success,
* <code>data</code> and <code>length</code> reflect the change.
* @param offset The offset from which to remove characters.
* @param count The number of characters to delete. If the sum of
* <code>offset</code> and <code>count</code> exceeds <code>length</code>
* then all characters from <code>offset</code> 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 <code>data</code>, or if the
* specified <code>count</code> is negative.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
deleteData(
unsigned int offset,
unsigned int 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
* <code>offset</code> and <code>count</code> exceeds <code>length</code>
* , then all characters to the end of the data are replaced (i.e., the
* effect is the same as a <code>remove</code> method call with the same
* range, followed by an <code>append</code> method invocation).
* @param arg The <code>XalanDOMString</code> 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 <code>data</code>, or if the
* specified <code>count</code> is negative.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
replaceData(
unsigned int offset,
unsigned int count,
const XalanDOMString& arg) = 0;
//@}
protected:
XalanComment(const XalanComment& theSource);
XalanComment&
operator=(const XalanComment& theSource);
bool
operator==(const XalanComment& theRHS) const;
private:
};
#endif // !defined(XALANCOMMENT_HEADER_GUARD_1357924680)
1.1 xml-xalan/c/src/XalanDOM/XalanDocument.cpp
Index: XalanDocument.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanDocument.hpp"
XalanDocument::XalanDocument() :
XalanNode()
{
}
XalanDocument::~XalanDocument()
{
}
XalanDocument::XalanDocument(const XalanDocument& theSource) :
XalanNode(theSource)
{
}
XalanDocument&
XalanDocument::operator=(const XalanDocument& theSource)
{
XalanNode::operator=(theSource);
return *this;
}
bool
XalanDocument::operator==(const XalanDocument& /* theRHS */) const
{
return false;
}
1.1 xml-xalan/c/src/XalanDOM/XalanDocument.hpp
Index: XalanDocument.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANDOCUMENT_HEADER_GUARD_1357924680)
#define XALANDOCUMENT_HEADER_GUARD_1357924680
#include <XalanDom/XalanDOMDefinitions.hpp>
#include <XalanDom/XalanNode.hpp>
class XalanAttr;
class XalanCDATASection;
class XalanComment;
class XalanDocumentFragment;
class XalanDocumentType;
class XalanDOMImplementation;
class XalanElement;
class XalanEntityReference;
class XalanProcessingInstruction;
class XalanText;
/*
* <meta name="usage" content="experimental"/>
*
* Base class for the DOM Document interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanDocument : public XalanNode
{
public:
XalanDocument();
virtual
~XalanDocument();
// These interfaces are inherited from XalanNode...
virtual XalanDOMString
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
virtual XalanDOMString
getNodeValue() const = 0;
/**
* An enum value representing the type of the underlying object.
*/
virtual NodeType
getNodeType() const = 0;
/**
* Gets the parent of this node.
*
* All nodes, except <code>Document</code>,
* <code>DocumentFragment</code>, and <code>Attr</code> 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 <code>null</code> Node
* is returned.
*/
virtual XalanNode*
getParentNode() const = 0;
/**
* Gets a <code>NodeList</code> that contains all children of this node.
*
* If there
* are no children, this is a <code>NodeList</code> containing no nodes.
* The content of the returned <code>NodeList</code> 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 <code>NodeList</code> accessors; it is not a static snapshot of the
* content of the node. This is true for every <code>NodeList</code>,
* including the ones returned by the <code>getElementsByTagName</code>
* method.
*/
virtual const XalanNodeList*
getChildNodes() const = 0;
/**
* Gets the first child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getFirstChild() const = 0;
/**
* Gets the last child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getLastChild() const = 0;
/**
* Gets the node immediately preceding this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getPreviousSibling() const = 0;
/**
* Gets the node immediately following this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getNextSibling() const = 0;
/**
* Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it
* is an <code>Element</code>) or <code>null</code> otherwise.
*/
virtual const XalanNamedNodeMap*
getAttributes() const = 0;
/**
* Gets the <code>Document</code> object associated with this node.
*
* This is also
* the <code>Document</code> object used to create new nodes. When this
* node is a <code>Document</code> or a <code>DocumentType</code>
* which is not used with any <code>Document</code> yet, this is
* <code>null</code>.
*/
virtual XalanDocument*
getOwnerDocument() const = 0;
//@}
/** @name Cloning function. */
//@{
/**
* Returns a duplicate of this node.
*
* This function serves as a generic copy constructor for nodes.
*
* The duplicate node has no parent (
* <code>parentNode</code> returns <code>null</code>.).
* <br>Cloning an <code>Element</code> 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
* <code>Text</code> node. Cloning any other type of node simply returns a
* copy of this node.
* @param deep If <code>true</code>, recursively clone the subtree under the
* specified node; if <code>false</code>, clone only the node itself (and
* its attributes, if it is an <code>Element</code>).
* @return The duplicate node.
*/
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual XalanNode*
#else
virtual XalanDocument*
#endif
cloneNode(bool deep) const = 0;
//@}
/** @name Functions to modify the DOM Node. */
//@{
/**
* Inserts the node <code>newChild</code> before the existing child node
* <code>refChild</code>.
*
* If <code>refChild</code> is <code>null</code>,
* insert <code>newChild</code> at the end of the list of children.
* <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
* all of its children are inserted, in the same order, before
* <code>refChild</code>. If the <code>newChild</code> is already in the
* tree, it is first removed. Note that a <code>Node</code> 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.
*/
virtual XalanNode*
insertBefore(
XalanNode* newChild,
XalanNode* refChild) = 0;
/**
* Replaces the child node <code>oldChild</code> with <code>newChild</code>
* in the list of children, and returns the <code>oldChild</code> node.
*
* If <CODE>newChild</CODE> is a <CODE>DocumentFragment</CODE> object,
* <CODE>oldChild</CODE> is replaced by all of the <CODE>DocumentFragment</CODE>
* children, which are inserted in the same order.
*
* If the <code>newChild</code> 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.
*/
virtual XalanNode*
replaceChild(
XalanNode* newChild,
XalanNode* oldChild) = 0;
/**
* Removes the child node indicated by <code>oldChild</code> from the list
* of children, and returns it.
*
* @param oldChild The node being removed.
* @return The node removed.
*/
virtual XalanNode*
removeChild(XalanNode* oldChild) = 0;
/**
* Adds the node <code>newChild</code> to the end of the list of children of
* this node.
*
* If the <code>newChild</code> is already in the tree, it is
* first removed.
* @param newChild The node to add.If it is a <code>DocumentFragment</code>
* object, the entire contents of the document fragment are moved into
* the child list of this node
* @return The node added.
*/
virtual XalanNode*
appendChild(XalanNode* newChild) = 0;
//@}
/** @name Query functions. */
//@{
/**
* This is a convenience method to allow easy determination of whether a
* node has any children.
*
* @return <code>true</code> if the node has any children,
* <code>false</code> if the node has no children.
*/
virtual bool
hasChildNodes() const = 0;
//@}
/** @name Set functions. */
//@{
/**
* Sets the value of the node.
*
* Any node which can have a nodeValue (@see getNodeValue) 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.
*/
virtual void
setNodeValue(const XalanDOMString& nodeValue) = 0;
//@}
/** @name Functions introduced in DOM Level 2. */
//@{
/**
* Puts all <CODE>Text</CODE>
* nodes in the full depth of the sub-tree underneath this <CODE>Node</CODE>,
* including attribute nodes, into a "normal" form where only markup (e.g.,
* tags, comments, processing instructions, CDATA sections, and entity
* references) separates <CODE>Text</CODE>
* nodes, i.e., there are no adjacent <CODE>Text</CODE>
* 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.
* <P><B>Note:</B> In cases where the document contains <CODE>CDATASections</CODE>,
* the normalize operation alone may not be sufficient, since XPointers do
* not differentiate between <CODE>Text</CODE>
* nodes and <CODE>CDATASection</CODE> nodes.</P>
*/
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 <code>hasFeature</code> on
* <code>DOMImplementation</code>.
* @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 <code>true</code>.
* @return Returns <code>true</code> if the specified feature is supported
* on this node, <code>false</code> otherwise.
*/
virtual bool
supports(
const XalanDOMString& feature,
const XalanDOMString& version) const = 0;
/**
* Get the <em>namespace URI</em> of
* this node, or <code>null</code> if it is unspecified.
* <p>
* 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.
* <p>
* For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
* <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
virtual XalanDOMString
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
virtual XalanDOMString
getPrefix() const = 0;
/**
* Returns the local part of the <em>qualified name</em> of this node.
* <p>
* For nodes created with a DOM Level 1 method, such as
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
virtual XalanDOMString
getLocalName() const = 0;
/**
* Set the <em>namespace prefix</em> of this node.
* <p>
* Note that setting this attribute, when permitted, changes
* the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified
* name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE>
* attributes of the <CODE>Element</CODE> and <CODE>Attr</CODE>
* interfaces, when applicable.
* <p>
* 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
* <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
*
* @param prefix The prefix of this node.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified prefix contains
* an illegal character.
* <br>
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>
* NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is
* malformed, if the specified prefix is "xml" and the
* <CODE>namespaceURI</CODE> of this node is different from
* "http://www.w3.org/XML/1998/namespace", if specified prefix is
* "xmlns" and the <CODE>namespaceURI</CODE> is neither
* <CODE>null</CODE> nor an empty string, or if the
* <CODE>localName</CODE> is <CODE>null</CODE>.
*/
virtual void
setPrefix(const XalanDOMString& prefix) = 0;
//@}
// These interfaces are new to XalanDocument...
/**
* Creates an element of the type specified.
*
* Note that the instance returned
* implements the Element interface, so attributes can be specified
* directly on the returned object.
* @param tagName The name of the element type to instantiate.
* @return A <code>Element</code> that reference the new element.
*/
virtual XalanElement*
createElement(const XalanDOMString& tagName) = 0;
/**
* Creates an empty DocumentFragment object.
*
* @return A <code>DocumentFragment</code> that references the newly
* created document fragment.
*/
virtual XalanDocumentFragment*
createDocumentFragment() = 0;
/**
* Creates a Text node given the specified string.
*
* @param data The data for the node.
* @return A <code>Text</code> object that references the newly
* created text node.
*/
virtual XalanText*
createTextNode(const XalanDOMString& data) = 0;
/**
* Creates a Comment node given the specified string.
*
* @param data The data for the comment.
* @return A <code>Comment</code> that references the newly
* created comment node.
*/
virtual XalanComment*
createComment(const XalanDOMString& data) = 0;
/**
* Creates a CDATASection node whose value is the specified
* string.
*
* @param data The data for the <code>CDATASection</code> contents.
* @return A <code>CDATASection</code> object.
* @exception DOMException
* NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
*/
virtual XalanCDATASection*
createCDATASection(const XalanDOMString& data) = 0;
/**
* Creates a ProcessingInstruction 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 A <code>ProcessingInstruction</code> that references the newly
* created PI node.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if an illegal character is specified.
*/
virtual XalanProcessingInstruction*
createProcessingInstruction(
const XalanDOMString& target,
const XalanDOMString& data) = 0;
/**
* Creates an Attr of the given name.
*
* Note that the
* <code>Attr</code> instance can then be attached to an Element
* using the <code>DOMElement::setAttribute()</code> method.
* @param name The name of the attribute.
* @return A new <CODE>Attr</CODE>
* object with the <CODE>nodeName</CODE> attribute set to
* <CODE>name</CODE>, and <CODE>localName</CODE>, <CODE>prefix</CODE>,
* and <CODE>namespaceURI</CODE> set to
* <CODE>null</CODE>.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified name contains an
* illegal character.
*/
virtual XalanAttr*
createAttribute(const XalanDOMString& name) = 0;
/**
* Creates an EntityReference object.
*
* @param name The name of the entity to reference.
* @return A <code>EntityReference</code> that references the newly
* created EntityReference node.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified name contains an
* illegal character.
*/
virtual XalanEntityReference*
createEntityReference(const XalanDOMString &name) = 0;
//@}
/** @name Getter functions */
//@{
/**
* Get Document Type Declaration (see <code>DocumentType</code>) associated
* with this document.
*
* For documents without
* a document type declaration this returns <code>null</code> reference object. The DOM Level
* 1 does not support editing the Document Type Declaration, therefore
* <code>docType</code> cannot be altered in any way.
*/
virtual XalanDocumentType*
getDoctype() const = 0;
/**
* Return the <code>DOMImplementation</code> object that handles this document.
*/
virtual XalanDOMImplementation*
getImplementation() const = 0;
/**
* Return a reference to the root element of the document.
*/
virtual XalanElement*
getDocumentElement() const = 0;
/**
* Returns a <code>NodeList</code> of all the elements with a
* given tag name. 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.
*
* The elements in the node list are ordered in the same order in which they
* would be encountered in a
* preorder traversal of the <code>Document</code> tree.
* @param tagname The name of the tag to match on. The special value "*"
* matches all tags.
* @return A reference to a NodeList containing all the matched
* <code>Element</code>s.
*/
virtual XalanNodeList*
getElementsByTagName(const XalanDOMString& 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 (<CODE>parentNode</CODE> is
* <CODE>null</CODE>). The source node is not altered or removed from the
* original document; this method creates a new copy of the source
* node.<BR>For all nodes, importing a node creates a node object owned by
* the importing document, with attribute values identical to the source
* node's <CODE>nodeName</CODE> and <CODE>nodeType</CODE>, plus the
* attributes related to namespaces (prefix and namespaces URI).
*
* <p><b>"Experimental - subject to change"</b></p>
*
* @param importedNode The node to import.
* @param deep If <CODE>true</CODE>, recursively import the subtree under the
* specified node; if <CODE>false</CODE>, import only the node itself,
* as explained above. This does not apply to <CODE>Attr</CODE>,
* <CODE>EntityReference</CODE>, and <CODE>Notation</CODE> nodes.
* @return The imported node that belongs to this <CODE>Document</CODE>.
* @exception DOMException
* NOT_SUPPORTED_ERR: Raised if the type of node being imported is
* not supported.
*/
virtual XalanNode*
importNode(
XalanNode* importedNode,
bool deep) = 0;
/**
* Creates an element of the given qualified name and
* namespace URI.
*
* <p><b>"Experimental - subject to change"</b></p>
*
* @param namespaceURI The <em>namespace URI</em> of
* the element to create.
* @param qualifiedName The <em>qualified name</em>
* of the element type to instantiate.
* @return A new <code>Element</code> object.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified qualified name contains
* an illegal character.
* <br>
* NAMESPACE_ERR: Raised if the <CODE>qualifiedName</CODE> is
* malformed, if the <CODE>qualifiedName</CODE> has a prefix and the
* <CODE>namespaceURI</CODE> is <CODE>null</CODE> or an empty string,
* or if the <CODE>qualifiedName</CODE> has a prefix that is "xml" and
* the <CODE>namespaceURI</CODE> is different from
* "http://www.w3.org/XML/1998/namespace".
*/
virtual XalanElement*
createElementNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& qualifiedName) = 0;
/**
* Creates an attribute of the given qualified name and namespace
* URI.
*
* <p><b>"Experimental - subject to change"</b></p>
*
* @param namespaceURI The <em>namespace URI</em> of
* the attribute to create.
* @param qualifiedName The <em>qualified name</em>
* of the attribute to instantiate.
* @return A new <code>Attr</code> object.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified qualified name contains
* an illegal character.
* <br>
* NAMESPACE_ERR: Raised if the <CODE>qualifiedName</CODE> is
* malformed, if the <CODE>qualifiedName</CODE> has a prefix and the
* <CODE>namespaceURI</CODE> is <CODE>null</CODE> or an empty string,
* if the <CODE>qualifiedName</CODE> has a prefix that is "xml" and the
* <CODE>namespaceURI</CODE> is different from
* "http://www.w3.org/XML/1998/namespace", if the
* <CODE>qualifiedName</CODE> has a prefix that is "xmlns" and the
* <CODE>namespaceURI</CODE> is different from
* "http://www.w3.org/2000/xmlns/", or if the
* <CODE>qualifiedName</CODE> is "xmlns" and the
* <CODE>namespaceURI</CODE> is different from
* "http://www.w3.org/2000/xmlns/".
*/
virtual XalanAttr*
createAttributeNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& qualifiedName) = 0;
/**
* Returns a <code>NodeList</code> of all the <code>Element</code>s
* with a given <em>local name</em> and
* namespace URI in the order in which they would be encountered in a
* preorder traversal of the <code>Document</code> tree.
*
* <p><b>"Experimental - subject to change"</b></p>
*
* @param namespaceURI The <em>namespace URI</em> of
* the elements to match on. The special value "*" matches all
* namespaces.
* @param localName The <em>local name</em> of the
* elements to match on. The special value "*" matches all local names.
* @return A new <code>NodeList</code> object containing all the matched
* <code>Element</code>s.
*/
virtual XalanNodeList*
getElementsByTagNameNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const = 0;
/**
* Returns the <code>Element</code> whose ID is given by <code>elementId</code>.
* If no such element exists, returns <code>null</code>.
* Behavior is not defined if more than one element has this <code>ID</code>.
* <P><B>Note:</B> 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
* <CODE>null</CODE>.</P>
*
* <p><b>"Experimental - subject to change"</b></p>
*
* @param elementId The unique <code>id</code> value for an element.
* @return The matching element.
*/
virtual XalanElement*
getElementById(const XalanDOMString& elementId) const = 0;
//@}
protected:
XalanDocument(const XalanDocument& theSource);
XalanDocument&
operator=(const XalanDocument& theSource);
bool
operator==(const XalanDocument& theRHS) const;
private:
};
#endif // !defined(XALANDOCUMENT_HEADER_GUARD_1357924680)
1.1 xml-xalan/c/src/XalanDOM/XalanDocumentFragment.cpp
Index: XalanDocumentFragment.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanDocumentFragment.hpp"
XalanDocumentFragment::XalanDocumentFragment() :
XalanNode()
{
}
XalanDocumentFragment::~XalanDocumentFragment()
{
}
XalanDocumentFragment::XalanDocumentFragment(const XalanDocumentFragment& theSource) :
XalanNode(theSource)
{
}
XalanDocumentFragment&
XalanDocumentFragment::operator=(const XalanDocumentFragment& theSource)
{
XalanNode::operator=(theSource);
return *this;
}
bool
XalanDocumentFragment::operator==(const XalanDocumentFragment& /* theRHS */) const
{
return false;
}
1.1 xml-xalan/c/src/XalanDOM/XalanDocumentFragment.hpp
Index: XalanDocumentFragment.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANDOCUMENTFRAGMENT_HEADER_GUARD_1357924680)
#define XALANDOCUMENTFRAGMENT_HEADER_GUARD_1357924680
#include <XalanDom/XalanDOMDefinitions.hpp>
#include <XalanDom/XalanNode.hpp>
class XalanAttr;
class XalanCDATASection;
class XalanComment;
class XalanDocumentFragment;
class XalanElement;
class XalanEntityReference;
class XalanProcessingInstruction;
class XalanText;
/*
* <meta name="usage" content="experimental"/>
*
* Base class for the DOM DocumentFragment interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanDocumentFragment : public XalanNode
{
public:
XalanDocumentFragment();
virtual
~XalanDocumentFragment();
// These interfaces are inherited from XalanNode...
virtual XalanDOMString
getNodeName() const = 0;
virtual XalanDOMString
getNodeValue() const = 0;
virtual NodeType
getNodeType() const = 0;
virtual XalanNode*
getParentNode() const = 0;
virtual const XalanNodeList*
getChildNodes() const = 0;
virtual XalanNode*
getFirstChild() const = 0;
virtual XalanNode*
getLastChild() const = 0;
virtual XalanNode*
getPreviousSibling() const = 0;
virtual XalanNode*
getNextSibling() const = 0;
virtual const XalanNamedNodeMap*
getAttributes() const = 0;
virtual XalanDocument*
getOwnerDocument() const = 0;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual XalanNode*
#else
virtual XalanDocumentFragment*
#endif
cloneNode(bool deep) const = 0;
virtual XalanNode*
insertBefore(
XalanNode* newChild,
XalanNode* refChild) = 0;
virtual XalanNode*
replaceChild(
XalanNode* newChild,
XalanNode* oldChild) = 0;
virtual XalanNode*
removeChild(XalanNode* oldChild) = 0;
virtual XalanNode*
appendChild(XalanNode* newChild) = 0;
virtual bool
hasChildNodes() const = 0;
virtual void
setNodeValue(const XalanDOMString& nodeValue) = 0;
virtual void
normalize() = 0;
virtual bool
supports(
const XalanDOMString& feature,
const XalanDOMString& version) const = 0;
virtual XalanDOMString
getNamespaceURI() const = 0;
virtual XalanDOMString
getPrefix() const = 0;
virtual XalanDOMString
getLocalName() const = 0;
virtual void
setPrefix(const XalanDOMString& prefix) = 0;
protected:
XalanDocumentFragment(const XalanDocumentFragment& theSource);
XalanDocumentFragment&
operator=(const XalanDocumentFragment& theSource);
bool
operator==(const XalanDocumentFragment& theRHS) const;
private:
};
#endif // !defined(XALANDOCUMENTFRAGMENT_HEADER_GUARD_1357924680)
1.1 xml-xalan/c/src/XalanDOM/XalanDocumentType.cpp
Index: XalanDocumentType.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanDocumentType.hpp"
XalanDocumentType::XalanDocumentType() :
XalanNode()
{
}
XalanDocumentType::~XalanDocumentType()
{
}
XalanDocumentType::XalanDocumentType(const XalanDocumentType& theSource) :
XalanNode(theSource)
{
}
XalanDocumentType&
XalanDocumentType::operator=(const XalanDocumentType& theSource)
{
XalanNode::operator=(theSource);
return *this;
}
bool
XalanDocumentType::operator==(const XalanDocumentType& /* theRHS */) const
{
return false;
}
1.1 xml-xalan/c/src/XalanDOM/XalanDocumentType.hpp
Index: XalanDocumentType.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANDOCUMENTTYPE_HEADER_GUARD_1357924680)
#define XALANDOCUMENTTYPE_HEADER_GUARD_1357924680
#include <XalanDom/XalanDOMDefinitions.hpp>
#include <XalanDom/XalanNode.hpp>
class XalanDocument;
class XalanNamedNodeMap;
class XalanNodeList;
/*
* <meta name="usage" content="experimental"/>
*
* Base class for the DOM DocumentType interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanDocumentType : public XalanNode
{
public:
XalanDocumentType();
virtual
~XalanDocumentType();
// These interfaces are inherited from XalanNode...
/**
* Gets the name of this node.
*/
virtual XalanDOMString
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
virtual XalanDOMString
getNodeValue() const = 0;
/**
* An enum value representing the type of the underlying object.
*/
virtual NodeType
getNodeType() const = 0;
/**
* Gets the parent of this node.
*
* All nodes, except <code>Document</code>,
* <code>DocumentFragment</code>, and <code>Attr</code> 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 <code>null</code> Node
* is returned.
*/
virtual XalanNode*
getParentNode() const = 0;
/**
* Gets a <code>NodeList</code> that contains all children of this node.
*
* If there
* are no children, this is a <code>NodeList</code> containing no nodes.
* The content of the returned <code>NodeList</code> 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 <code>NodeList</code> accessors; it is not a static snapshot of the
* content of the node. This is true for every <code>NodeList</code>,
* including the ones returned by the <code>getElementsByTagName</code>
* method.
*/
virtual const XalanNodeList*
getChildNodes() const = 0;
/**
* Gets the first child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getFirstChild() const = 0;
/**
* Gets the last child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getLastChild() const = 0;
/**
* Gets the node immediately preceding this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getPreviousSibling() const = 0;
/**
* Gets the node immediately following this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getNextSibling() const = 0;
/**
* Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it
* is an <code>Element</code>) or <code>null</code> otherwise.
*/
virtual const XalanNamedNodeMap*
getAttributes() const = 0;
/**
* Gets the <code>Document</code> object associated with this node.
*
* This is also
* the <code>Document</code> object used to create new nodes. When this
* node is a <code>Document</code> or a <code>DocumentType</code>
* which is not used with any <code>Document</code> yet, this is
* <code>null</code>.
*/
virtual XalanDocument*
getOwnerDocument() const = 0;
//@}
/** @name Cloning function. */
//@{
/**
* Returns a duplicate of this node.
*
* This function serves as a generic copy constructor for nodes.
*
* The duplicate node has no parent (
* <code>parentNode</code> returns <code>null</code>.).
* <br>Cloning an <code>Element</code> 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
* <code>Text</code> node. Cloning any other type of node simply returns a
* copy of this node.
* @param deep If <code>true</code>, recursively clone the subtree under the
* specified node; if <code>false</code>, clone only the node itself (and
* its attributes, if it is an <code>Element</code>).
* @return The duplicate node.
*/
virtual XalanNode*
cloneNode(bool deep) const = 0;
//@}
/** @name Functions to modify the DOM Node. */
//@{
/**
* Inserts the node <code>newChild</code> before the existing child node
* <code>refChild</code>.
*
* If <code>refChild</code> is <code>null</code>,
* insert <code>newChild</code> at the end of the list of children.
* <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
* all of its children are inserted, in the same order, before
* <code>refChild</code>. If the <code>newChild</code> is already in the
* tree, it is first removed. Note that a <code>Node</code> 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.
*/
virtual XalanNode*
insertBefore(
XalanNode* newChild,
XalanNode* refChild) = 0;
/**
* Replaces the child node <code>oldChild</code> with <code>newChild</code>
* in the list of children, and returns the <code>oldChild</code> node.
*
* If <CODE>newChild</CODE> is a <CODE>DocumentFragment</CODE> object,
* <CODE>oldChild</CODE> is replaced by all of the <CODE>DocumentFragment</CODE>
* children, which are inserted in the same order.
*
* If the <code>newChild</code> 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.
*/
virtual XalanNode*
replaceChild(
XalanNode* newChild,
XalanNode* oldChild) = 0;
/**
* Removes the child node indicated by <code>oldChild</code> from the list
* of children, and returns it.
*
* @param oldChild The node being removed.
* @return The node removed.
*/
virtual XalanNode*
removeChild(XalanNode* oldChild) = 0;
/**
* Adds the node <code>newChild</code> to the end of the list of children of
* this node.
*
* If the <code>newChild</code> is already in the tree, it is
* first removed.
* @param newChild The node to add.If it is a <code>DocumentFragment</code>
* object, the entire contents of the document fragment are moved into
* the child list of this node
* @return The node added.
*/
virtual XalanNode*
appendChild(XalanNode* newChild) = 0;
//@}
/** @name Query functions. */
//@{
/**
* This is a convenience method to allow easy determination of whether a
* node has any children.
*
* @return <code>true</code> if the node has any children,
* <code>false</code> if the node has no children.
*/
virtual bool
hasChildNodes() const = 0;
//@}
/** @name Set functions. */
//@{
/**
* Sets the value of the node.
*
* Any node which can have a nodeValue (@see getNodeValue) 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.
*/
virtual void
setNodeValue(const XalanDOMString& nodeValue) = 0;
//@}
/** @name Functions introduced in DOM Level 2. */
//@{
/**
* Puts all <CODE>Text</CODE>
* nodes in the full depth of the sub-tree underneath this <CODE>Node</CODE>,
* including attribute nodes, into a "normal" form where only markup (e.g.,
* tags, comments, processing instructions, CDATA sections, and entity
* references) separates <CODE>Text</CODE>
* nodes, i.e., there are no adjacent <CODE>Text</CODE>
* 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.
* <P><B>Note:</B> In cases where the document contains <CODE>CDATASections</CODE>,
* the normalize operation alone may not be sufficient, since XPointers do
* not differentiate between <CODE>Text</CODE>
* nodes and <CODE>CDATASection</CODE> nodes.</P>
*/
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 <code>hasFeature</code> on
* <code>DOMImplementation</code>.
* @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 <code>true</code>.
* @return Returns <code>true</code> if the specified feature is supported
* on this node, <code>false</code> otherwise.
*/
virtual bool
supports(
const XalanDOMString& feature,
const XalanDOMString& version) const = 0;
/**
* Get the <em>namespace URI</em> of
* this node, or <code>null</code> if it is unspecified.
* <p>
* 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.
* <p>
* For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
* <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
virtual XalanDOMString
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
virtual XalanDOMString
getPrefix() const = 0;
/**
* Returns the local part of the <em>qualified name</em> of this node.
* <p>
* For nodes created with a DOM Level 1 method, such as
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
virtual XalanDOMString
getLocalName() const = 0;
/**
* Set the <em>namespace prefix</em> of this node.
* <p>
* Note that setting this attribute, when permitted, changes
* the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified
* name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE>
* attributes of the <CODE>Element</CODE> and <CODE>Attr</CODE>
* interfaces, when applicable.
* <p>
* 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
* <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
*
* @param prefix The prefix of this node.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified prefix contains
* an illegal character.
* <br>
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>
* NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is
* malformed, if the specified prefix is "xml" and the
* <CODE>namespaceURI</CODE> of this node is different from
* "http://www.w3.org/XML/1998/namespace", if specified prefix is
* "xmlns" and the <CODE>namespaceURI</CODE> is neither
* <CODE>null</CODE> nor an empty string, or if the
* <CODE>localName</CODE> is <CODE>null</CODE>.
*/
virtual void
setPrefix(const XalanDOMString& prefix) = 0;
//@}
// These interfaces are new to XalanDocumentType...
/** @name Getter functions. */
//@{
/**
* The name of DTD; i.e., the name immediately following the
* <code>DOCTYPE</code> keyword in an XML source document.
*/
virtual XalanDOMString
getName() const = 0;
/**
* This function returns a <code>NamedNodeMap</code> containing the general entities, both
* external and internal, declared in the DTD. Parameter entities are not contained.
* Duplicates are discarded.
*/
virtual const XalanNamedNodeMap*
getEntities() const = 0;
/**
* This function returns a named node map containing an entry for
* each notation declared in a document's DTD. Duplicates are discarded.
*/
virtual const XalanNamedNodeMap*
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.
*/
virtual XalanDOMString
getPublicId() const = 0;
/**
* Get the system identifier of the external subset.
* @return The system identifier of the external subset.
*/
virtual XalanDOMString
getSystemId() const = 0;
/**
* Get the internal subset as a string.
* @return The internal subset as a string.
*/
virtual XalanDOMString
getInternalSubset() const = 0;
//@}
protected:
XalanDocumentType(const XalanDocumentType& theSource);
XalanDocumentType&
operator=(const XalanDocumentType& theSource);
bool
operator==(const XalanDocumentType& theRHS) const;
private:
};
#endif // !defined(XALANDOCUMENTTYPE_HEADER_GUARD_1357924680)
1.1 xml-xalan/c/src/XalanDOM/XalanDOMDefinitions.hpp
Index: XalanDOMDefinitions.hpp
===================================================================
#if !defined(XALAN_DOM_DEFINITIONS)
#define XALAN_DOM_DEFINITIONS
#include <Include/PlatformDefinitions.hpp>
#if defined(XALAN_DOM_BUILD_DLL)
#define XALAN_DOM_EXPORT XALAN_PLATFORM_EXPORT
#define XALAN_DOM_EXPORT_FUNCTION(T) XALAN_PLATFORM_EXPORT_FUNCTION(T)
#else
#define XALAN_DOM_EXPORT XALAN_PLATFORM_IMPORT
#define XALAN_DOM_EXPORT_FUNCTION(T) XALAN_PLATFORM_IMPORT_FUNCTION(T)
#endif
#endif
1.1 xml-xalan/c/src/XalanDOM/XalanDOMException.cpp
Index: XalanDOMException.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanDOMException.hpp"
XalanDOMException::XalanDOMException(ExceptionCode code) :
m_code(code)
{
}
XalanDOMException::XalanDOMException(const XalanDOMException& theSource) :
m_code(theSource.m_code)
{
}
XalanDOMException::~XalanDOMException()
{
}
XalanDOMException::ExceptionCode
XalanDOMException::getExceptionCode() const
{
return m_code;
}
1.1 xml-xalan/c/src/XalanDOM/XalanDOMException.hpp
Index: XalanDOMException.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANDOMEXCEPTION_HEADER_GUARD_1357924680)
#define XALANDOMEXCEPTION_HEADER_GUARD_1357924680
#include <XalanDom/XalanDOMDefinitions.hpp>
/*
* <meta name="usage" content="experimental"/>
*
* Base class for the DOM Exception interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanDOMException
{
public:
/** @name Enumerators for DOM Exceptions */
//@{
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,
// This is the first available number,
// according to the spec.
UNKNOWN = 201
};
//@}
/** @name Constructors and assignment operator */
//@{
/**
* Constructor which takes an error code and a message.
*
* @param code The error code which indicates the exception
*/
explicit
XalanDOMException(ExceptionCode code = UNKNOWN);
/**
* Copy constructor.
*
* @param other The object to be copied.
*/
XalanDOMException(const XalanDOMException& theSource);
//@}
/** @name Destructor. */
//@{
/**
* Destructor for XalanDOMException.
*/
virtual
~XalanDOMException();
//@}
/** @name Get functions. */
//@{
/**
* Returns a code value, from the set defined by the ExceptionCode enum,
* indicating the type of error that occurred.
* @return The exception code.
*/
virtual ExceptionCode
getExceptionCode() const;
private:
const ExceptionCode m_code;
};
#endif // !defined(XALANDOMEXCEPTION_HEADER_GUARD_1357924680)
1.1 xml-xalan/c/src/XalanDOM/XalanDOMImplementation.cpp
Index: XalanDOMImplementation.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanDOMImplementation.hpp"
XalanDOMImplementation::XalanDOMImplementation()
{
}
XalanDOMImplementation::~XalanDOMImplementation()
{
}
XalanDOMImplementation::XalanDOMImplementation(const XalanDOMImplementation& /* theSource */)
{
}
XalanDOMImplementation&
XalanDOMImplementation::operator=(const XalanDOMImplementation& /* theSource */)
{
return *this;
}
bool
XalanDOMImplementation::operator==(const XalanDOMImplementation& /* theRHS */) const
{
return false;
}
1.1 xml-xalan/c/src/XalanDOM/XalanDOMImplementation.hpp
Index: XalanDOMImplementation.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANDOMIMPLEMENTATION_HEADER_GUARD_1357924680)
#define XALANDOMIMPLEMENTATION_HEADER_GUARD_1357924680
#include <XalanDom/XalanDOMDefinitions.hpp>
#include <XalanDom/XalanDOMString.hpp>
class XalanDocument;
class XalanDocumentType;
/*
* <meta name="usage" content="experimental"/>
*
* Base class for the DOM DOMImplementation interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanDOMImplementation
{
public:
XalanDOMImplementation();
virtual
~XalanDOMImplementation();
/** @name Getter functions */
//@{
/**
* Test if the DOM implementation implements a specific feature.
*
* @param feature The string of the feature to test (case-insensitive). The legal
* values are defined throughout this specification. The string must be
* an <EM>XML name</EM> (see also Compliance).
* @param version This is the version number of the package name to test.
* In Level 1, this is the string "1.0". If the version is not specified,
* supporting any version of the feature will cause the method to return
* <code>true</code>.
* @return <code>true</code> if the feature is implemented in the specified
* version, <code>false</code> otherwise.
*/
virtual bool
hasFeature(
const XalanDOMString& feature,
const XalanDOMString& version) = 0;
//@}
/** @name Functions introduced in DOM Level 2. */
//@{
/**
* Creates an empty <code>DocumentType</code> 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 <code>DocumentType</code>.
* @param qualifiedName The <em>qualified name</em>
* of the document type to be created.
* @param publicId The external subset public identifier.
* @param systemId The external subset system identifier.
* @return A new <code>DocumentType</code> node with
* <code>Node.ownerDocument</code> set to <code>null</code>.
*/
virtual XalanDocumentType*
createDocumentType(
const XalanDOMString& qualifiedName,
const XalanDOMString& publicId,
const XalanDOMString& systemId) = 0;
/**
* Creates an XML <code>Document</code> object of the specified type
* with its document element.
* @param namespaceURI The <em>namespace URI</em> of
* the document element to create, or <code>null</code>.
* @param qualifiedName The <em>qualified name</em>
* of the document element to be created.
* @param doctype The type of document to be created or <code>null</code>.
* <p>When <code>doctype</code> is not <code>null</code>, its
* <code>Node.ownerDocument</code> attribute is set to the document
* being created.
* @return A new <code>Document</code> object.
* @exception DOMException
* WRONG_DOCUMENT_ERR: Raised if <code>doctype</code> has already
* been used with a different document.
*/
virtual XalanDocument*
createDocument(
const XalanDOMString& namespaceURI,
const XalanDOMString& qualifiedName,
const XalanDocumentType& doctype) = 0;
//@}
protected:
XalanDOMImplementation(const XalanDOMImplementation& theSource);
XalanDOMImplementation&
operator=(const XalanDOMImplementation& theSource);
bool
operator==(const XalanDOMImplementation& theRHS) const;
private:
};
#endif // !defined (XALANDOMIMPLEMENTATION_HEADER_GUARD_1357924680)
1.1 xml-xalan/c/src/XalanDOM/XalanDOMString.hpp
Index: XalanDOMString.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANDOMSTRING_HEADER_GUARD_1357924680)
#define XALANDOMSTRING_HEADER_GUARD_1357924680
#include <XalanDOM/XalanDOMDefinitions.hpp>
#if defined(XALAN_USE_STD_STRING)
#include <string>
typedef unsigned short XalanDOMChar;
typedef std::basic_string<XalanDOMChar> XalanDOMString;
#elif defined(XALAN_USE_VECTOR_FOR_STRING)
#include <vector>
typedef unsigned short XalanDOMChar;
typedef std::vector<XalanDOMChar> XalanDOMString;
#else
#include <dom/DOMString.hpp>
typedef XMLCh XalanDOMChar;
typedef DOMString XalanDOMString;
#endif
#endif // !defined(XALANDOMSTRING_HEADER_GUARD_1357924680)
1.1 xml-xalan/c/src/XalanDOM/XalanElement.cpp
Index: XalanElement.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanElement.hpp"
XalanElement::XalanElement() :
XalanNode()
{
}
XalanElement::~XalanElement()
{
}
XalanElement::XalanElement(const XalanElement& theSource) :
XalanNode(theSource)
{
}
XalanElement&
XalanElement::operator=(const XalanElement& theSource)
{
XalanNode::operator=(theSource);
return *this;
}
bool
XalanElement::operator==(const XalanElement& /* theRHS */) const
{
return false;
}
1.1 xml-xalan/c/src/XalanDOM/XalanElement.hpp
Index: XalanElement.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANELEMENT_HEADER_GUARD_1357924680)
#define XALANELEMENT_HEADER_GUARD_1357924680
#include <XalanDom/XalanDOMDefinitions.hpp>
#include <XalanDom/XalanNode.hpp>
class XalanAttr;
/*
* <meta name="usage" content="experimental"/>
*
* Base class for the DOM Element interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanElement : public XalanNode
{
public:
XalanElement();
virtual
~XalanElement();
// These interfaces are inherited from XalanNode
virtual XalanDOMString
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
virtual XalanDOMString
getNodeValue() const = 0;
/**
* An enum value representing the type of the underlying object.
*/
virtual NodeType
getNodeType() const = 0;
/**
* Gets the parent of this node.
*
* All nodes, except <code>Document</code>,
* <code>DocumentFragment</code>, and <code>Attr</code> 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 <code>null</code> Node
* is returned.
*/
virtual XalanNode*
getParentNode() const = 0;
/**
* Gets a <code>NodeList</code> that contains all children of this node.
*
* If there
* are no children, this is a <code>NodeList</code> containing no nodes.
* The content of the returned <code>NodeList</code> 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 <code>NodeList</code> accessors; it is not a static snapshot of the
* content of the node. This is true for every <code>NodeList</code>,
* including the ones returned by the <code>getElementsByTagName</code>
* method.
*/
virtual const XalanNodeList*
getChildNodes() const = 0;
/**
* Gets the first child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getFirstChild() const = 0;
/**
* Gets the last child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getLastChild() const = 0;
/**
* Gets the node immediately preceding this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getPreviousSibling() const = 0;
/**
* Gets the node immediately following this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getNextSibling() const = 0;
/**
* Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it
* is an <code>Element</code>) or <code>null</code> otherwise.
*/
virtual const XalanNamedNodeMap*
getAttributes() const = 0;
/**
* Gets the <code>Document</code> object associated with this node.
*
* This is also
* the <code>Document</code> object used to create new nodes. When this
* node is a <code>Document</code> or a <code>DocumentType</code>
* which is not used with any <code>Document</code> yet, this is
* <code>null</code>.
*/
virtual XalanDocument*
getOwnerDocument() const = 0;
//@}
/** @name Cloning function. */
//@{
/**
* Returns a duplicate of this node.
*
* This function serves as a generic copy constructor for nodes.
*
* The duplicate node has no parent (
* <code>parentNode</code> returns <code>null</code>.).
* <br>Cloning an <code>Element</code> 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
* <code>Text</code> node. Cloning any other type of node simply returns a
* copy of this node.
* @param deep If <code>true</code>, recursively clone the subtree under the
* specified node; if <code>false</code>, clone only the node itself (and
* its attributes, if it is an <code>Element</code>).
* @return The duplicate node.
*/
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual XalanNode*
#else
virtual XalanElement*
#endif
cloneNode(bool deep) const = 0;
//@}
/** @name Functions to modify the DOM Node. */
//@{
/**
* Inserts the node <code>newChild</code> before the existing child node
* <code>refChild</code>.
*
* If <code>refChild</code> is <code>null</code>,
* insert <code>newChild</code> at the end of the list of children.
* <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
* all of its children are inserted, in the same order, before
* <code>refChild</code>. If the <code>newChild</code> is already in the
* tree, it is first removed. Note that a <code>Node</code> 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.
*/
virtual XalanNode*
insertBefore(
XalanNode* newChild,
XalanNode* refChild) = 0;
/**
* Replaces the child node <code>oldChild</code> with <code>newChild</code>
* in the list of children, and returns the <code>oldChild</code> node.
*
* If <CODE>newChild</CODE> is a <CODE>DocumentFragment</CODE> object,
* <CODE>oldChild</CODE> is replaced by all of the <CODE>DocumentFragment</CODE>
* children, which are inserted in the same order.
*
* If the <code>newChild</code> 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.
*/
virtual XalanNode*
replaceChild(
XalanNode* newChild,
XalanNode* oldChild) = 0;
/**
* Removes the child node indicated by <code>oldChild</code> from the list
* of children, and returns it.
*
* @param oldChild The node being removed.
* @return The node removed.
*/
virtual XalanNode*
removeChild(XalanNode* oldChild) = 0;
/**
* Adds the node <code>newChild</code> to the end of the list of children of
* this node.
*
* If the <code>newChild</code> is already in the tree, it is
* first removed.
* @param newChild The node to add.If it is a <code>DocumentFragment</code>
* object, the entire contents of the document fragment are moved into
* the child list of this node
* @return The node added.
*/
virtual XalanNode*
appendChild(XalanNode* newChild) = 0;
//@}
/** @name Query functions. */
//@{
/**
* This is a convenience method to allow easy determination of whether a
* node has any children.
*
* @return <code>true</code> if the node has any children,
* <code>false</code> if the node has no children.
*/
virtual bool
hasChildNodes() const = 0;
//@}
/** @name Set functions. */
//@{
/**
* Sets the value of the node.
*
* Any node which can have a nodeValue (@see getNodeValue) 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.
*/
virtual void
setNodeValue(const XalanDOMString& nodeValue) = 0;
//@}
/** @name Functions introduced in DOM Level 2. */
//@{
/**
* Puts all <CODE>Text</CODE>
* nodes in the full depth of the sub-tree underneath this <CODE>Node</CODE>,
* including attribute nodes, into a "normal" form where only markup (e.g.,
* tags, comments, processing instructions, CDATA sections, and entity
* references) separates <CODE>Text</CODE>
* nodes, i.e., there are no adjacent <CODE>Text</CODE>
* 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.
* <P><B>Note:</B> In cases where the document contains <CODE>CDATASections</CODE>,
* the normalize operation alone may not be sufficient, since XPointers do
* not differentiate between <CODE>Text</CODE>
* nodes and <CODE>CDATASection</CODE> nodes.</P>
*/
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 <code>hasFeature</code> on
* <code>DOMImplementation</code>.
* @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 <code>true</code>.
* @return Returns <code>true</code> if the specified feature is supported
* on this node, <code>false</code> otherwise.
*/
virtual bool
supports(
const XalanDOMString& feature,
const XalanDOMString& version) const = 0;
/**
* Get the <em>namespace URI</em> of
* this node, or <code>null</code> if it is unspecified.
* <p>
* 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.
* <p>
* For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
* <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
virtual XalanDOMString
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
virtual XalanDOMString
getPrefix() const = 0;
/**
* Returns the local part of the <em>qualified name</em> of this node.
* <p>
* For nodes created with a DOM Level 1 method, such as
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
virtual XalanDOMString
getLocalName() const = 0;
/**
* Set the <em>namespace prefix</em> of this node.
* <p>
* Note that setting this attribute, when permitted, changes
* the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified
* name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE>
* attributes of the <CODE>Element</CODE> and <CODE>Attr</CODE>
* interfaces, when applicable.
* <p>
* 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
* <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
*
* @param prefix The prefix of this node.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified prefix contains
* an illegal character.
* <br>
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>
* NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is
* malformed, if the specified prefix is "xml" and the
* <CODE>namespaceURI</CODE> of this node is different from
* "http://www.w3.org/XML/1998/namespace", if specified prefix is
* "xmlns" and the <CODE>namespaceURI</CODE> is neither
* <CODE>null</CODE> nor an empty string, or if the
* <CODE>localName</CODE> is <CODE>null</CODE>.
*/
virtual void
setPrefix(const XalanDOMString& prefix) = 0;
//@}
// These interfaces are new to XalanElement...
/**
* The name of the element.
*
* For example, in: <elementExample
* id="demo"> ... </elementExample> , <code>tagName</code> has
* the value <code>"elementExample"</code>. Note that this is
* case-preserving in XML, as are all of the operations of the DOM.
*/
virtual XalanDOMString
getTagName() const = 0;
/**
* Retrieves an attribute value by name.
*
* @param name The name of the attribute to retrieve.
* @return The <code>Attr</code> value as a string, or the empty string if
* that attribute does not have a specified or default value.
*/
virtual XalanDOMString
getAttribute(const XalanDOMString& name) const = 0;
/**
* Retrieves an <code>Attr</code> node by name.
*
* @param name The name (<CODE>nodeName</CODE>) of the attribute to retrieve.
* @return The <code>Attr</code> node with the specified name (<CODE>nodeName</CODE>) or
* <code>null</code> if there is no such attribute.
*/
virtual XalanAttr*
getAttributeNode(const XalanDOMString& name) const = 0;
/**
* Returns a <code>NodeList</code> of all descendant elements with a given
* tag name, in the order in which they would be encountered in a preorder
* traversal of the <code>Element</code> tree. Caller is
* responsible for deleting the XalanNodeList instance.
*
* @param name The name of the tag to match on. The special value "*"
* matches all tags.
* @return A list of matching <code>Element</code> nodes.
*/
virtual XalanNodeList*
getElementsByTagName(const XalanDOMString& name) const = 0;
//@}
/** @name Set functions. */
//@{
/**
* 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
* <code>Attr</code> node plus any <code>Text</code> and
* <code>EntityReference</code> nodes, build the appropriate subtree, and
* use <code>setAttributeNode</code> 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.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
setAttribute(
const XalanDOMString& name,
const XalanDOMString& value) = 0;
/**
* Adds a new attribute.
*
* If an attribute with that name (<CODE>nodeName</CODE>) is already present
* in the element, it is replaced by the new one.
* @param newAttr The <code>Attr</code> node to add to the attribute list.
* @return If the <code>newAttr</code> attribute replaces an existing
* attribute, the replaced
* <code>Attr</code> node is returned, otherwise <code>null</code> is
* returned.
* @exception DOMException
* WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a
* different document than the one that created the element.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an
* attribute of another <code>Element</code> object. The DOM user must
* explicitly clone <code>Attr</code> nodes to re-use them in other
* elements.
*/
virtual XalanAttr*
setAttributeNode(XalanAttr* newAttr) = 0;
//@}
/** @name Functions which modify the Element. */
//@{
/**
* Removes the specified attribute node.
* If the removed <CODE>Attr</CODE>
* 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 <code>Attr</code> node to remove from the attribute
* list.
* @return The <code>Attr</code> node that was removed.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>NOT_FOUND_ERR: Raised if <code>oldAttr</code> is not an attribute
* of the element.
*/
virtual XalanAttr*
removeAttributeNode(XalanAttr* 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.<BR>To remove an attribute by local
* name and namespace URI, use the <CODE>removeAttributeNS</CODE> method.
* @param name The name of the attribute to remove.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
removeAttribute(const XalanDOMString& name) = 0;
//@}
/** @name Functions introduced in DOM Level 2. */
//@{
/**
* Retrieves an attribute value by local name and namespace URI.
*
* @param namespaceURI The <em>namespace URI</em> of
* the attribute to retrieve.
* @param localName The <em>local name</em> of the
* attribute to retrieve.
* @return The <code>Attr</code> value as a string, or an empty string if
* that attribute does not have a specified or default value.
*/
virtual XalanDOMString
getAttributeNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const = 0;
/**
* Adds a new attribute. If the given
* <CODE>namespaceURI</CODE> is <CODE>null</CODE> or an empty string and the
* <CODE>qualifiedName</CODE> has a prefix that is "xml", the new attribute
* is bound to the predefined namespace
* "http://www.w3.org/XML/1998/namespace".
* 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
* <CODE>qualifiedName</CODE>, and its value is changed to be the
* <CODE>value</CODE> 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 a <code>Attr</code> node plus any
* <code>Text</code> and <code>EntityReference</code> nodes, build the
* appropriate subtree, and use <code>setAttributeNodeNS</code> or
* <code>setAttributeNode</code> to assign it as the value of an
* attribute.
* @param namespaceURI The <em>namespace URI</em> of
* the attribute to create or alter.
* @param localName The <em>local name</em> 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.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>
* NAMESPACE_ERR: Raised if the <CODE>qualifiedName</CODE> is
* malformed, if the <CODE>qualifiedName</CODE> has a prefix that is
* "xml" and the <CODE>namespaceURI</CODE> is neither <CODE>null</CODE>
* nor an empty string nor "http://www.w3.org/XML/1998/namespace", or
* if the <CODE>qualifiedName</CODE> has a prefix that is "xmlns" but
* the <CODE>namespaceURI</CODE> is neither <CODE>null</CODE> nor an
* empty string, or if if the <CODE>qualifiedName</CODE> has a prefix
* different from "xml" and "xmlns" and the <CODE>namespaceURI</CODE>
* is <CODE>null</CODE> or an empty string.
*/
virtual void
setAttributeNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& qualifiedName,
const XalanDOMString& 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.<BR>HTML-only DOM implementations do not need to
* implement this method.
*
* @param namespaceURI The <em>namespace URI</em> of
* the attribute to remove.
* @param localName The <em>local name</em> of the
* attribute to remove.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
removeAttributeNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) = 0;
/**
* Retrieves an <code>Attr</code> node by local name and namespace URI.
*
* @param namespaceURI The <em>namespace URI</em> of
* the attribute to retrieve.
* @param localName The <em>local name</em> of the
* attribute to retrieve.
* @return The <code>Attr</code> node with the specified attribute local
* name and namespace URI or <code>null</code> if there is no such attribute.
*/
virtual XalanAttr*
getAttributeNodeNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& 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 <code>Attr</code> node to add to the attribute list.
* @return If the <code>newAttr</code> attribute replaces an existing
* attribute with the same <em>local name</em> and <em>namespace URI</em>,
* the replaced <code>Attr</code> node is
* returned, otherwise <code>null</code> is returned.
* @exception DOMException
* WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a
* different document than the one that created the element.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an
* attribute of another <code>Element</code> object. The DOM user must
* explicitly clone <code>Attr</code> nodes to re-use them in other
* elements.
*/
virtual XalanAttr*
setAttributeNodeNS(XalanAttr* newAttr) = 0;
/**
* Returns a <code>NodeList</code> of all the <code>Element</code>s
* with a given local name and namespace URI in the order in which they
* would be encountered in a preorder traversal of the
* <code>Document</code> tree, starting from this node. Caller is
* responsible for deleting the XalanNodeList instance.
*
* @param namespaceURI The <em>namespace URI</em> of
* the elements to match on. The special value "*" matches all
* namespaces.
* @param localName The <em>local name</em> of the
* elements to match on. The special value "*" matches all local names.
* @return A new <code>NodeList</code> object containing all the matched
* <code>Element</code>s.
*/
virtual XalanNodeList*
getElementsByTagNameNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const = 0;
//@}
protected:
XalanElement(const XalanElement& theSource);
XalanElement&
operator=(const XalanElement& theSource);
bool
operator==(const XalanElement& theRHS) const;
private:
};
#endif // !defined(XALANELEMENT_HEADER_GUARD_1357924680)
1.1 xml-xalan/c/src/XalanDOM/XalanEntity.cpp
Index: XalanEntity.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanEntity.hpp"
XalanEntity::XalanEntity() :
XalanNode()
{
}
XalanEntity::~XalanEntity()
{
}
XalanEntity::XalanEntity(const XalanEntity& theSource) :
XalanNode(theSource)
{
}
XalanEntity&
XalanEntity::operator=(const XalanEntity& theSource)
{
XalanNode::operator=(theSource);
return *this;
}
bool
XalanEntity::operator==(const XalanEntity& /* theRHS */) const
{
return false;
}
1.1 xml-xalan/c/src/XalanDOM/XalanEntity.hpp
Index: XalanEntity.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANENTITY_HEADER_GUARD_1357924680)
#define XALANENTITY_HEADER_GUARD_1357924680
#include <XalanDom/XalanDOMDefinitions.hpp>
#include <XalanDom/XalanNode.hpp>
/*
* <meta name="usage" content="experimental"/>
*
* Base class for the DOM Entity interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanEntity : public XalanNode
{
public:
XalanEntity();
virtual
~XalanEntity();
// These interfaces are inherited from XalanNode...
virtual XalanDOMString
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
virtual XalanDOMString
getNodeValue() const = 0;
/**
* An enum value representing the type of the underlying object.
*/
virtual NodeType
getNodeType() const = 0;
/**
* Gets the parent of this node.
*
* All nodes, except <code>Document</code>,
* <code>DocumentFragment</code>, and <code>Attr</code> 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 <code>null</code> Node
* is returned.
*/
virtual XalanNode*
getParentNode() const = 0;
/**
* Gets a <code>NodeList</code> that contains all children of this node.
*
* If there
* are no children, this is a <code>NodeList</code> containing no nodes.
* The content of the returned <code>NodeList</code> 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 <code>NodeList</code> accessors; it is not a static snapshot of the
* content of the node. This is true for every <code>NodeList</code>,
* including the ones returned by the <code>getElementsByTagName</code>
* method.
*/
virtual const XalanNodeList*
getChildNodes() const = 0;
/**
* Gets the first child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getFirstChild() const = 0;
/**
* Gets the last child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getLastChild() const = 0;
/**
* Gets the node immediately preceding this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getPreviousSibling() const = 0;
/**
* Gets the node immediately following this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getNextSibling() const = 0;
/**
* Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it
* is an <code>Element</code>) or <code>null</code> otherwise.
*/
virtual const XalanNamedNodeMap*
getAttributes() const = 0;
/**
* Gets the <code>Document</code> object associated with this node.
*
* This is also
* the <code>Document</code> object used to create new nodes. When this
* node is a <code>Document</code> or a <code>DocumentType</code>
* which is not used with any <code>Document</code> yet, this is
* <code>null</code>.
*/
virtual XalanDocument*
getOwnerDocument() const = 0;
//@}
/** @name Cloning function. */
//@{
/**
* Returns a duplicate of this node.
*
* This function serves as a generic copy constructor for nodes.
*
* The duplicate node has no parent (
* <code>parentNode</code> returns <code>null</code>.).
* <br>Cloning an <code>Element</code> 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
* <code>Text</code> node. Cloning any other type of node simply returns a
* copy of this node.
* @param deep If <code>true</code>, recursively clone the subtree under the
* specified node; if <code>false</code>, clone only the node itself (and
* its attributes, if it is an <code>Element</code>).
* @return The duplicate node.
*/
virtual XalanNode*
cloneNode(bool deep) const = 0;
//@}
/** @name Functions to modify the DOM Node. */
//@{
/**
* Inserts the node <code>newChild</code> before the existing child node
* <code>refChild</code>.
*
* If <code>refChild</code> is <code>null</code>,
* insert <code>newChild</code> at the end of the list of children.
* <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
* all of its children are inserted, in the same order, before
* <code>refChild</code>. If the <code>newChild</code> is already in the
* tree, it is first removed. Note that a <code>Node</code> 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.
*/
virtual XalanNode*
insertBefore(
XalanNode* newChild,
XalanNode* refChild) = 0;
/**
* Replaces the child node <code>oldChild</code> with <code>newChild</code>
* in the list of children, and returns the <code>oldChild</code> node.
*
* If <CODE>newChild</CODE> is a <CODE>DocumentFragment</CODE> object,
* <CODE>oldChild</CODE> is replaced by all of the <CODE>DocumentFragment</CODE>
* children, which are inserted in the same order.
*
* If the <code>newChild</code> 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.
*/
virtual XalanNode*
replaceChild(
XalanNode* newChild,
XalanNode* oldChild) = 0;
/**
* Removes the child node indicated by <code>oldChild</code> from the list
* of children, and returns it.
*
* @param oldChild The node being removed.
* @return The node removed.
*/
virtual XalanNode*
removeChild(XalanNode* oldChild) = 0;
/**
* Adds the node <code>newChild</code> to the end of the list of children of
* this node.
*
* If the <code>newChild</code> is already in the tree, it is
* first removed.
* @param newChild The node to add.If it is a <code>DocumentFragment</code>
* object, the entire contents of the document fragment are moved into
* the child list of this node
* @return The node added.
*/
virtual XalanNode*
appendChild(XalanNode* newChild) = 0;
//@}
/** @name Query functions. */
//@{
/**
* This is a convenience method to allow easy determination of whether a
* node has any children.
*
* @return <code>true</code> if the node has any children,
* <code>false</code> if the node has no children.
*/
virtual bool
hasChildNodes() const = 0;
//@}
/** @name Set functions. */
//@{
/**
* Sets the value of the node.
*
* Any node which can have a nodeValue (@see getNodeValue) 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.
*/
virtual void
setNodeValue(const XalanDOMString& nodeValue) = 0;
//@}
/** @name Functions introduced in DOM Level 2. */
//@{
/**
* Puts all <CODE>Text</CODE>
* nodes in the full depth of the sub-tree underneath this <CODE>Node</CODE>,
* including attribute nodes, into a "normal" form where only markup (e.g.,
* tags, comments, processing instructions, CDATA sections, and entity
* references) separates <CODE>Text</CODE>
* nodes, i.e., there are no adjacent <CODE>Text</CODE>
* 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.
* <P><B>Note:</B> In cases where the document contains <CODE>CDATASections</CODE>,
* the normalize operation alone may not be sufficient, since XPointers do
* not differentiate between <CODE>Text</CODE>
* nodes and <CODE>CDATASection</CODE> nodes.</P>
*/
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 <code>hasFeature</code> on
* <code>DOMImplementation</code>.
* @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 <code>true</code>.
* @return Returns <code>true</code> if the specified feature is supported
* on this node, <code>false</code> otherwise.
*/
virtual bool
supports(
const XalanDOMString& feature,
const XalanDOMString& version) const = 0;
/**
* Get the <em>namespace URI</em> of
* this node, or <code>null</code> if it is unspecified.
* <p>
* 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.
* <p>
* For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
* <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
virtual XalanDOMString
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
virtual XalanDOMString
getPrefix() const = 0;
/**
* Returns the local part of the <em>qualified name</em> of this node.
* <p>
* For nodes created with a DOM Level 1 method, such as
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
virtual XalanDOMString
getLocalName() const = 0;
/**
* Set the <em>namespace prefix</em> of this node.
* <p>
* Note that setting this attribute, when permitted, changes
* the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified
* name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE>
* attributes of the <CODE>Element</CODE> and <CODE>Attr</CODE>
* interfaces, when applicable.
* <p>
* 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
* <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
*
* @param prefix The prefix of this node.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified prefix contains
* an illegal character.
* <br>
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>
* NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is
* malformed, if the specified prefix is "xml" and the
* <CODE>namespaceURI</CODE> of this node is different from
* "http://www.w3.org/XML/1998/namespace", if specified prefix is
* "xmlns" and the <CODE>namespaceURI</CODE> is neither
* <CODE>null</CODE> nor an empty string, or if the
* <CODE>localName</CODE> is <CODE>null</CODE>.
*/
virtual void
setPrefix(const XalanDOMString& prefix) = 0;
//@}
// These interfaces are new to XalanEntity...
/**
* Get the public identifier of this notation.
*
* If the public identifier was not
* specified, this is <code>null</code>.
* @return Returns the public identifier of the notation
*/
virtual XalanDOMString
getPublicId() const = 0;
/**
* Get the system identifier of this notation.
*
* If the system identifier was not
* specified, this is <code>null</code>.
* @return Returns the system identifier of the notation
*/
virtual XalanDOMString
getSystemId() const = 0;
/**
* For unparsed entities, the name of the notation for the entity.
*
* For parsed entities, this is <code>null</code>.
*/
virtual XalanDOMString
getNotationName() const = 0;
protected:
XalanEntity(const XalanEntity& theSource);
XalanEntity&
operator=(const XalanEntity& theSource);
bool
operator==(const XalanEntity& theRHS) const;
private:
};
#endif // !defined(XALANENTITY_HEADER_GUARD_1357924680)
1.1 xml-xalan/c/src/XalanDOM/XalanEntityReference.cpp
Index: XalanEntityReference.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanEntityReference.hpp"
XalanEntityReference::XalanEntityReference() :
XalanNode()
{
}
XalanEntityReference::~XalanEntityReference()
{
}
XalanEntityReference::XalanEntityReference(const XalanEntityReference& theSource) :
XalanNode(theSource)
{
}
XalanEntityReference&
XalanEntityReference::operator=(const XalanEntityReference& theSource)
{
XalanNode::operator=(theSource);
return *this;
}
bool
XalanEntityReference::operator==(const XalanEntityReference& /* theRHS */) const
{
return false;
}
1.1 xml-xalan/c/src/XalanDOM/XalanEntityReference.hpp
Index: XalanEntityReference.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANENTITYREFERENCE_HEADER_GUARD_1357924680)
#define XALANENTITYREFERENCE_HEADER_GUARD_1357924680
#include <XalanDom/XalanDOMDefinitions.hpp>
#include <XalanDom/XalanNode.hpp>
/*
* <meta name="usage" content="experimental"/>
*
* Base class for the DOM EntityReference interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanEntityReference : public XalanNode
{
public:
XalanEntityReference();
virtual
~XalanEntityReference();
// These interfaces are inherited from XalanNode...
virtual XalanDOMString
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
virtual XalanDOMString
getNodeValue() const = 0;
/**
* An enum value representing the type of the underlying object.
*/
virtual NodeType
getNodeType() const = 0;
/**
* Gets the parent of this node.
*
* All nodes, except <code>Document</code>,
* <code>DocumentFragment</code>, and <code>Attr</code> 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 <code>null</code> Node
* is returned.
*/
virtual XalanNode*
getParentNode() const = 0;
/**
* Gets a <code>NodeList</code> that contains all children of this node.
*
* If there
* are no children, this is a <code>NodeList</code> containing no nodes.
* The content of the returned <code>NodeList</code> 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 <code>NodeList</code> accessors; it is not a static snapshot of the
* content of the node. This is true for every <code>NodeList</code>,
* including the ones returned by the <code>getElementsByTagName</code>
* method.
*/
virtual const XalanNodeList*
getChildNodes() const = 0;
/**
* Gets the first child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getFirstChild() const = 0;
/**
* Gets the last child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getLastChild() const = 0;
/**
* Gets the node immediately preceding this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getPreviousSibling() const = 0;
/**
* Gets the node immediately following this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getNextSibling() const = 0;
/**
* Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it
* is an <code>Element</code>) or <code>null</code> otherwise.
*/
virtual const XalanNamedNodeMap*
getAttributes() const = 0;
/**
* Gets the <code>Document</code> object associated with this node.
*
* This is also
* the <code>Document</code> object used to create new nodes. When this
* node is a <code>Document</code> or a <code>DocumentType</code>
* which is not used with any <code>Document</code> yet, this is
* <code>null</code>.
*/
virtual XalanDocument*
getOwnerDocument() const = 0;
//@}
/** @name Cloning function. */
//@{
/**
* Returns a duplicate of this node.
*
* This function serves as a generic copy constructor for nodes.
*
* The duplicate node has no parent (
* <code>parentNode</code> returns <code>null</code>.).
* <br>Cloning an <code>Element</code> 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
* <code>Text</code> node. Cloning any other type of node simply returns a
* copy of this node.
* @param deep If <code>true</code>, recursively clone the subtree under the
* specified node; if <code>false</code>, clone only the node itself (and
* its attributes, if it is an <code>Element</code>).
* @return The duplicate node.
*/
virtual XalanNode*
cloneNode(bool deep) const = 0;
//@}
/** @name Functions to modify the DOM Node. */
//@{
/**
* Inserts the node <code>newChild</code> before the existing child node
* <code>refChild</code>.
*
* If <code>refChild</code> is <code>null</code>,
* insert <code>newChild</code> at the end of the list of children.
* <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
* all of its children are inserted, in the same order, before
* <code>refChild</code>. If the <code>newChild</code> is already in the
* tree, it is first removed. Note that a <code>Node</code> 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.
*/
virtual XalanNode*
insertBefore(
XalanNode* newChild,
XalanNode* refChild) = 0;
/**
* Replaces the child node <code>oldChild</code> with <code>newChild</code>
* in the list of children, and returns the <code>oldChild</code> node.
*
* If <CODE>newChild</CODE> is a <CODE>DocumentFragment</CODE> object,
* <CODE>oldChild</CODE> is replaced by all of the <CODE>DocumentFragment</CODE>
* children, which are inserted in the same order.
*
* If the <code>newChild</code> 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.
*/
virtual XalanNode*
replaceChild(
XalanNode* newChild,
XalanNode* oldChild) = 0;
/**
* Removes the child node indicated by <code>oldChild</code> from the list
* of children, and returns it.
*
* @param oldChild The node being removed.
* @return The node removed.
*/
virtual XalanNode*
removeChild(XalanNode* oldChild) = 0;
/**
* Adds the node <code>newChild</code> to the end of the list of children of
* this node.
*
* If the <code>newChild</code> is already in the tree, it is
* first removed.
* @param newChild The node to add.If it is a <code>DocumentFragment</code>
* object, the entire contents of the document fragment are moved into
* the child list of this node
* @return The node added.
*/
virtual XalanNode*
appendChild(XalanNode* newChild) = 0;
//@}
/** @name Query functions. */
//@{
/**
* This is a convenience method to allow easy determination of whether a
* node has any children.
*
* @return <code>true</code> if the node has any children,
* <code>false</code> if the node has no children.
*/
virtual bool
hasChildNodes() const = 0;
//@}
/** @name Set functions. */
//@{
/**
* Sets the value of the node.
*
* Any node which can have a nodeValue (@see getNodeValue) 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.
*/
virtual void
setNodeValue(const XalanDOMString& nodeValue) = 0;
//@}
/** @name Functions introduced in DOM Level 2. */
//@{
/**
* Puts all <CODE>Text</CODE>
* nodes in the full depth of the sub-tree underneath this <CODE>Node</CODE>,
* including attribute nodes, into a "normal" form where only markup (e.g.,
* tags, comments, processing instructions, CDATA sections, and entity
* references) separates <CODE>Text</CODE>
* nodes, i.e., there are no adjacent <CODE>Text</CODE>
* 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.
* <P><B>Note:</B> In cases where the document contains <CODE>CDATASections</CODE>,
* the normalize operation alone may not be sufficient, since XPointers do
* not differentiate between <CODE>Text</CODE>
* nodes and <CODE>CDATASection</CODE> nodes.</P>
*/
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 <code>hasFeature</code> on
* <code>DOMImplementation</code>.
* @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 <code>true</code>.
* @return Returns <code>true</code> if the specified feature is supported
* on this node, <code>false</code> otherwise.
*/
virtual bool
supports(
const XalanDOMString& feature,
const XalanDOMString& version) const = 0;
/**
* Get the <em>namespace URI</em> of
* this node, or <code>null</code> if it is unspecified.
* <p>
* 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.
* <p>
* For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
* <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
virtual XalanDOMString
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
virtual XalanDOMString
getPrefix() const = 0;
/**
* Returns the local part of the <em>qualified name</em> of this node.
* <p>
* For nodes created with a DOM Level 1 method, such as
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
virtual XalanDOMString
getLocalName() const = 0;
/**
* Set the <em>namespace prefix</em> of this node.
* <p>
* Note that setting this attribute, when permitted, changes
* the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified
* name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE>
* attributes of the <CODE>Element</CODE> and <CODE>Attr</CODE>
* interfaces, when applicable.
* <p>
* 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
* <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
*
* @param prefix The prefix of this node.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified prefix contains
* an illegal character.
* <br>
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>
* NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is
* malformed, if the specified prefix is "xml" and the
* <CODE>namespaceURI</CODE> of this node is different from
* "http://www.w3.org/XML/1998/namespace", if specified prefix is
* "xmlns" and the <CODE>namespaceURI</CODE> is neither
* <CODE>null</CODE> nor an empty string, or if the
* <CODE>localName</CODE> is <CODE>null</CODE>.
*/
virtual void
setPrefix(const XalanDOMString& prefix) = 0;
//@}
protected:
XalanEntityReference(const XalanEntityReference& theSource);
XalanEntityReference&
operator=(const XalanEntityReference& theSource);
bool
operator==(const XalanEntityReference& theRHS) const;
private:
};
#endif // !defined(XALANENTITYREFERENCE_HEADER_GUARD_1357924680)
1.1 xml-xalan/c/src/XalanDOM/XalanNamedNodeMap.cpp
Index: XalanNamedNodeMap.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanNamedNodeMap.hpp"
XalanNamedNodeMap::XalanNamedNodeMap()
{
}
XalanNamedNodeMap::~XalanNamedNodeMap()
{
}
XalanNamedNodeMap::XalanNamedNodeMap(const XalanNamedNodeMap& /* theSource */)
{
}
XalanNamedNodeMap&
XalanNamedNodeMap::operator=(const XalanNamedNodeMap& /* theSource */)
{
return *this;
}
bool
XalanNamedNodeMap::operator==(const XalanNamedNodeMap& /* theRHS */) const
{
return false;
}
1.1 xml-xalan/c/src/XalanDOM/XalanNamedNodeMap.hpp
Index: XalanNamedNodeMap.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANNAMEDNODEMAP_HEADER_GUARD_1357924680)
#define XALANNAMEDNODEMAP_HEADER_GUARD_1357924680
#include <XalanDom/XalanDOMDefinitions.hpp>
#include <XalanDom/XalanDOMString.hpp>
class XalanNode;
/*
* <meta name="usage" content="experimental"/>
*
* Base class for the DOM NamedNodeMap interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanNamedNodeMap
{
public:
XalanNamedNodeMap();
virtual
~XalanNamedNodeMap();
/** @name Set functions. */
//@{
/**
* Adds a node using its <code>nodeName</code> attribute.
*
* <br>As the <code>nodeName</code> 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 <code>nodeName</code> 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 <code>Node</code> replaces an existing node the
* replaced <code>Node</code> is returned,
* otherwise <code>null</code> is returned.
* @exception DOMException
* WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a
* different document than the one that created the
* <code>NamedNodeMap</code>.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this
* <code>NamedNodeMap</code> is readonly.
* <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an
* <code>Attr</code> that is already an attribute of another
* <code>Element</code> object. The DOM user must explicitly clone
* <code>Attr</code> nodes to re-use them in other elements.
*/
virtual XalanNode*
setNamedItem(XalanNode* arg) = 0;
/**
* Returns the <code>index</code>th item in the map.
*
* If <code>index</code>
* is greater than or equal to the number of nodes in the map, this returns
* <code>null</code>.
* @param index Index into the map.
* @return The node at the <code>index</code>th position in the
* <code>NamedNodeMap</code>, or <code>null</code> if that is not a valid
* index.
*/
virtual XalanNode*
item(unsigned int index) const = 0;
//@}
/** @name Get functions. */
//@{
/**
* Retrieves a node specified by name.
*
* @param name The <code>nodeName</code> of a node to retrieve.
* @return A <code>Node</code> (of any type) with the specified <code>nodeName</code>, or
* <code>null</code> if it does not identify any node in
* the map.
*/
virtual XalanNode*
getNamedItem(const XalanDOMString& name) const = 0;
/**
* The number of nodes in the map.
*
* The range of valid child node indices is
* 0 to <code>length-1</code> inclusive.
*/
virtual unsigned int
getLength() const = 0;
//@}
/** @name Functions to change the node collection. */
//@{
/**
* Removes a node specified by name.
*
* If the removed node is an
* <code>Attr</code> with a default value it is immediately replaced.
* @param name The <code>nodeName</code> of a node to remove.
* @return The node removed from the map or <code>null</code> if no node
* with such a name exists.
* @exception DOMException
* NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in
* the map.
* <br>
* NO_MODIFICATION_ALLOWED_ERR: Raised if this <code>NamedNodeMap</code>
* is readonly.
*/
virtual XalanNode*
removeNamedItem(const XalanDOMString& name) = 0;
//@}
/** @name Functions introduced in DOM Level 2. */
//@{
/**
* Retrieves a node specified by local name and namespace URI.
*
* @param namespaceURI The <em>namespace URI</em> of
* the node to retrieve.
* @param localName The <em>local name</em> of the node to retrieve.
* @return A <code>Node</code> (of any type) with the specified
* local name and namespace URI, or <code>null</code> if they do not
* identify any node in the map.
*/
virtual XalanNode*
getNamedItemNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) const = 0;
/**
* Adds a node using its <CODE>namespaceURI</CODE> and <CODE>localName</CODE>.
* @param arg A node to store in a named node map. The node will later be
* accessible using the value of the <CODE>namespaceURI</CODE> and
* <CODE>localName</CODE> 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 <code>Node</code> replaces an existing node the
* replaced <code>Node</code> is returned,
* otherwise <code>null</code> is returned.
* @exception DOMException
* WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a
* different document than the one that created the
* <code>NamedNodeMap</code>.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this
* <code>NamedNodeMap</code> is readonly.
* <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an
* <code>Attr</code> that is already an attribute of another
* <code>Element</code> object. The DOM user must explicitly clone
* <code>Attr</code> nodes to re-use them in other elements.
*/
virtual XalanNode*
setNamedItemNS(XalanNode* arg) = 0;
/**
* Removes a node specified by local name and namespace URI.
*
* @param namespaceURI The <em>namespace URI</em> of
* the node to remove.
* @param localName The <em>local name</em> of the
* node to remove. When this <code>NamedNodeMap</code> contains the
* attributes attached to an element, as returned by the attributes
* attribute of the <code>Node</code> 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 <code>name</code> in
* the map.
* <br>
* NO_MODIFICATION_ALLOWED_ERR: Raised if this <code>NamedNodeMap</code>
* is readonly.
*/
virtual XalanNode*
removeNamedItemNS(
const XalanDOMString& namespaceURI,
const XalanDOMString& localName) = 0;
//@}
protected:
XalanNamedNodeMap(const XalanNamedNodeMap& theSource);
XalanNamedNodeMap&
operator=(const XalanNamedNodeMap& theSource);
bool
operator==(const XalanNamedNodeMap& theRHS) const;
private:
};
#endif // !defined(XALANNAMEDNODEMAP_HEADER_GUARD_1357924680)
1.1 xml-xalan/c/src/XalanDOM/XalanNode.cpp
Index: XalanNode.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanNode.hpp"
#define XALAN_NODE_SPECIAL_DEBUG
#if !defined(NDEBUG)
unsigned long XalanNode::s_instanceCount = 0;
#if defined(XALAN_NODE_SPECIAL_DEBUG)
#include <iostream>
#include <set>
#if defined(XALAN_NO_NAMESPACES)
typedef set<XalanNode*> InstanceSetType;
#else
typedef std::set<XalanNode*> InstanceSetType;
using std::cerr;
using std::endl;
#endif
static InstanceSetType s_instanceSet;
#endif
#endif
XalanNode::XalanNode()
{
#if !defined(NDEBUG)
s_instanceCount++;
#if defined(XALAN_NODE_SPECIAL_DEBUG)
s_instanceSet.insert(this);
#endif
#endif
}
XalanNode::~XalanNode()
{
#if !defined(NDEBUG)
s_instanceCount--;
#if defined(XALAN_NODE_SPECIAL_DEBUG)
s_instanceSet.erase(this);
#endif
#endif
}
XalanNode::XalanNode(const XalanNode& /* theSource */)
{
#if !defined(NDEBUG)
s_instanceCount++;
#if defined(XALAN_NODE_SPECIAL_DEBUG)
s_instanceSet.insert(this);
#endif
#endif
}
XalanNode&
XalanNode::operator=(const XalanNode& /* theSource */)
{
return *this;
}
bool
XalanNode::operator==(const XalanNode& /* theRHS */) const
{
return false;
}
#if !defined(NDEBUG)
void
XalanNode::getLiveInstances(XalanNode* theNodes[])
{
#if defined(XALAN_NODE_SPECIAL_DEBUG)
InstanceSetType::const_iterator i =
s_instanceSet.begin();
InstanceSetType::const_iterator end =
s_instanceSet.end();
for(size_t j = 0; i != end; ++i, ++j)
{
theNodes[j] = *i;
}
#endif
}
#endif
1.1 xml-xalan/c/src/XalanDOM/XalanNode.hpp
Index: XalanNode.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANNODE_HEADER_GUARD_1357924680)
#define XALANNODE_HEADER_GUARD_1357924680
#include <XalanDom/XalanDOMDefinitions.hpp>
#include <XalanDom/XalanDOMString.hpp>
class XalanDocument;
class XalanNamedNodeMap;
class XalanNodeList;
/*
* <meta name="usage" content="experimental"/>
*
* Base class for the DOM Node interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanNode
{
public:
XalanNode();
virtual
~XalanNode();
enum NodeType
{
UNKNOWN_NODE = 0,
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
};
virtual XalanDOMString
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
virtual XalanDOMString
getNodeValue() const = 0;
/**
* An enum value representing the type of the underlying object.
*/
virtual NodeType
getNodeType() const = 0;
/**
* Gets the parent of this node.
*
* All nodes, except <code>Document</code>,
* <code>DocumentFragment</code>, and <code>Attr</code> 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 <code>null</code> Node
* is returned.
*/
virtual XalanNode*
getParentNode() const = 0;
/**
* Gets a <code>NodeList</code> that contains all children of this node.
*
* If there
* are no children, this is a <code>NodeList</code> containing no nodes.
* The content of the returned <code>NodeList</code> 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 <code>NodeList</code> accessors; it is not a static snapshot of the
* content of the node. This is true for every <code>NodeList</code>,
* including the ones returned by the <code>getElementsByTagName</code>
* method.
*/
virtual const XalanNodeList*
getChildNodes() const = 0;
/**
* Gets the first child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getFirstChild() const = 0;
/**
* Gets the last child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getLastChild() const = 0;
/**
* Gets the node immediately preceding this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getPreviousSibling() const = 0;
/**
* Gets the node immediately following this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getNextSibling() const = 0;
/**
* Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it
* is an <code>Element</code>) or <code>null</code> otherwise.
*/
virtual const XalanNamedNodeMap*
getAttributes() const = 0;
/**
* Gets the <code>Document</code> object associated with this node.
*
* This is also
* the <code>Document</code> object used to create new nodes. When this
* node is a <code>Document</code> or a <code>DocumentType</code>
* which is not used with any <code>Document</code> yet, this is
* <code>null</code>.
*/
virtual XalanDocument*
getOwnerDocument() const = 0;
//@}
/** @name Cloning function. */
//@{
/**
* Returns a duplicate of this node.
*
* This function serves as a generic copy constructor for nodes.
*
* The duplicate node has no parent (
* <code>parentNode</code> returns <code>null</code>.).
* <br>Cloning an <code>Element</code> 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
* <code>Text</code> node. Cloning any other type of node simply returns a
* copy of this node.
* @param deep If <code>true</code>, recursively clone the subtree under the
* specified node; if <code>false</code>, clone only the node itself (and
* its attributes, if it is an <code>Element</code>).
* @return The duplicate node.
*/
virtual XalanNode*
cloneNode(bool deep) const = 0;
//@}
/** @name Functions to modify the DOM Node. */
//@{
/**
* Inserts the node <code>newChild</code> before the existing child node
* <code>refChild</code>.
*
* If <code>refChild</code> is <code>null</code>,
* insert <code>newChild</code> at the end of the list of children.
* <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
* all of its children are inserted, in the same order, before
* <code>refChild</code>. If the <code>newChild</code> is already in the
* tree, it is first removed. Note that a <code>Node</code> 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.
*/
virtual XalanNode*
insertBefore(
XalanNode* newChild,
XalanNode* refChild) = 0;
/**
* Replaces the child node <code>oldChild</code> with <code>newChild</code>
* in the list of children, and returns the <code>oldChild</code> node.
*
* If <CODE>newChild</CODE> is a <CODE>DocumentFragment</CODE> object,
* <CODE>oldChild</CODE> is replaced by all of the <CODE>DocumentFragment</CODE>
* children, which are inserted in the same order.
*
* If the <code>newChild</code> 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.
*/
virtual XalanNode*
replaceChild(
XalanNode* newChild,
XalanNode* oldChild) = 0;
/**
* Removes the child node indicated by <code>oldChild</code> from the list
* of children, and returns it.
*
* @param oldChild The node being removed.
* @return The node removed.
*/
virtual XalanNode*
removeChild(XalanNode* oldChild) = 0;
/**
* Adds the node <code>newChild</code> to the end of the list of children of
* this node.
*
* If the <code>newChild</code> is already in the tree, it is
* first removed.
* @param newChild The node to add.If it is a <code>DocumentFragment</code>
* object, the entire contents of the document fragment are moved into
* the child list of this node
* @return The node added.
*/
virtual XalanNode*
appendChild(XalanNode* newChild) = 0;
//@}
/** @name Query functions. */
//@{
/**
* This is a convenience method to allow easy determination of whether a
* node has any children.
*
* @return <code>true</code> if the node has any children,
* <code>false</code> if the node has no children.
*/
virtual bool
hasChildNodes() const = 0;
//@}
/** @name Set functions. */
//@{
/**
* Sets the value of the node.
*
* Any node which can have a nodeValue (@see getNodeValue) 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.
*/
virtual void
setNodeValue(const XalanDOMString& nodeValue) = 0;
//@}
/** @name Functions introduced in DOM Level 2. */
//@{
/**
* Puts all <CODE>Text</CODE>
* nodes in the full depth of the sub-tree underneath this <CODE>Node</CODE>,
* including attribute nodes, into a "normal" form where only markup (e.g.,
* tags, comments, processing instructions, CDATA sections, and entity
* references) separates <CODE>Text</CODE>
* nodes, i.e., there are no adjacent <CODE>Text</CODE>
* 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.
* <P><B>Note:</B> In cases where the document contains <CODE>CDATASections</CODE>,
* the normalize operation alone may not be sufficient, since XPointers do
* not differentiate between <CODE>Text</CODE>
* nodes and <CODE>CDATASection</CODE> nodes.</P>
*/
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 <code>hasFeature</code> on
* <code>DOMImplementation</code>.
* @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 <code>true</code>.
* @return Returns <code>true</code> if the specified feature is supported
* on this node, <code>false</code> otherwise.
*/
virtual bool
supports(
const XalanDOMString& feature,
const XalanDOMString& version) const = 0;
/**
* Get the <em>namespace URI</em> of
* this node, or <code>null</code> if it is unspecified.
* <p>
* 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.
* <p>
* For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
* <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
virtual XalanDOMString
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
virtual XalanDOMString
getPrefix() const = 0;
/**
* Returns the local part of the <em>qualified name</em> of this node.
* <p>
* For nodes created with a DOM Level 1 method, such as
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
virtual XalanDOMString
getLocalName() const = 0;
/**
* Set the <em>namespace prefix</em> of this node.
* <p>
* Note that setting this attribute, when permitted, changes
* the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified
* name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE>
* attributes of the <CODE>Element</CODE> and <CODE>Attr</CODE>
* interfaces, when applicable.
* <p>
* 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
* <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
*
* @param prefix The prefix of this node.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified prefix contains
* an illegal character.
* <br>
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>
* NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is
* malformed, if the specified prefix is "xml" and the
* <CODE>namespaceURI</CODE> of this node is different from
* "http://www.w3.org/XML/1998/namespace", if specified prefix is
* "xmlns" and the <CODE>namespaceURI</CODE> is neither
* <CODE>null</CODE> nor an empty string, or if the
* <CODE>localName</CODE> is <CODE>null</CODE>.
*/
virtual void
setPrefix(const XalanDOMString& prefix) = 0;
//@}
#if !defined(NDEBUG)
/**
* Get the number of live instances.
* @return the number of live instances.
*/
static unsigned long
getInstanceCount()
{
return s_instanceCount;
}
/**
* File an array with pointers to all of the
* live instances. This function is only
* available if XALAN_NODE_SPECIAL_DEBUG is
* defined. Otherwise this function does
* nothing.
*
* @param An array in which to store the pointers.
*/
static void
getLiveInstances(XalanNode* theNodes[]);
#endif
protected:
XalanNode(const XalanNode& theSource);
XalanNode&
operator=(const XalanNode& theSource);
bool
operator==(const XalanNode& theRHS) const;
private:
#if !defined(NDEBUG)
static unsigned long s_instanceCount;
#endif
};
#endif // !defined(XALANNODE_HEADER_GUARD_1357924680)
1.1 xml-xalan/c/src/XalanDOM/XalanNodeList.cpp
Index: XalanNodeList.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanNodeList.hpp"
XalanNodeList::XalanNodeList()
{
}
XalanNodeList::~XalanNodeList()
{
}
XalanNodeList::XalanNodeList(const XalanNodeList& /* theSource */)
{
}
XalanNodeList&
XalanNodeList::operator=(const XalanNodeList& /* theSource */)
{
return *this;
}
bool
XalanNodeList::operator==(const XalanNodeList& /* theRHS */) const
{
return false;
}
1.1 xml-xalan/c/src/XalanDOM/XalanNodeList.hpp
Index: XalanNodeList.hpp
===================================================================
#if !defined(XALANNODELIST)
#define XALANNODELIST
#include "XalanDOMDefinitions.hpp"
class XalanNode;
/*
* <meta name="usage" content="experimental"/>
*
* Base class for the DOM NodeList interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanNodeList
{
public:
XalanNodeList();
virtual
~XalanNodeList();
/** @name Get functions. */
//@{
/**
* Returns the <code>index</code>th item in the collection.
*
* If <code>index</code> is greater than or equal to the number of nodes in
* the list, this returns <code>null</code>.
*
* @param index Index into the collection.
* @return The node at the <code>index</code>th position in the
* <code>NodeList</code>, or <code>null</code> if that is not a valid
* index.
*/
virtual XalanNode*
item(unsigned int index) const = 0;
/**
* Returns the number of nodes in the list.
*
* The range of valid child node indices is 0 to <code>length-1</code> inclusive.
*/
virtual unsigned int
getLength() const = 0;
protected:
XalanNodeList(const XalanNodeList& theSource);
XalanNodeList&
operator=(const XalanNodeList& theSource);
bool
operator==(const XalanNodeList& theRHS) const;
private:
};
#endif
1.1 xml-xalan/c/src/XalanDOM/XalanNodeListSurrogate.cpp
Index: XalanNodeListSurrogate.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanNodeListSurrogate.hpp"
#include "XalanNode.hpp"
XalanNodeListSurrogate::XalanNodeListSurrogate(const XalanNode& theNode) :
m_node(&theNode)
{
}
XalanNodeListSurrogate::XalanNodeListSurrogate(const XalanNodeListSurrogate& theSource) :
m_node(theSource.m_node)
{
}
XalanNodeListSurrogate::~XalanNodeListSurrogate()
{
}
XalanNode*
XalanNodeListSurrogate::item(unsigned int index) const
{
XalanNode* theCurrentChild = m_node->getFirstChild();
for(unsigned int i = 0; i < index && theCurrentChild != 0; ++i)
{
theCurrentChild = theCurrentChild->getNextSibling();
}
return theCurrentChild;
}
unsigned int
XalanNodeListSurrogate::getLength() const
{
unsigned int theLength = 0;
XalanNode* theCurrentChild = m_node->getFirstChild();
while(theCurrentChild != 0)
{
++theLength;
theCurrentChild = theCurrentChild->getNextSibling();
}
return theLength;
}
1.1 xml-xalan/c/src/XalanDOM/XalanNodeListSurrogate.hpp
Index: XalanNodeListSurrogate.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANNODELISTSURROGATE_HEADER_GUARD_1357924680)
#define XALANNODELISTSURROGATE_HEADER_GUARD_1357924680
#include <XalanDom/XalanDOMDefinitions.hpp>
#include <XalanDom/XalanNodeList.hpp>
class XalanNode;
/*
* <meta name="usage" content="experimental"/>
*
* Helper class for implementing the DOM NodeList interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanNodeListSurrogate : public XalanNodeList
{
public:
XalanNodeListSurrogate(const XalanNode& theNode);
XalanNodeListSurrogate(const XalanNodeListSurrogate& theSource);
virtual
~XalanNodeListSurrogate();
XalanNodeListSurrogate&
operator=(const XalanNodeListSurrogate& theSource)
{
m_node = theSource.m_node;
XalanNodeList::operator=(theSource);
return *this;
}
bool
operator==(const XalanNodeListSurrogate& theRHS) const
{
return m_node == theRHS.m_node ? true : false;
}
virtual XalanNode*
item(unsigned int index) const;
virtual unsigned int
getLength() const;
private:
const XalanNode* m_node;
};
#endif // !defined(XALANNODELISTSURROGATE_HEADER_GUARD_1357924680)
1.1 xml-xalan/c/src/XalanDOM/XalanNotation.cpp
Index: XalanNotation.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanNotation.hpp"
XalanNotation::XalanNotation() :
XalanNode()
{
}
XalanNotation::~XalanNotation()
{
}
XalanNotation::XalanNotation(const XalanNotation& theSource) :
XalanNode(theSource)
{
}
XalanNotation&
XalanNotation::operator=(const XalanNotation& theSource)
{
XalanNode::operator=(theSource);
return *this;
}
bool
XalanNotation::operator==(const XalanNotation& /* theRHS */) const
{
return false;
}
1.1 xml-xalan/c/src/XalanDOM/XalanNotation.hpp
Index: XalanNotation.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANNOTATION_HEADER_GUARD_1357924680)
#define XALANNOTATION_HEADER_GUARD_1357924680
#include <XalanDom/XalanDOMDefinitions.hpp>
#include <XalanDom/XalanNode.hpp>
/*
* <meta name="usage" content="experimental"/>
*
* Base class for the DOM Notation interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanNotation : public XalanNode
{
public:
XalanNotation();
virtual
~XalanNotation();
// These interfaces are inherited from XalanNode...
virtual XalanDOMString
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
virtual XalanDOMString
getNodeValue() const = 0;
/**
* An enum value representing the type of the underlying object.
*/
virtual NodeType
getNodeType() const = 0;
/**
* Gets the parent of this node.
*
* All nodes, except <code>Document</code>,
* <code>DocumentFragment</code>, and <code>Attr</code> 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 <code>null</code> Node
* is returned.
*/
virtual XalanNode*
getParentNode() const = 0;
/**
* Gets a <code>NodeList</code> that contains all children of this node.
*
* If there
* are no children, this is a <code>NodeList</code> containing no nodes.
* The content of the returned <code>NodeList</code> 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 <code>NodeList</code> accessors; it is not a static snapshot of the
* content of the node. This is true for every <code>NodeList</code>,
* including the ones returned by the <code>getElementsByTagName</code>
* method.
*/
virtual const XalanNodeList*
getChildNodes() const = 0;
/**
* Gets the first child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getFirstChild() const = 0;
/**
* Gets the last child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getLastChild() const = 0;
/**
* Gets the node immediately preceding this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getPreviousSibling() const = 0;
/**
* Gets the node immediately following this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getNextSibling() const = 0;
/**
* Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it
* is an <code>Element</code>) or <code>null</code> otherwise.
*/
virtual const XalanNamedNodeMap*
getAttributes() const = 0;
/**
* Gets the <code>Document</code> object associated with this node.
*
* This is also
* the <code>Document</code> object used to create new nodes. When this
* node is a <code>Document</code> or a <code>DocumentType</code>
* which is not used with any <code>Document</code> yet, this is
* <code>null</code>.
*/
virtual XalanDocument*
getOwnerDocument() const = 0;
//@}
/** @name Cloning function. */
//@{
/**
* Returns a duplicate of this node.
*
* This function serves as a generic copy constructor for nodes.
*
* The duplicate node has no parent (
* <code>parentNode</code> returns <code>null</code>.).
* <br>Cloning an <code>Element</code> 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
* <code>Text</code> node. Cloning any other type of node simply returns a
* copy of this node.
* @param deep If <code>true</code>, recursively clone the subtree under the
* specified node; if <code>false</code>, clone only the node itself (and
* its attributes, if it is an <code>Element</code>).
* @return The duplicate node.
*/
virtual XalanNode*
cloneNode(bool deep) const = 0;
//@}
/** @name Functions to modify the DOM Node. */
//@{
/**
* Inserts the node <code>newChild</code> before the existing child node
* <code>refChild</code>.
*
* If <code>refChild</code> is <code>null</code>,
* insert <code>newChild</code> at the end of the list of children.
* <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
* all of its children are inserted, in the same order, before
* <code>refChild</code>. If the <code>newChild</code> is already in the
* tree, it is first removed. Note that a <code>Node</code> 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.
*/
virtual XalanNode*
insertBefore(
XalanNode* newChild,
XalanNode* refChild) = 0;
/**
* Replaces the child node <code>oldChild</code> with <code>newChild</code>
* in the list of children, and returns the <code>oldChild</code> node.
*
* If <CODE>newChild</CODE> is a <CODE>DocumentFragment</CODE> object,
* <CODE>oldChild</CODE> is replaced by all of the <CODE>DocumentFragment</CODE>
* children, which are inserted in the same order.
*
* If the <code>newChild</code> 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.
*/
virtual XalanNode*
replaceChild(
XalanNode* newChild,
XalanNode* oldChild) = 0;
/**
* Removes the child node indicated by <code>oldChild</code> from the list
* of children, and returns it.
*
* @param oldChild The node being removed.
* @return The node removed.
*/
virtual XalanNode*
removeChild(XalanNode* oldChild) = 0;
/**
* Adds the node <code>newChild</code> to the end of the list of children of
* this node.
*
* If the <code>newChild</code> is already in the tree, it is
* first removed.
* @param newChild The node to add.If it is a <code>DocumentFragment</code>
* object, the entire contents of the document fragment are moved into
* the child list of this node
* @return The node added.
*/
virtual XalanNode*
appendChild(XalanNode* newChild) = 0;
//@}
/** @name Query functions. */
//@{
/**
* This is a convenience method to allow easy determination of whether a
* node has any children.
*
* @return <code>true</code> if the node has any children,
* <code>false</code> if the node has no children.
*/
virtual bool
hasChildNodes() const = 0;
//@}
/** @name Set functions. */
//@{
/**
* Sets the value of the node.
*
* Any node which can have a nodeValue (@see getNodeValue) 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.
*/
virtual void
setNodeValue(const XalanDOMString& nodeValue) = 0;
//@}
/** @name Functions introduced in DOM Level 2. */
//@{
/**
* Puts all <CODE>Text</CODE>
* nodes in the full depth of the sub-tree underneath this <CODE>Node</CODE>,
* including attribute nodes, into a "normal" form where only markup (e.g.,
* tags, comments, processing instructions, CDATA sections, and entity
* references) separates <CODE>Text</CODE>
* nodes, i.e., there are no adjacent <CODE>Text</CODE>
* 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.
* <P><B>Note:</B> In cases where the document contains <CODE>CDATASections</CODE>,
* the normalize operation alone may not be sufficient, since XPointers do
* not differentiate between <CODE>Text</CODE>
* nodes and <CODE>CDATASection</CODE> nodes.</P>
*/
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 <code>hasFeature</code> on
* <code>DOMImplementation</code>.
* @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 <code>true</code>.
* @return Returns <code>true</code> if the specified feature is supported
* on this node, <code>false</code> otherwise.
*/
virtual bool
supports(
const XalanDOMString& feature,
const XalanDOMString& version) const = 0;
/**
* Get the <em>namespace URI</em> of
* this node, or <code>null</code> if it is unspecified.
* <p>
* 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.
* <p>
* For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
* <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
virtual XalanDOMString
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
virtual XalanDOMString
getPrefix() const = 0;
/**
* Returns the local part of the <em>qualified name</em> of this node.
* <p>
* For nodes created with a DOM Level 1 method, such as
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
virtual XalanDOMString
getLocalName() const = 0;
/**
* Set the <em>namespace prefix</em> of this node.
* <p>
* Note that setting this attribute, when permitted, changes
* the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified
* name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE>
* attributes of the <CODE>Element</CODE> and <CODE>Attr</CODE>
* interfaces, when applicable.
* <p>
* 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
* <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
*
* @param prefix The prefix of this node.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified prefix contains
* an illegal character.
* <br>
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>
* NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is
* malformed, if the specified prefix is "xml" and the
* <CODE>namespaceURI</CODE> of this node is different from
* "http://www.w3.org/XML/1998/namespace", if specified prefix is
* "xmlns" and the <CODE>namespaceURI</CODE> is neither
* <CODE>null</CODE> nor an empty string, or if the
* <CODE>localName</CODE> is <CODE>null</CODE>.
*/
virtual void
setPrefix(const XalanDOMString& prefix) = 0;
//@}
// These interfaces are new to XalanNotation...
/**
* Get the public identifier of this notation.
*
* If the public identifier was not
* specified, this is <code>null</code>.
* @return Returns the public identifier of the notation
*/
virtual XalanDOMString
getPublicId() const = 0;
/**
* Get the system identifier of this notation.
*
* If the system identifier was not
* specified, this is <code>null</code>.
* @return Returns the system identifier of the notation
*/
virtual XalanDOMString
getSystemId() const = 0;
protected:
XalanNotation(const XalanNotation& theSource);
XalanNotation&
operator=(const XalanNotation& theSource);
bool
operator==(const XalanNotation& theRHS) const;
private:
};
#endif // !defined(XALANNOTATION_HEADER_GUARD_1357924680)
1.1 xml-xalan/c/src/XalanDOM/XalanProcessingInstruction.cpp
Index: XalanProcessingInstruction.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanProcessingInstruction.hpp"
XalanProcessingInstruction::XalanProcessingInstruction() :
XalanNode()
{
}
XalanProcessingInstruction::~XalanProcessingInstruction()
{
}
XalanProcessingInstruction::XalanProcessingInstruction(const XalanProcessingInstruction& theSource) :
XalanNode(theSource)
{
}
XalanProcessingInstruction&
XalanProcessingInstruction::operator=(const XalanProcessingInstruction& theSource)
{
XalanNode::operator=(theSource);
return *this;
}
bool
XalanProcessingInstruction::operator==(const XalanProcessingInstruction& /* theRHS */) const
{
return false;
}
1.1 xml-xalan/c/src/XalanDOM/XalanProcessingInstruction.hpp
Index: XalanProcessingInstruction.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANPROCESSINGINSTRUCTION_HEADER_GUARD_1357924680)
#define XALANPROCESSINGINSTRUCTION_HEADER_GUARD_1357924680
#include <XalanDom/XalanDOMDefinitions.hpp>
#include <XalanDom/XalanNode.hpp>
/*
* <meta name="usage" content="experimental"/>
*
* Base class for the DOM ProcessingInstruction interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanProcessingInstruction : public XalanNode
{
public:
XalanProcessingInstruction();
virtual
~XalanProcessingInstruction();
// These interfaces are inherited from XalanNode...
virtual XalanDOMString
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
virtual XalanDOMString
getNodeValue() const = 0;
/**
* An enum value representing the type of the underlying object.
*/
virtual NodeType
getNodeType() const = 0;
/**
* Gets the parent of this node.
*
* All nodes, except <code>Document</code>,
* <code>DocumentFragment</code>, and <code>Attr</code> 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 <code>null</code> Node
* is returned.
*/
virtual XalanNode*
getParentNode() const = 0;
/**
* Gets a <code>NodeList</code> that contains all children of this node.
*
* If there
* are no children, this is a <code>NodeList</code> containing no nodes.
* The content of the returned <code>NodeList</code> 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 <code>NodeList</code> accessors; it is not a static snapshot of the
* content of the node. This is true for every <code>NodeList</code>,
* including the ones returned by the <code>getElementsByTagName</code>
* method.
*/
virtual const XalanNodeList*
getChildNodes() const = 0;
/**
* Gets the first child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getFirstChild() const = 0;
/**
* Gets the last child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getLastChild() const = 0;
/**
* Gets the node immediately preceding this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getPreviousSibling() const = 0;
/**
* Gets the node immediately following this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getNextSibling() const = 0;
/**
* Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it
* is an <code>Element</code>) or <code>null</code> otherwise.
*/
virtual const XalanNamedNodeMap*
getAttributes() const = 0;
/**
* Gets the <code>Document</code> object associated with this node.
*
* This is also
* the <code>Document</code> object used to create new nodes. When this
* node is a <code>Document</code> or a <code>DocumentType</code>
* which is not used with any <code>Document</code> yet, this is
* <code>null</code>.
*/
virtual XalanDocument*
getOwnerDocument() const = 0;
//@}
/** @name Cloning function. */
//@{
/**
* Returns a duplicate of this node.
*
* This function serves as a generic copy constructor for nodes.
*
* The duplicate node has no parent (
* <code>parentNode</code> returns <code>null</code>.).
* <br>Cloning an <code>Element</code> 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
* <code>Text</code> node. Cloning any other type of node simply returns a
* copy of this node.
* @param deep If <code>true</code>, recursively clone the subtree under the
* specified node; if <code>false</code>, clone only the node itself (and
* its attributes, if it is an <code>Element</code>).
* @return The duplicate node.
*/
virtual XalanNode*
cloneNode(bool deep) const = 0;
//@}
/** @name Functions to modify the DOM Node. */
//@{
/**
* Inserts the node <code>newChild</code> before the existing child node
* <code>refChild</code>.
*
* If <code>refChild</code> is <code>null</code>,
* insert <code>newChild</code> at the end of the list of children.
* <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
* all of its children are inserted, in the same order, before
* <code>refChild</code>. If the <code>newChild</code> is already in the
* tree, it is first removed. Note that a <code>Node</code> 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.
*/
virtual XalanNode*
insertBefore(
XalanNode* newChild,
XalanNode* refChild) = 0;
/**
* Replaces the child node <code>oldChild</code> with <code>newChild</code>
* in the list of children, and returns the <code>oldChild</code> node.
*
* If <CODE>newChild</CODE> is a <CODE>DocumentFragment</CODE> object,
* <CODE>oldChild</CODE> is replaced by all of the <CODE>DocumentFragment</CODE>
* children, which are inserted in the same order.
*
* If the <code>newChild</code> 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.
*/
virtual XalanNode*
replaceChild(
XalanNode* newChild,
XalanNode* oldChild) = 0;
/**
* Removes the child node indicated by <code>oldChild</code> from the list
* of children, and returns it.
*
* @param oldChild The node being removed.
* @return The node removed.
*/
virtual XalanNode*
removeChild(XalanNode* oldChild) = 0;
/**
* Adds the node <code>newChild</code> to the end of the list of children of
* this node.
*
* If the <code>newChild</code> is already in the tree, it is
* first removed.
* @param newChild The node to add.If it is a <code>DocumentFragment</code>
* object, the entire contents of the document fragment are moved into
* the child list of this node
* @return The node added.
*/
virtual XalanNode*
appendChild(XalanNode* newChild) = 0;
//@}
/** @name Query functions. */
//@{
/**
* This is a convenience method to allow easy determination of whether a
* node has any children.
*
* @return <code>true</code> if the node has any children,
* <code>false</code> if the node has no children.
*/
virtual bool
hasChildNodes() const = 0;
//@}
/** @name Set functions. */
//@{
/**
* Sets the value of the node.
*
* Any node which can have a nodeValue (@see getNodeValue) 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.
*/
virtual void
setNodeValue(const XalanDOMString& nodeValue) = 0;
//@}
/** @name Functions introduced in DOM Level 2. */
//@{
/**
* Puts all <CODE>Text</CODE>
* nodes in the full depth of the sub-tree underneath this <CODE>Node</CODE>,
* including attribute nodes, into a "normal" form where only markup (e.g.,
* tags, comments, processing instructions, CDATA sections, and entity
* references) separates <CODE>Text</CODE>
* nodes, i.e., there are no adjacent <CODE>Text</CODE>
* 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.
* <P><B>Note:</B> In cases where the document contains <CODE>CDATASections</CODE>,
* the normalize operation alone may not be sufficient, since XPointers do
* not differentiate between <CODE>Text</CODE>
* nodes and <CODE>CDATASection</CODE> nodes.</P>
*/
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 <code>hasFeature</code> on
* <code>DOMImplementation</code>.
* @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 <code>true</code>.
* @return Returns <code>true</code> if the specified feature is supported
* on this node, <code>false</code> otherwise.
*/
virtual bool
supports(
const XalanDOMString& feature,
const XalanDOMString& version) const = 0;
/**
* Get the <em>namespace URI</em> of
* this node, or <code>null</code> if it is unspecified.
* <p>
* 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.
* <p>
* For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
* <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
virtual XalanDOMString
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
virtual XalanDOMString
getPrefix() const = 0;
/**
* Returns the local part of the <em>qualified name</em> of this node.
* <p>
* For nodes created with a DOM Level 1 method, such as
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
virtual XalanDOMString
getLocalName() const = 0;
/**
* Set the <em>namespace prefix</em> of this node.
* <p>
* Note that setting this attribute, when permitted, changes
* the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified
* name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE>
* attributes of the <CODE>Element</CODE> and <CODE>Attr</CODE>
* interfaces, when applicable.
* <p>
* 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
* <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
*
* @param prefix The prefix of this node.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified prefix contains
* an illegal character.
* <br>
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>
* NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is
* malformed, if the specified prefix is "xml" and the
* <CODE>namespaceURI</CODE> of this node is different from
* "http://www.w3.org/XML/1998/namespace", if specified prefix is
* "xmlns" and the <CODE>namespaceURI</CODE> is neither
* <CODE>null</CODE> nor an empty string, or if the
* <CODE>localName</CODE> is <CODE>null</CODE>.
*/
virtual void
setPrefix(const XalanDOMString& prefix) = 0;
//@}
// These interfaces are new to XalanProcessingInstruction...
//@}
/** @name Get functions. */
//@{
/**
* The target of this processing instruction.
*
* XML defines this as being the
* first token following the markup that begins the processing instruction.
*/
virtual XalanDOMString
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 <code>?></code>.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
*/
virtual XalanDOMString
getData() const = 0;
//@}
/** @name Set functions. */
//@{
/**
* 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 <code>?></code>.
* @param data The string containing the processing instruction
*/
virtual void
setData(const XalanDOMString& data) = 0;
//@}
protected:
XalanProcessingInstruction(const XalanProcessingInstruction& theSource);
XalanProcessingInstruction&
operator=(const XalanProcessingInstruction& theSource);
bool
operator==(const XalanProcessingInstruction& theRHS) const;
private:
};
#endif // !defined(XALANPROCESSINGINSTRUCTION_HEADER_GUARD_1357924680)
1.1 xml-xalan/c/src/XalanDOM/XalanText.cpp
Index: XalanText.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanText.hpp"
XalanText::XalanText() :
XalanCharacterData()
{
}
XalanText::~XalanText()
{
}
XalanText::XalanText(const XalanText& theSource) :
XalanCharacterData(theSource)
{
}
XalanText&
XalanText::operator=(const XalanText& theSource)
{
XalanCharacterData::operator=(theSource);
return *this;
}
bool
XalanText::operator==(const XalanText& /* theRHS */) const
{
return false;
}
1.1 xml-xalan/c/src/XalanDOM/XalanText.hpp
Index: XalanText.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(XALANTEXT_HEADER_GUARD_1357924680)
#define XALANTEXT_HEADER_GUARD_1357924680
#include <XalanDom/XalanDOMDefinitions.hpp>
#include <XalanDom/XalanCharacterData.hpp>
/*
* <meta name="usage" content="experimental"/>
*
* Base class for the DOM Text interface.
*
* This class is experimental and subject to change!!
*/
class XALAN_DOM_EXPORT XalanText : public XalanCharacterData
{
public:
XalanText();
virtual
~XalanText();
// These interfaces are inherited from XalanNode...
virtual XalanDOMString
getNodeName() const = 0;
/**
* Gets the value of this node, depending on its type.
*/
virtual XalanDOMString
getNodeValue() const = 0;
/**
* An enum value representing the type of the underlying object.
*/
virtual NodeType
getNodeType() const = 0;
/**
* Gets the parent of this node.
*
* All nodes, except <code>Document</code>,
* <code>DocumentFragment</code>, and <code>Attr</code> 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 <code>null</code> Node
* is returned.
*/
virtual XalanNode*
getParentNode() const = 0;
/**
* Gets a <code>NodeList</code> that contains all children of this node.
*
* If there
* are no children, this is a <code>NodeList</code> containing no nodes.
* The content of the returned <code>NodeList</code> 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 <code>NodeList</code> accessors; it is not a static snapshot of the
* content of the node. This is true for every <code>NodeList</code>,
* including the ones returned by the <code>getElementsByTagName</code>
* method.
*/
virtual const XalanNodeList*
getChildNodes() const = 0;
/**
* Gets the first child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getFirstChild() const = 0;
/**
* Gets the last child of this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getLastChild() const = 0;
/**
* Gets the node immediately preceding this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getPreviousSibling() const = 0;
/**
* Gets the node immediately following this node.
*
* If there is no such node, this returns <code>null</code>.
*/
virtual XalanNode*
getNextSibling() const = 0;
/**
* Gets a <code>NamedNodeMap</code> containing the attributes of this node (if it
* is an <code>Element</code>) or <code>null</code> otherwise.
*/
virtual const XalanNamedNodeMap*
getAttributes() const = 0;
/**
* Gets the <code>Document</code> object associated with this node.
*
* This is also
* the <code>Document</code> object used to create new nodes. When this
* node is a <code>Document</code> or a <code>DocumentType</code>
* which is not used with any <code>Document</code> yet, this is
* <code>null</code>.
*/
virtual XalanDocument*
getOwnerDocument() const = 0;
//@}
/** @name Cloning function. */
//@{
/**
* Returns a duplicate of this node.
*
* This function serves as a generic copy constructor for nodes.
*
* The duplicate node has no parent (
* <code>parentNode</code> returns <code>null</code>.).
* <br>Cloning an <code>Element</code> 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
* <code>Text</code> node. Cloning any other type of node simply returns a
* copy of this node.
* @param deep If <code>true</code>, recursively clone the subtree under the
* specified node; if <code>false</code>, clone only the node itself (and
* its attributes, if it is an <code>Element</code>).
* @return The duplicate node.
*/
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual XalanNode*
#else
virtual XalanText*
#endif
cloneNode(bool deep) const = 0;
//@}
/** @name Functions to modify the DOM Node. */
//@{
/**
* Inserts the node <code>newChild</code> before the existing child node
* <code>refChild</code>.
*
* If <code>refChild</code> is <code>null</code>,
* insert <code>newChild</code> at the end of the list of children.
* <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
* all of its children are inserted, in the same order, before
* <code>refChild</code>. If the <code>newChild</code> is already in the
* tree, it is first removed. Note that a <code>Node</code> 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.
*/
virtual XalanNode*
insertBefore(
XalanNode* newChild,
XalanNode* refChild) = 0;
/**
* Replaces the child node <code>oldChild</code> with <code>newChild</code>
* in the list of children, and returns the <code>oldChild</code> node.
*
* If <CODE>newChild</CODE> is a <CODE>DocumentFragment</CODE> object,
* <CODE>oldChild</CODE> is replaced by all of the <CODE>DocumentFragment</CODE>
* children, which are inserted in the same order.
*
* If the <code>newChild</code> 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.
*/
virtual XalanNode*
replaceChild(
XalanNode* newChild,
XalanNode* oldChild) = 0;
/**
* Removes the child node indicated by <code>oldChild</code> from the list
* of children, and returns it.
*
* @param oldChild The node being removed.
* @return The node removed.
*/
virtual XalanNode*
removeChild(XalanNode* oldChild) = 0;
/**
* Adds the node <code>newChild</code> to the end of the list of children of
* this node.
*
* If the <code>newChild</code> is already in the tree, it is
* first removed.
* @param newChild The node to add.If it is a <code>DocumentFragment</code>
* object, the entire contents of the document fragment are moved into
* the child list of this node
* @return The node added.
*/
virtual XalanNode*
appendChild(XalanNode* newChild) = 0;
//@}
/** @name Query functions. */
//@{
/**
* This is a convenience method to allow easy determination of whether a
* node has any children.
*
* @return <code>true</code> if the node has any children,
* <code>false</code> if the node has no children.
*/
virtual bool
hasChildNodes() const = 0;
//@}
/** @name Set functions. */
//@{
/**
* Sets the value of the node.
*
* Any node which can have a nodeValue (@see getNodeValue) 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.
*/
virtual void
setNodeValue(const XalanDOMString& nodeValue) = 0;
//@}
/** @name Functions introduced in DOM Level 2. */
//@{
/**
* Puts all <CODE>Text</CODE>
* nodes in the full depth of the sub-tree underneath this <CODE>Node</CODE>,
* including attribute nodes, into a "normal" form where only markup (e.g.,
* tags, comments, processing instructions, CDATA sections, and entity
* references) separates <CODE>Text</CODE>
* nodes, i.e., there are no adjacent <CODE>Text</CODE>
* 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.
* <P><B>Note:</B> In cases where the document contains <CODE>CDATASections</CODE>,
* the normalize operation alone may not be sufficient, since XPointers do
* not differentiate between <CODE>Text</CODE>
* nodes and <CODE>CDATASection</CODE> nodes.</P>
*/
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 <code>hasFeature</code> on
* <code>DOMImplementation</code>.
* @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 <code>true</code>.
* @return Returns <code>true</code> if the specified feature is supported
* on this node, <code>false</code> otherwise.
*/
virtual bool
supports(
const XalanDOMString& feature,
const XalanDOMString& version) const = 0;
/**
* Get the <em>namespace URI</em> of
* this node, or <code>null</code> if it is unspecified.
* <p>
* 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.
* <p>
* For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and
* <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 method,
* such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
* interface, this is always <CODE>null</CODE>.
*/
virtual XalanDOMString
getNamespaceURI() const = 0;
/**
* Get the <em>namespace prefix</em>
* of this node, or <code>null</code> if it is unspecified.
*/
virtual XalanDOMString
getPrefix() const = 0;
/**
* Returns the local part of the <em>qualified name</em> of this node.
* <p>
* For nodes created with a DOM Level 1 method, such as
* <code>createElement</code> from the <code>Document</code> interface,
* it is null.
*/
virtual XalanDOMString
getLocalName() const = 0;
/**
* Set the <em>namespace prefix</em> of this node.
* <p>
* Note that setting this attribute, when permitted, changes
* the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified
* name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE>
* attributes of the <CODE>Element</CODE> and <CODE>Attr</CODE>
* interfaces, when applicable.
* <p>
* 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
* <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
*
* @param prefix The prefix of this node.
* @exception DOMException
* INVALID_CHARACTER_ERR: Raised if the specified prefix contains
* an illegal character.
* <br>
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
* <br>
* NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is
* malformed, if the specified prefix is "xml" and the
* <CODE>namespaceURI</CODE> of this node is different from
* "http://www.w3.org/XML/1998/namespace", if specified prefix is
* "xmlns" and the <CODE>namespaceURI</CODE> is neither
* <CODE>null</CODE> nor an empty string, or if the
* <CODE>localName</CODE> is <CODE>null</CODE>.
*/
virtual void
setPrefix(const XalanDOMString& prefix) = 0;
//@}
// These interfaces are inherited from XalanCharacterData...
/** @name Getter functions. */
//@{
/**
* 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 <code>CharacterData</code> node. However,
* implementation limits may mean that the entirety of a node's data may
* not fit into a single <code>XalanDOMString</code>. In such cases, the user
* may call <code>substringData</code> to retrieve the data in
* appropriately sized pieces.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
* @exception DOMException
* DOMSTRING_SIZE_ERR: Raised when it would return more characters than
* fit in a <code>XalanDOMString</code> variable on the implementation
* platform.
*/
virtual XalanDOMString
getData() const = 0;
/**
* Returns the number of characters that are available through <code>data</code> and
* the <code>substringData</code> method below.
*
* This may have the value
* zero, i.e., <code>CharacterData</code> nodes may be empty.
*/
virtual unsigned int
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 <code>offset</code> and
* <code>count</code> exceeds the <code>length</code>, 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 <code>data</code>, or if the
* specified <code>count</code> is negative.
* <br>DOMSTRING_SIZE_ERR: Raised if the specified range of text does not
* fit into a <code>XalanDOMString</code>.
*/
virtual XalanDOMString
substringData(
unsigned int offset,
unsigned int count) const = 0;
//@}
/** @name Functions that set or change data. */
//@{
/**
* Append the string to the end of the character data of the node.
*
* Upon success, <code>data</code> provides access to the concatenation of
* <code>data</code> and the <code>XalanDOMString</code> specified.
* @param arg The <code>XalanDOMString</code> to append.
* @exception DOMException
* NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
appendData(const XalanDOMString& arg) = 0;
/**
* Insert a string at the specified character offset.
*
* @param offset The character offset at which to insert.
* @param arg The <code>XalanDOMString</code> to insert.
* @exception DOMException
* INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
* than the number of characters in <code>data</code>.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
insertData(
unsigned int offset,
const XalanDOMString& arg) = 0;
/**
* Remove a range of characters from the node.
*
* Upon success,
* <code>data</code> and <code>length</code> reflect the change.
* @param offset The offset from which to remove characters.
* @param count The number of characters to delete. If the sum of
* <code>offset</code> and <code>count</code> exceeds <code>length</code>
* then all characters from <code>offset</code> 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 <code>data</code>, or if the
* specified <code>count</code> is negative.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
deleteData(
unsigned int offset,
unsigned int 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
* <code>offset</code> and <code>count</code> exceeds <code>length</code>
* , then all characters to the end of the data are replaced (i.e., the
* effect is the same as a <code>remove</code> method call with the same
* range, followed by an <code>append</code> method invocation).
* @param arg The <code>XalanDOMString</code> 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 <code>data</code>, or if the
* specified <code>count</code> is negative.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual void
replaceData(
unsigned int offset,
unsigned int count,
const XalanDOMString& arg) = 0;
//@}
// These interfaces are new to XalanText...
//@}
/** @name Functions to modify the Text node. */
//@{
/**
* Breaks this node into two nodes at the specified
* offset, keeping both in the tree as siblings.
*
* This node then only
* contains all the content up to the <code>offset</code> point. And a new
* node of the same nodeType, which is inserted as the next sibling of this
* node, contains all the content at and after the <code>offset</code>
* point. When the <code>offset</code> is equal to the lenght of this node,
* the new node has no data.
* @param offset The offset at which to split, starting from 0.
* @return The new <code>Text</code> node.
* @exception DOMException
* INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
* than the number of characters in <code>data</code>.
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
virtual XalanText*
splitText(unsigned int offset) = 0;
//@}
protected:
XalanText(const XalanText& theSource);
XalanText&
operator=(const XalanText& theSource);
bool
operator==(const XalanText& theRHS) const;
private:
};
#endif // !defined(XALANTEXT_HEADER_GUARD_1357924680)