Package org.nuxeo.common.xmap
Class DOMHelper
java.lang.Object
org.nuxeo.common.xmap.DOMHelper
- Author:
- Bogdan Stefanescu
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
-
Method Summary
Modifier and TypeMethodDescriptionstatic Node
getElementNode
(Node base, String name) Gets the first child element node having the given name.static Node
getElementNode
(Node base, Path path) static String
getNodeValue
(Element base, Path path) Gets the value of the node at the given path relative to the given base element.static void
loadFragment
(Element el, String fragment) Parses a string containing XML and returns a DocumentFragment containing the nodes of the parsed XML.static void
visitAttributes
(Context ctx, XAnnotatedList xam, Node base, String name, String attrName, DOMHelper.NodeVisitor visitor, Collection<Object> result) static void
visitElements
(Context ctx, XAnnotatedList xam, Node base, String name, DOMHelper.NodeVisitor visitor, Collection<Object> result) static void
visitMapAttributes
(Context ctx, XAnnotatedMap xam, Node base, String name, String attrName, DOMHelper.NodeMapVisitor visitor, Map<String, Object> result) static void
visitMapElements
(Context ctx, XAnnotatedMap xam, Node base, String name, DOMHelper.NodeMapVisitor visitor, Map<String, Object> result) static void
visitMapNodes
(Context ctx, XAnnotatedMap xam, Element base, Path path, DOMHelper.NodeMapVisitor visitor, Map<String, Object> result) 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.
-
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.
-