/** * write the descriptor class to a DOM tree and return it * * @param parent node in the DOM tree * @param nodeName name for the root element for this DOM tree fragment * @param descriptor the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, T descriptor) { Node node = appendChild(parent, nodeName); return node; }
/** * write the descriptor class to a DOM tree and return it * * @param parent node in the DOM tree * @param nodeName name for the root element for this DOM tree fragment * @param descriptor the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, T descriptor) { Node node = appendChild(parent, nodeName); return node; }
/** * <p> * Append a new text child * </p> * @param parent for the new child element * @param elementName is the new element tag name * @param text the text for the new element * @result the newly create child node */ public static Node appendTextChild(Node parent, String elementName, String text) { if (text == null || text.length()==0) return null; Node child = appendChild(parent, elementName); child.appendChild(getOwnerDocument(child).createTextNode(text)); return child; }
/** * <p> * Append a new text child even if text is empty * </p> * @param parent for the new child element * @param elementName is the new element tag name * @param text the text for the new element * @result the newly create child node */ public static Node forceAppendTextChild(Node parent, String elementName, String text) { Node child = appendChild(parent, elementName); if (text != null && text.length()!=0) { child.appendChild(getOwnerDocument(child).createTextNode(text)); } return child; }
/** * <p> * Append a new text child even if text is empty * </p> * @param parent for the new child element * @param elementName is the new element tag name * @param text the text for the new element * @result the newly create child node */ public static Node forceAppendTextChild(Node parent, String elementName, String text) { Node child = appendChild(parent, elementName); if (text != null && text.length()!=0) { child.appendChild(getOwnerDocument(child).createTextNode(text)); } return child; }
/** * <p> * Append a new text child * </p> * @param parent for the new child element * @param elementName is the new element tag name * @param text the text for the new element * @result the newly create child node */ public static Node appendTextChild(Node parent, String elementName, String text) { if (text == null || text.length()==0) return null; Node child = appendChild(parent, elementName); child.appendChild(getOwnerDocument(child).createTextNode(text)); return child; }
/** * <p> * Append a new element child to the current node * </p> * @param parentNode is the parent node for the new child element * @param elementName is new element tag name * @return the newly created child node */ public Element appendChildNS(Node parent, String elementName, Descriptor descriptor) { if (elementName.indexOf(':')!=-1) { String prefix = elementName.substring(0, elementName.indexOf(':')); elementName = elementName.substring(elementName.indexOf(':')+1); String namespace = getNamespaceFor(descriptor, parent, prefix); Element child = getOwnerDocument(parent).createElementNS(namespace, elementName); child.setPrefix(prefix); parent.appendChild(child); return child; } return super.appendChild(parent, elementName); }
/** * write the descriptor class to a DOM tree and return it * * @param parent node in the DOM tree * @param node name for the root element of this xml fragment * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, Properties descriptor) { Node propertiesNode = super.appendChild(parent, nodeName); for (Enumeration keys = descriptor.propertyNames(); keys.hasMoreElements();) { Node aProperty = this.appendChild(propertiesNode, RuntimeTagNames.PROPERTY); String key = (String) keys.nextElement(); appendTextChild(aProperty, TagNames.NAME_VALUE_PAIR_NAME, key); appendTextChild(aProperty, TagNames.NAME_VALUE_PAIR_VALUE, descriptor.getProperty(key)); } return propertiesNode; } }
/** * write the descriptor class to a DOM tree and return it * * @param parent node in the DOM tree * @param node name for the root element of this xml fragment * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, Properties descriptor) { Node propertiesNode = super.appendChild(parent, nodeName); for (Enumeration keys = descriptor.propertyNames(); keys.hasMoreElements();) { Node aProperty = this.appendChild(propertiesNode, RuntimeTagNames.PROPERTY); String key = (String) keys.nextElement(); appendTextChild(aProperty, TagNames.NAME_VALUE_PAIR_NAME, key); appendTextChild(aProperty, TagNames.NAME_VALUE_PAIR_VALUE, descriptor.getProperty(key)); } return propertiesNode; } }