@Immutable public final class MicroUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static IMicroNode |
append(IMicroNode aSrcNode,
Object aChild) |
static IMicroNode |
convertToMicroNode(Node aNode) |
static IMicroContainer |
getAllChildrenAsContainer(IMicroNode aParent)
Create a micro container with all children of the passed node.
|
static IMicroContainer |
getAllOriginalChildrenAsContainer(IMicroNode aParent)
Create a micro container with all children of the passed node.
|
static String |
getChildTextContent(IMicroElement eParentElement,
String sChildElementName)
Helper method to extract the text content of the child element denoted by
the parameter sChildElementName of the passed parent element.
|
static String |
getChildTextContent(IMicroElement eParentElement,
String sNamespaceURI,
String sChildElementName)
Helper method to extract the text content of the child element denoted by
the parameters sNamespaceURI and sChildElementName of the passed parent
element.
|
static String |
getChildTextContentTrimmed(IMicroElement eParentElement,
String sChildElementName)
Helper method to extract the text content of the child element denoted by
the parameter sChildElementName of the passed parent element.
|
static String |
getChildTextContentTrimmed(IMicroElement eParentElement,
String sNamespaceURI,
String sChildElementName)
Helper method to extract the text content of the child element denoted by
the parameters sNamespaceURI and sChildElementName of the passed parent
element.
|
static <DSTTYPE> DSTTYPE |
getChildTextContentWithConversion(IMicroElement eParentElement,
String sChildElementName,
Class<DSTTYPE> aDstClass)
Helper method to extract the text content of the child element denoted by
the parameter sChildElementName of the passed parent element.
|
static <DSTTYPE> DSTTYPE |
getChildTextContentWithConversion(IMicroElement eParentElement,
String sNamespaceURI,
String sChildElementName,
Class<DSTTYPE> aDstClass)
Helper method to extract the text content of the child element denoted by
the parameters sNamespaceURI and sChildElementName of the passed parent
element.
|
static String |
getDocumentRootElementTagName(IMicroDocument aDoc)
Get the tag name of the passed documents root element.
|
static String |
getPath(IMicroNode aNode,
String sSep)
Get the path of the given node, up to the root element.
|
@Nonnull public static IMicroNode append(@Nonnull IMicroNode aSrcNode, @Nullable Object aChild)
@Nonnull public static String getPath(@Nullable IMicroNode aNode, @Nonnull String sSep)
aNode - The node to get the path from. May be null.sSep - The separator to be put between each level. For XPath e.g. use "/"null string. If the passed node is
null, the return value is an empty string.@Nullable public static String getDocumentRootElementTagName(@Nullable IMicroDocument aDoc)
aDoc - The document to be evaluated. May be null.null if the passed document was null or
if no document element is present. The tag name otherwise.@Nonnull public static IMicroNode convertToMicroNode(@Nonnull Node aNode)
@Nullable public static String getChildTextContent(@Nonnull IMicroElement eParentElement, @Nonnull String sChildElementName)
eParentElement - The parent element to use. May not be null.sChildElementName - The name of the child element who's text content is to be extracted.null if the child element does not exist or the child
element does not contain any text.@Nullable public static String getChildTextContentTrimmed(@Nonnull IMicroElement eParentElement, @Nonnull String sChildElementName)
eParentElement - The parent element to use. May not be null.sChildElementName - The name of the child element who's text content is to be extracted.null if the child element does not exist or the child
element does not contain any text.@Nullable public static <DSTTYPE> DSTTYPE getChildTextContentWithConversion(@Nonnull IMicroElement eParentElement, @Nonnull String sChildElementName, @Nonnull Class<DSTTYPE> aDstClass)
TypeConverter to the desired
destination type.eParentElement - The parent element to use. May not be null.sChildElementName - The name of the child element who's text content is to be extracted.aDstClass - The destination class. May not be null.null if the child element does not exist or the child
element does not contain any text.@Nullable public static String getChildTextContent(@Nonnull IMicroElement eParentElement, @Nonnull String sNamespaceURI, @Nonnull String sChildElementName)
eParentElement - The parent element to use. May not be null.sNamespaceURI - The expected namespace URI of the element.sChildElementName - The name of the child element who's text content is to be extracted.null if the child element does not exist or the child
element does not contain any text.@Nullable public static String getChildTextContentTrimmed(@Nonnull IMicroElement eParentElement, @Nonnull String sNamespaceURI, @Nonnull String sChildElementName)
eParentElement - The parent element to use. May not be null.sNamespaceURI - The expected namespace URI of the element.sChildElementName - The name of the child element who's text content is to be extracted.null if the child element does not exist or the child
element does not contain any text.@Nullable public static <DSTTYPE> DSTTYPE getChildTextContentWithConversion(@Nonnull IMicroElement eParentElement, @Nonnull String sNamespaceURI, @Nonnull String sChildElementName, @Nonnull Class<DSTTYPE> aDstClass)
TypeConverter to the desired
destination type.eParentElement - The parent element to use. May not be null.sNamespaceURI - The expected namespace URI of the element.sChildElementName - The name of the child element who's text content is to be extracted.aDstClass - The destination class. May not be null.null if the child element does not exist or the child
element does not contain any text.@Nonnull @ReturnsMutableCopy public static IMicroContainer getAllChildrenAsContainer(@Nonnull IMicroNode aParent)
aParent - The parent node to get the children from. May not be
null.null but maybe empty.@Nonnull @ReturnsMutableCopy public static IMicroContainer getAllOriginalChildrenAsContainer(@Nonnull IMicroNode aParent)
aParent - The parent node to get the children from. May not be
null.null but maybe empty.Copyright © 2006–2014 phloc systems. All rights reserved.