null
if there is no such script.
*
@@ -287,31 +176,6 @@
}
/**
- * Convert an XML fragment from one namespace to another.
- */
- private static Element translateXML(Element from, String namespace) {
- Element to = from.getOwnerDocument().createElementNS(namespace, from.getLocalName());
- NodeList nl = from.getChildNodes();
- int length = nl.getLength();
- for (int i = 0; i < length; i++) {
- Node node = nl.item(i);
- Node newNode;
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- newNode = translateXML((Element) node, namespace);
- } else {
- newNode = node.cloneNode(true);
- }
- to.appendChild(newNode);
- }
- NamedNodeMap m = from.getAttributes();
- for (int i = 0; i < m.getLength(); i++) {
- Node attr = m.item(i);
- to.setAttribute(attr.getNodeName(), attr.getNodeValue());
- }
- return to;
- }
-
- /**
* Namespace of data used in {@link #getPrimaryConfigurationData} and {@link #putPrimaryConfigurationData}.
* @since org.netbeans.modules.ant.freeform/1 1.15
*/
@@ -332,7 +196,7 @@
if (data != null) {
return data;
} else {
- return translateXML(helper.getPrimaryConfigurationData(true), NAMESPACE);
+ return XMLUtil.translateXML(helper.getPrimaryConfigurationData(true), NAMESPACE);
}
}
});
@@ -353,7 +217,7 @@
}
ProjectManager.mutex().writeAccess(new Mutex.ActionXMLUtil
. Seven new methods added.+ Refactored XML related methods into XMLUtil. +
+order
. All existing child elements must be
+ * include as well as the new element. The existing child element following
+ * the new child is important, as the element will be 'inserted before', not
+ * 'inserted after'.
+ *
+ * @param parent parent to which the child will be appended
+ * @param el element to be added
+ * @param order order of the elements which must be followed
+ * @throws IllegalArgumentException if the order cannot be followed, either
+ * a missing existing or new child element is not specifed in order
+ *
+ * @since 8.4
+ */
+ public static void appendChildElement(Element parent, Element el, String[] order) throws IllegalArgumentException {
+ List l = Arrays.asList(order);
+ int index = l.indexOf(el.getLocalName());
+
+ // ensure the new new element is contained in the 'order'
+ if (index == -1) {
+ throw new IllegalArgumentException("new child element '"+ el.getLocalName() + "' not specified in order " + l); // NOI18N
+ }
+
+ Listnull
namespace will match any namespace.
+ *
+ * Apples | " + + "Bananas | " + + "
Apples | " + + "Bananas | " + + "
Apples | \n" + + "Bananas | \n" + + "