summaryrefslogtreecommitdiffstats
path: root/forms/qa/org
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-10-01 12:28:29 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-10-01 12:28:29 +0000
commitc2d2e4261ed52ffec5a06f63ca5b135961ac4722 (patch)
treecdeab0daa3d3160a977db2aa07d957dd55844b9e /forms/qa/org
parentCWS-TOOLING: integrate CWS sb93 (diff)
downloadcore-c2d2e4261ed52ffec5a06f63ca5b135961ac4722.tar.gz
core-c2d2e4261ed52ffec5a06f63ca5b135961ac4722.zip
CWS-TOOLING: integrate CWS dba31b
Diffstat (limited to 'forms/qa/org')
-rw-r--r--forms/qa/org/openoffice/xforms/Instance.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/forms/qa/org/openoffice/xforms/Instance.java b/forms/qa/org/openoffice/xforms/Instance.java
index d068560c5da1..5e4e04741995 100644
--- a/forms/qa/org/openoffice/xforms/Instance.java
+++ b/forms/qa/org/openoffice/xforms/Instance.java
@@ -8,6 +8,8 @@ package org.openoffice.xforms;
import com.sun.star.xml.dom.DOMException;
import com.sun.star.xml.dom.XDocument;
import com.sun.star.xml.dom.XNode;
+import com.sun.star.xml.dom.XNodeList;
+import java.util.NoSuchElementException;
/**
*
@@ -97,6 +99,38 @@ public class Instance
return node;
}
+ /** removes a child of the root-level node from the instance
+ *
+ * @param _elementName
+ * the name of the to-be-removed child
+ */
+ public XNode removeNode( String _elementName ) throws DOMException
+ {
+ return removeNode( m_domInstance, _elementName );
+ }
+
+ /** removes a node from the instance
+ *
+ * @param _parentElement
+ * the node whose child is to be removed
+ * @param _elementName
+ * the name of the to-be-removed child
+ */
+ public XNode removeNode( XNode _parentElement, String _elementName ) throws DOMException
+ {
+ XNodeList nodes = _parentElement.getChildNodes();
+ for ( int i=0; i<nodes.getLength(); ++i )
+ {
+ XNode node = nodes.item(i);
+ if ( node.getLocalName().equals( _elementName ) )
+ {
+ _parentElement.removeChild( node );
+ return node;
+ }
+ }
+ throw new NoSuchElementException();
+ }
+
/** creates an attribute for the root node of the instance
*
* @param _attribName