axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Veithen (JIRA)" <>
Subject [jira] [Updated] (AXIS-2507) org.apache.axis.message.Text needs cloneNode-implementation OR org.apache.axis.message.MessageElement.getElementsNS needs to be fixed
Date Wed, 03 Oct 2012 17:08:07 GMT


Andreas Veithen updated AXIS-2507:

    Labels: dom-compatibility  (was: )
> org.apache.axis.message.Text needs cloneNode-implementation OR org.apache.axis.message.MessageElement.getElementsNS
needs to be fixed
> -------------------------------------------------------------------------------------------------------------------------------------
>                 Key: AXIS-2507
>                 URL:
>             Project: Axis
>          Issue Type: Bug
>          Components: Basic Architecture
>    Affects Versions: 1.4
>            Reporter: Ulrich K├╝ster
>              Labels: dom-compatibility
> When you clone a Node using cloneNode(true) and later invoke getElementsByTagNameNS a
class cast exception is thrown in getElementNS.
> The reason for this is that getElementNS casts to Element if the object under inspection
is not an instance of Text. However, org.apache.axis.message.Text does not override NodeImpl.cloneNode(boolean
deep). Thus, when I cloned my Node all Text nodes got replaced by NodeImpl nodes as the NodeImpl.cloneNode
method was called (and this method returns instances of type NodeImpl).
> Thus my clone contained nodes which were neither of type Element nore of type Text but
of type NodeImpl. Thus the class cast exception in getElementNS (which assumes a node is of
type Element if it's not of type Text).
> I suggest so resolve this issue by implementing cloneNode in Text in a similar fashion
it is implemented in NodeImpl:
>     /**
>      * Returns a duplicate of this node, i.e., serves as a generic copy
>      * constructor for nodes. The duplicate node has no parent; (
>      * <code>parentNode</code> is <code>null</code>.).
>      * <br>Cloning an <code>Element</code> copies all attributes and
>      * 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 an <code>Attribute</code>
>      * directly, as opposed to be cloned as part of an <code>Element</code>
>      * cloning operation, returns a specified attribute (
>      * <code>specified</code> is <code>true</code>). Cloning
any other type
>      * of node simply returns a copy of this node.
>      * <br>Note that cloning an immutable subtree results in a mutable copy,
>      * but the children of an <code>EntityReference</code> clone are readonly
>      * . In addition, clones of unspecified <code>Attr</code> nodes are
>      * specified. And, cloning <code>Document</code>,
>      * <code>DocumentType</code>, <code>Entity</code>, and
>      * <code>Notation</code> nodes is implementation dependent.
>      * 
>      * @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.
>      */
>     public Node cloneNode(boolean deep) {
>         return new Text(textRep);
>     }

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message