[Jsxe-cvs] SF.net SVN: jsxe: [1237] branches/jsxe2/src/net/sourceforge/jsxe/dom/ AdapterNode.java
Status: Inactive
Brought to you by:
ian_lewis
From: <ian...@us...> - 2006-09-06 19:13:29
|
Revision: 1237 http://svn.sourceforge.net/jsxe/?rev=1237&view=rev Author: ian_lewis Date: 2006-09-06 12:13:21 -0700 (Wed, 06 Sep 2006) Log Message: ----------- Updated AdapterNode to use the dom3 renameNode method Modified Paths: -------------- branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java Modified: branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java =================================================================== --- branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java 2006-09-05 15:55:49 UTC (rev 1236) +++ branches/jsxe2/src/net/sourceforge/jsxe/dom/AdapterNode.java 2006-09-06 19:13:21 UTC (rev 1237) @@ -1100,9 +1100,7 @@ * should only be called on an element node. */ private void renameElementNode(String prefix, String localName) throws DOMException { - //get the nodes needed - Node parent = m_domNode.getParentNode(); - NodeList children = m_domNode.getChildNodes(); + Document document = m_domNode.getOwnerDocument(); //replace the changed node; maintain the namespace URI; @@ -1113,23 +1111,7 @@ String nsURI = lookupNamespaceURI(prefix);; - Element newNode = document.createElementNS(nsURI, qualifiedName); - NamedNodeMap attrs = m_domNode.getAttributes(); - int attrlength = attrs.getLength(); - - for(int i = 0; i < attrlength; i++) { - Node attr = attrs.item(i); - newNode.setAttributeNS(attr.getNamespaceURI(), attr.getNodeName(), attr.getNodeValue()); - } - - int length = children.getLength(); - for (int i = 0; i < length; i++ ) { - Node child = children.item(0); - m_domNode.removeChild(child); - newNode.appendChild(child); - } - parent.replaceChild(newNode, m_domNode); - m_domNode = newNode; + m_domNode = document.renameNode(m_domNode, nsURI, qualifiedName); }//}}} //{{{ renamePINode() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |