Package com.helger.xml.microdom
Interface IMicroElement
- All Superinterfaces:
com.helger.commons.lang.ICloneable<IMicroNode>,com.helger.commons.hierarchy.IHasChildren<IMicroNode>,com.helger.commons.hierarchy.IHasChildrenRecursive<IMicroNode>,com.helger.commons.hierarchy.IHasChildrenSorted<IMicroNode>,com.helger.commons.hierarchy.IHasParent<IMicroNode>,IMicroAttributeContainer<IMicroElement>,IMicroNode,IMicroNodeWithChildren
- All Known Implementing Classes:
MicroElement
public interface IMicroElement
extends IMicroNodeWithChildren, IMicroAttributeContainer<IMicroElement>
Represents a single element (=tag) of a document.
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsAnyChildElement(Predicate<? super IMicroElement> aFilter) Check if this element has at least one direct child element that matches the provided filter.static Predicate<? super IMicroElement>filterName(String sTagOrLocalName) static Predicate<? super IMicroElement>filterNamespaceURI(String sNamespaceURI) static Predicate<? super IMicroElement>filterNamespaceURIAndName(String sNamespaceURI, String sTagOrLocalName) default voidforAllChildElements(Consumer<? super IMicroElement> aConsumer) voidforAllChildElements(Predicate<? super IMicroElement> aFilter, Consumer<? super IMicroElement> aConsumer) default com.helger.commons.state.EContinueforAllChildElementsBreakable(Function<? super IMicroElement, com.helger.commons.state.EContinue> aConsumer) com.helger.commons.state.EContinueforAllChildElementsBreakable(Predicate<? super IMicroElement> aFilter, Function<? super IMicroElement, com.helger.commons.state.EContinue> aConsumer) default com.helger.commons.collection.impl.ICommonsList<IMicroElement>Get a list of all direct child elements.default com.helger.commons.collection.impl.ICommonsList<IMicroElement>getAllChildElements(String sTagName) Get a list of all direct child elements having the specified tag name.default com.helger.commons.collection.impl.ICommonsList<IMicroElement>getAllChildElements(String sNamespaceURI, String sLocalName) Get a list of all direct child elements having the specified namespace and the specified tag name.default com.helger.commons.collection.impl.ICommonsList<IMicroElement>getAllChildElements(Predicate<? super IMicroElement> aFilter) Get a list of all direct child elements matching the provided filter.com.helger.commons.collection.impl.ICommonsList<IMicroElement>Recursively get all child elements.default intGet the number of all direct child elements.default intgetChildElementCount(Predicate<? super IMicroElement> aFilter) Get the number of direct child elements that match the provided filter.getClone()default IMicroElementGet the first child element of this element.default IMicroElementgetFirstChildElement(String sTagName) Get the first child element with the given tag name.default IMicroElementgetFirstChildElement(String sNamespaceURI, String sLocalName) Get the first child element with the given tag name and the given namespace.getFirstChildElement(Predicate<? super IMicroElement> aFilter) Get the local name of the element.Get the namespace URI of this elementGet the name of the tag.default booleanCheck if this element has at least one direct child element.default booleanhasChildElements(String sTagName) Check if this element has at least one direct child element with the specified tag name.default booleanhasChildElements(String sNamespaceURI, String sLocalName) Check if this element has at least one direct child element with the specified namespace URI and tag name.default booleanhasLocalName(String sLocalName) Check if this element has the provided local name.default booleanCheck if this element has a specified namespace URI.default booleanhasNamespaceURI(String sNamespaceURI) Check if this element has the specified namespace URI.default booleanCheck if this element has no namespace URI.default booleanhasTagName(String sTagName) Check if this element has the provided tag name.default booleanhasTagNameIgnoreCase(String sTagName) Check if this element has the provided tag name but ignoring case.com.helger.commons.state.EChangesetNamespaceURI(String sNamespaceURI) Set a new namespace URI for this element.Methods inherited from interface com.helger.commons.hierarchy.IHasChildren
forAllChildren, forAllChildren, forAllChildrenBreakable, forAllChildrenMapped, getChildCount, getChildren, hasChildren, hasNoChildrenMethods inherited from interface com.helger.commons.hierarchy.IHasChildrenRecursive
forAllChildrenRecursive, forAllChildrenRecursiveMethods inherited from interface com.helger.commons.hierarchy.IHasChildrenSorted
findFirstChild, findFirstChildMapped, getChildAtIndexMethods inherited from interface com.helger.xml.microdom.IMicroAttributeContainer
forAllAttributes, forAllAttributes, forAllAttributes, getAllAttributeObjs, getAllAttributeQNames, getAllQAttributes, getAttributeCount, getAttributeObj, getAttributeObj, getAttributeObj, getAttributeObjs, getAttributeValue, getAttributeValue, getAttributeValue, getAttributeValueAsBool, getAttributeValueAsBool, getAttributeValueAsBool, getAttributeValueAsDouble, getAttributeValueAsDouble, getAttributeValueAsDouble, getAttributeValueAsFloat, getAttributeValueAsFloat, getAttributeValueAsFloat, getAttributeValueAsInt, getAttributeValueAsInt, getAttributeValueAsInt, getAttributeValueAsLong, getAttributeValueAsLong, getAttributeValueAsLong, getAttributeValueWithConversion, getAttributeValueWithConversion, getAttributeValueWithConversion, hasAttribute, hasAttribute, hasAttribute, hasAttributes, hasNoAttributes, removeAllAttributes, removeAttribute, removeAttribute, removeAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeWithConversion, setAttributeWithConversion, setAttributeWithConversion, setAttributeWithConversion, setAttributeWithConversion, setAttributeWithConversionMethods inherited from interface com.helger.xml.microdom.IMicroNode
appendCDATA, appendCDATA, appendCDATA, appendCDATAWithConversion, appendChild, appendChildren, appendChildren, appendComment, appendComment, appendComment, appendCommentWithConversion, appendContainer, appendElement, appendElement, appendEntityReference, appendIgnorableWhitespaceText, appendIgnorableWhitespaceText, appendIgnorableWhitespaceText, appendProcessingInstruction, appendText, appendText, appendText, appendTextWithConversion, containsAnyChild, detachFromParent, findParentElement, getAllChildren, getAllChildrenRecursive, getAllEventTargets, getAllEventTargets, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeValue, getParent, getParentElementWithName, getParentElementWithName, getPreviousSibling, getType, hasParent, insertAfter, insertAtIndex, insertBefore, isCDATA, isComment, isContainer, isDocument, isDocumentType, isElement, isEntityReference, isEqualContent, isProcessingInstruction, isText, registerEventTarget, removeAllChildren, removeChild, removeChildAtIndex, replaceChild, unregisterEventTargetMethods inherited from interface com.helger.xml.microdom.IMicroNodeWithChildren
getTextContent, getTextContentTrimmed, getTextContentWithConversion
-
Method Details
-
getNamespaceURI
Get the namespace URI of this element- Returns:
- May be
nullif this element has no namespace URI.
-
setNamespaceURI
Set a new namespace URI for this element.- Parameters:
sNamespaceURI- The namespace URI to be set. May benullor empty to indicate that the namespace should be removed.- Returns:
EChange
-
hasNamespaceURI
default boolean hasNamespaceURI()Check if this element has a specified namespace URI.- Returns:
trueif this element has a specified namespace URI,falseotherwise
-
hasNoNamespaceURI
default boolean hasNoNamespaceURI()Check if this element has no namespace URI.- Returns:
trueif this element has no namespace URI,falseotherwise
-
hasNamespaceURI
Check if this element has the specified namespace URI.- Parameters:
sNamespaceURI- The namespace URI to check. May not benull.- Returns:
trueif this element has the specified namespace URI,falseotherwise
-
getLocalName
Get the local name of the element. Is the same name as returned bygetTagName()but it is only present, if a namespace URI is present.- Returns:
- May be
nullif no namespace is present.
-
hasLocalName
Check if this element has the provided local name. The local name is the same name as returned bygetTagName()but is only present if a namespace URI is present.- Parameters:
sLocalName- The local name to compare against. May benull.- Returns:
trueif local name and the passed name match.
-
getTagName
Get the name of the tag. It never contains XML schema prefixes or the like. Is the same asgetLocalName()if a namespace URI is present.- Returns:
- May not be
null.
-
hasTagName
Check if this element has the provided tag name.- Parameters:
sTagName- The tag name to compare against. May benull.- Returns:
trueif tag name and the passed name match.
-
hasTagNameIgnoreCase
Check if this element has the provided tag name but ignoring case.- Parameters:
sTagName- The tag name to compare against. May benull.- Returns:
trueif tag name and the passed name match case insensitive.
-
getChildElementCount
Get the number of all direct child elements.- Returns:
- The number of all direct child elements. Always ≥ 0.
-
getChildElementCount
Get the number of direct child elements that match the provided filter.- Parameters:
aFilter- The filter to be applied. May benull.- Returns:
- The number of all direct child elements that match the provided filter. Always ≥ 0.
-
getAllChildElements
@Nonnull @ReturnsMutableCopy default com.helger.commons.collection.impl.ICommonsList<IMicroElement> getAllChildElements()Get a list of all direct child elements. Text nodes and other other child nodes are not returned with this call. Micro container children are inlined.- Returns:
- Never be
null.
-
getAllChildElements
@Nonnull @ReturnsMutableCopy default com.helger.commons.collection.impl.ICommonsList<IMicroElement> getAllChildElements(@Nullable String sTagName) Get a list of all direct child elements having the specified tag name. Micro container children are inlined.- Parameters:
sTagName- The tag name to check. May benull.- Returns:
- Never be
null.
-
getAllChildElements
@Nonnull @ReturnsMutableCopy default com.helger.commons.collection.impl.ICommonsList<IMicroElement> getAllChildElements(@Nullable String sNamespaceURI, @Nullable String sLocalName) Get a list of all direct child elements having the specified namespace and the specified tag name. Micro container children are inlined.- Parameters:
sNamespaceURI- The namespace URI to check. May benull.sLocalName- The tag name to check. May benull.- Returns:
- Never be
null.
-
getAllChildElements
@Nonnull @ReturnsMutableCopy default com.helger.commons.collection.impl.ICommonsList<IMicroElement> getAllChildElements(@Nullable Predicate<? super IMicroElement> aFilter) Get a list of all direct child elements matching the provided filter. Micro container children are inlined.- Parameters:
aFilter- The filter to be applied. May benullin which all direct child elements are returned.- Returns:
- A new list and never
null.
-
getAllChildElementsRecursive
@Nonnull @ReturnsMutableCopy com.helger.commons.collection.impl.ICommonsList<IMicroElement> getAllChildElementsRecursive()Recursively get all child elements. Micro container children are inlined.- Returns:
- A list containing all recursively contained elements. May not be
nullbut empty.
-
hasChildElements
default boolean hasChildElements()Check if this element has at least one direct child element. Micro container children are also checked.- Returns:
trueif this element has at least one child element
-
hasChildElements
Check if this element has at least one direct child element with the specified tag name. Micro container children are also checked.- Parameters:
sTagName- The tag name to check. May benull.- Returns:
trueif this element has at least one child element with the specified tag name
-
hasChildElements
Check if this element has at least one direct child element with the specified namespace URI and tag name. Micro container children are also checked.- Parameters:
sNamespaceURI- The namespace URI to check. May benull.sLocalName- The tag name to check. May benull.- Returns:
trueif this element has at least one child element with the specified namespace URI and tag name
-
containsAnyChildElement
Check if this element has at least one direct child element that matches the provided filter. Micro container children are also checked.- Parameters:
aFilter- The filter to be applied. May benull.- Returns:
trueif this element has at least one direct child element that matches the passed filter,falseotherwise.
-
getFirstChildElement
Get the first child element of this element. Micro container children are also checked.- Returns:
- The first child element or
nullif this element has no child element.
-
getFirstChildElement
Get the first child element with the given tag name. Micro container children are also checked.- Parameters:
sTagName- The tag name of the element to search. May benull.- Returns:
nullif no such child element is present
-
getFirstChildElement
@Nullable default IMicroElement getFirstChildElement(@Nullable String sNamespaceURI, @Nullable String sLocalName) Get the first child element with the given tag name and the given namespace. Micro container children are also checked.- Parameters:
sNamespaceURI- The namespace URL to search.sLocalName- The tag name of the element to search.- Returns:
nullif no such child element is present
-
getFirstChildElement
-
forAllChildElements
-
forAllChildElements
void forAllChildElements(@Nullable Predicate<? super IMicroElement> aFilter, @Nonnull Consumer<? super IMicroElement> aConsumer) -
forAllChildElementsBreakable
@Nonnull default com.helger.commons.state.EContinue forAllChildElementsBreakable(@Nonnull Function<? super IMicroElement, com.helger.commons.state.EContinue> aConsumer) -
forAllChildElementsBreakable
@Nonnull com.helger.commons.state.EContinue forAllChildElementsBreakable(@Nullable Predicate<? super IMicroElement> aFilter, @Nonnull Function<? super IMicroElement, com.helger.commons.state.EContinue> aConsumer) -
getClone
- Specified by:
getClonein interfacecom.helger.commons.lang.ICloneable<IMicroNode>- Specified by:
getClonein interfaceIMicroNodeWithChildren
-
filterNamespaceURI
-
filterName
-
filterNamespaceURIAndName
-