Package org.nuxeo.common.xmap
Class DOMHelper
java.lang.Object
org.nuxeo.common.xmap.DOMHelper
- Author:
- Bogdan Stefanescu
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interface -
Method Summary
Modifier and TypeMethodDescriptionstatic NodegetElementNode(Node base, String name) Gets the first child element node having the given name.static NodegetElementNode(Node base, Path path) static StringgetNodeValue(Element base, Path path) Gets the value of the node at the given path relative to the given base element.static voidloadFragment(Element el, String fragment) Parses a string containing XML and returns a DocumentFragment containing the nodes of the parsed XML.static voidvisitAttributes(Context ctx, XAnnotatedList xam, Node base, String name, String attrName, DOMHelper.NodeVisitor visitor, Collection<Object> result) static voidvisitElements(Context ctx, XAnnotatedList xam, Node base, String name, DOMHelper.NodeVisitor visitor, Collection<Object> result) static voidvisitMapAttributes(Context ctx, XAnnotatedMap xam, Node base, String name, String attrName, DOMHelper.NodeMapVisitor visitor, Map<String, Object> result) static voidvisitMapElements(Context ctx, XAnnotatedMap xam, Node base, String name, DOMHelper.NodeMapVisitor visitor, Map<String, Object> result) static voidvisitMapNodes(Context ctx, XAnnotatedMap xam, Element base, Path path, DOMHelper.NodeMapVisitor visitor, Map<String, Object> result) static voidvisitNodes(Context ctx, XAnnotatedList xam, Element base, Path path, DOMHelper.NodeVisitor visitor, Collection<Object> result) Visits the nodes selected by the given path using the given visitor.
-
Method Details
-
getNodeValue
Gets the value of the node at the given path relative to the given base element.For element nodes the value is the text content and for the attributes node the attribute value.
- Returns:
- the node value or null if no such node was found
-
visitNodes
public static void visitNodes(Context ctx, XAnnotatedList xam, Element base, Path path, DOMHelper.NodeVisitor visitor, Collection<Object> result) Visits the nodes selected by the given path using the given visitor. -
visitAttributes
public static void visitAttributes(Context ctx, XAnnotatedList xam, Node base, String name, String attrName, DOMHelper.NodeVisitor visitor, Collection<Object> result) -
visitElements
public static void visitElements(Context ctx, XAnnotatedList xam, Node base, String name, DOMHelper.NodeVisitor visitor, Collection<Object> result) -
visitMapNodes
public static void visitMapNodes(Context ctx, XAnnotatedMap xam, Element base, Path path, DOMHelper.NodeMapVisitor visitor, Map<String, Object> result) -
visitMapAttributes
public static void visitMapAttributes(Context ctx, XAnnotatedMap xam, Node base, String name, String attrName, DOMHelper.NodeMapVisitor visitor, Map<String, Object> result) -
visitMapElements
public static void visitMapElements(Context ctx, XAnnotatedMap xam, Node base, String name, DOMHelper.NodeMapVisitor visitor, Map<String, Object> result) -
getElementNode
Gets the first child element node having the given name. -
getElementNode
-
loadFragment
Parses a string containing XML and returns a DocumentFragment containing the nodes of the parsed XML.
-