| java.lang.Object org.openharmonise.commons.xml.XMLUtils
XMLUtils | public class XMLUtils (Code) | | Class containing utility methods for processing XML Documents.
author: Matthew Large version: $Revision: 1.2 $ |
Method Summary | |
public static void | copyChildren(Element parent_destination, Element parent_source, Document doc_destination) Copies all children from one element to another which may be owned by a
different Document. | public static void | copyChildren(Element parent_destination, Element parent_source, Document doc_destination, Vector ignoreTags) Copies all children from one element to another which may be owned by a
different Document. | public static Node | copyNode(Node originalNode, Document parent_destination) Method to deep copy a node from one document to another. | public static File | fixXMLFileEntities(File file) Properly encodes entity references in a XML file in case they have
been previously decoded. | public static String | getChildTextValue(Element el) Returns the string value of the text node directly beneath an element. | public static List | getChildrenByName(Element propEl, String sName) Method to get the element children matching a given name. | public static Document | getDocumentFromString(String sVal) | public static String | getElementName(Element el) Returns the element name for the specifed Element , i.e. | public static Element | getFirstElementChild(Element el) Method to get the first child element, useful as the DOM getFirstChild
method is not restricted to Element nodes. | public static Element | getFirstNamedChild(Element el, String sName) Method to get the first child matching a given name. | public static Node | getFirstNamedChild(Node node, String sName) Method to get the first child matching a given name. |
copyChildren | public static void copyChildren(Element parent_destination, Element parent_source, Document doc_destination)(Code) | | Copies all children from one element to another which may be owned by a
different Document.
Parameters: parent_destination - Destination element to copy children to Parameters: parent_source - Source element to copy children from Parameters: doc_destination - Destination document |
copyChildren | public static void copyChildren(Element parent_destination, Element parent_source, Document doc_destination, Vector ignoreTags)(Code) | | Copies all children from one element to another which may be owned by a
different Document.
Parameters: parent_destination - Destination element to copy children to Parameters: parent_source - Source element to copy children from Parameters: doc_destination - Destination document Parameters: ignoreTags - Element names not to copy |
copyNode | public static Node copyNode(Node originalNode, Document parent_destination)(Code) | | Method to deep copy a node from one document to another.
Parameters: originalNode - Node to copy Parameters: parent_destination - Destination document Copy of original node, owned by parent_destination Document |
fixXMLFileEntities | public static File fixXMLFileEntities(File file)(Code) | | Properly encodes entity references in a XML file in case they have
been previously decoded.
Parameters: file - File to fix Fixed file |
getChildTextValue | public static String getChildTextValue(Element el)(Code) | | Returns the string value of the text node directly beneath an element.
Parameters: el - Element from which to get the text value The text value from this element |
getChildrenByName | public static List getChildrenByName(Element propEl, String sName)(Code) | | Method to get the element children matching a given name. Useful as the
DOM getElementsByTagName uses the descendent axis rather than the child
axis.
Parameters: propEl - Element to check for children Parameters: sName - Name of child to check for Child matching name, or null if not found |
getElementName | public static String getElementName(Element el)(Code) | | Returns the element name for the specifed Element , i.e.
the local name in the case of namespaced element and the tag name
in the case of a non-namespaced element.
Parameters: el - the element the name of the specified element |
getFirstElementChild | public static Element getFirstElementChild(Element el)(Code) | | Method to get the first child element, useful as the DOM getFirstChild
method is not restricted to Element nodes.
Parameters: el - Element to get child from First child element, or null if not found |
getFirstNamedChild | public static Element getFirstNamedChild(Element el, String sName)(Code) | | Method to get the first child matching a given name. Useful as the
DOM getElementsByTagName uses the descendent axis rather than the child
axis.
Parameters: el - Element to check for child Parameters: sName - Name of child to check for First child element matching the given name, or null if not found |
getFirstNamedChild | public static Node getFirstNamedChild(Node node, String sName)(Code) | | Method to get the first child matching a given name. Useful as the
DOM getElementsByTagName uses the descendent axis rather than the child
axis.
Parameters: node - Node to check for child Parameters: sName - Name of child to check for First child node matching the given name, or null if not found |
|
|