Package org.nuxeo.common.xmap
Class DOMHelper
- java.lang.Object
-
- org.nuxeo.common.xmap.DOMHelper
-
public final class DOMHelper extends Object
- Author:
- Bogdan Stefanescu
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
DOMHelper.NodeMapVisitor
static interface
DOMHelper.NodeVisitor
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 Detail
-
getNodeValue
public static String getNodeValue(Element base, Path path)
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
public static Node getElementNode(Node base, String name)
Gets the first child element node having the given name.
-
getElementNode
public static Node getElementNode(Node base, Path path)
-
loadFragment
public static void loadFragment(Element el, String fragment)
Parses a string containing XML and returns a DocumentFragment containing the nodes of the parsed XML.
-
-