public interface IMicroNode extends com.helger.commons.lang.ICloneable<IMicroNode>, com.helger.commons.hierarchy.IHasChildrenSorted<IMicroNode>, com.helger.commons.hierarchy.IHasChildrenRecursive<IMicroNode>, com.helger.commons.hierarchy.IHasParent<IMicroNode>, Serializable
| Modifier and Type | Method and Description |
|---|---|
default IMicroCDATA |
appendCDATA(char[] aChars)
Append a CDATA node to this node.
|
default IMicroCDATA |
appendCDATA(char[] aChars,
int nOfs,
int nLen)
Append a CDATA node to this node.
|
default IMicroCDATA |
appendCDATA(CharSequence sText)
Append a CDATA node to this node.
|
default IMicroCDATA |
appendCDATAWithConversion(Object aValue)
Append a CDATA node to this node.
|
<NODETYPE extends IMicroNode> |
appendChild(NODETYPE aChildNode)
Append any child to the node.
|
default void |
appendChildren(IMicroNode... aChildren)
Append multiple children to the node at once.
|
default void |
appendChildren(Iterable<? extends IMicroNode> aChildren)
Append multiple children to the node at once.
|
default IMicroComment |
appendComment(char[] aChars)
Append a comment node to this node.
|
default IMicroComment |
appendComment(char[] aChars,
int nOfs,
int nLen)
Append a comment node to this node.
|
default IMicroComment |
appendComment(CharSequence sText)
Append a comment node to this node.
|
default IMicroComment |
appendCommentWithConversion(Object aValue)
Append a comment node to this node.
|
default IMicroContainer |
appendContainer()
Append a new container to this node
|
default IMicroElement |
appendElement(String sTagName)
Append an element without namespace to this node.
|
default IMicroElement |
appendElement(String sNamespaceURI,
String sTagName)
Append an element with namespace to this node.
|
default IMicroEntityReference |
appendEntityReference(String sName)
Append an entity reference to this node.
|
default IMicroText |
appendIgnorableWhitespaceText(char[] aChars)
Append a text node which is ignorable whitespace content to this node.
|
default IMicroText |
appendIgnorableWhitespaceText(char[] aChars,
int nOfs,
int nLen)
Append a text node which is ignorable whitespace content to this node.
|
default IMicroText |
appendIgnorableWhitespaceText(CharSequence sText)
Append a text node which is ignorable whitespace content to this node.
|
default IMicroProcessingInstruction |
appendProcessingInstruction(String sTarget,
String sData)
Append a processing instruction to this node.
|
default IMicroText |
appendText(char[] aChars)
Append a text node to this node.
|
default IMicroText |
appendText(char[] aChars,
int nOfs,
int nLen)
Append a text node to this node.
|
default IMicroText |
appendText(CharSequence sText)
Append a text node to this node.
|
default IMicroText |
appendTextWithConversion(Object aValue)
Append a text node to this node.
|
default boolean |
containsAnyChild(Predicate<? super IMicroNode> aFilter)
Check if any direct child matching the provided filter is contained.
|
IMicroNode |
detachFromParent()
Detach this node from the parent node so it can be inserted into another
node without problems.
|
IMicroElement |
findParentElement(Predicate<? super IMicroElement> aFilter) |
com.helger.commons.collection.impl.ICommonsList<IMicroNode> |
getAllChildren()
Get a list of all direct child nodes.
|
default com.helger.commons.collection.impl.ICommonsList<IMicroNode> |
getAllChildrenRecursive()
Recursively get all children.
|
com.helger.commons.collection.impl.ICommonsMap<EMicroEvent,com.helger.commons.callback.CallbackList<IMicroEventTarget>> |
getAllEventTargets() |
com.helger.commons.callback.CallbackList<IMicroEventTarget> |
getAllEventTargets(EMicroEvent eEvent)
Get all event targets for a certain event.
|
IMicroNode |
getFirstChild() |
IMicroNode |
getLastChild() |
IMicroNode |
getNextSibling() |
String |
getNodeName() |
default String |
getNodeValue() |
IMicroNode |
getParent() |
default IMicroElement |
getParentElementWithName(String sTagName) |
default IMicroElement |
getParentElementWithName(String sNamespaceURI,
String sTagName) |
IMicroNode |
getPreviousSibling() |
EMicroNodeType |
getType() |
boolean |
hasParent() |
<NODETYPE extends IMicroNode> |
insertAfter(NODETYPE aChildNode,
IMicroNode aPredecessor)
Insert an existing node after a certain child node of this.
|
<NODETYPE extends IMicroNode> |
insertAtIndex(int nIndex,
NODETYPE aChildNode)
Insert an existing node as a child at the specified index.
|
<NODETYPE extends IMicroNode> |
insertBefore(NODETYPE aChildNode,
IMicroNode aSuccessor)
Insert an existing node before a certain child node of this.
|
boolean |
isCDATA() |
boolean |
isComment() |
boolean |
isContainer() |
boolean |
isDocument() |
boolean |
isDocumentType() |
boolean |
isElement() |
boolean |
isEntityReference() |
boolean |
isEqualContent(IMicroNode aNode)
As instances of this class may not implement equals/hashCode we need a way
to determine, if 2 nodes are equal by content.
|
boolean |
isProcessingInstruction() |
boolean |
isText() |
com.helger.commons.state.EChange |
registerEventTarget(EMicroEvent eEventType,
IMicroEventTarget aTarget)
Register a specific MicroDOM event listener.
|
com.helger.commons.state.EChange |
removeAllChildren()
Remove all children from this node.
|
com.helger.commons.state.EChange |
removeChild(IMicroNode aChild)
Remove the passed child.
|
com.helger.commons.state.EChange |
removeChildAtIndex(int nIndex)
Remove the child not at the specified index.
|
default com.helger.commons.state.EChange |
replaceChild(IMicroNode aOldChild,
IMicroNode aNewChild)
Replace the passed old child with the new child.
|
com.helger.commons.state.EChange |
unregisterEventTarget(EMicroEvent eEventType,
IMicroEventTarget aTarget)
Unregister a specific MicroDOM event listener.
|
findFirstChild, findFirstChildMapped, getChildAtIndex@Nonnull @Nonempty String getNodeName()
IMicroElement nodes this is the same as the tag name.default String getNodeValue()
IMicroText,
IMicroComment and IMicroEntityReference.@Nullable com.helger.commons.collection.impl.ICommonsList<IMicroNode> getAllChildren()
getAllChildren in interface com.helger.commons.hierarchy.IHasChildren<IMicroNode>getAllChildren in interface com.helger.commons.hierarchy.IHasChildrenSorted<IMicroNode>null if the node has no children.default boolean containsAnyChild(@Nonnull Predicate<? super IMicroNode> aFilter)
aFilter - The filter that is applied to all child nodes. May not be
null.true if any child matching the provided filter is
contained, false otherwise.@Nullable IMicroNode getFirstChild()
getFirstChild in interface com.helger.commons.hierarchy.IHasChildrenSorted<IMicroNode>null if this
node has no children.@Nullable IMicroNode getLastChild()
getLastChild in interface com.helger.commons.hierarchy.IHasChildrenSorted<IMicroNode>null if this node
has no children.@Nullable default com.helger.commons.collection.impl.ICommonsList<IMicroNode> getAllChildrenRecursive()
null if this node has no children.@Nullable IMicroNode getPreviousSibling()
null if this node has no preceding siblings.@Nullable IMicroNode getNextSibling()
null
if this node has no succeeding siblings.boolean hasParent()
hasParent in interface com.helger.commons.hierarchy.IHasParent<IMicroNode>true if this node has a parent node assigned,
false otherwise.@Nullable IMicroNode getParent()
getParent in interface com.helger.commons.hierarchy.IHasParent<IMicroNode>null.@Nonnull IMicroNode detachFromParent()
IllegalStateException if adding this node again to another parent
since each node can only have one parent.@Nullable IMicroElement findParentElement(@Nonnull Predicate<? super IMicroElement> aFilter)
@Nullable default IMicroElement getParentElementWithName(@Nullable String sTagName)
@Nullable default IMicroElement getParentElementWithName(@Nullable String sNamespaceURI, @Nullable String sTagName)
@Nullable <NODETYPE extends IMicroNode> NODETYPE appendChild(@Nullable NODETYPE aChildNode)
NODETYPE - Parameter type == return typeaChildNode - The child node to append. May be null.null if the parameter was
null.MicroException - if this node cannot have childrendefault void appendChildren(@Nullable IMicroNode... aChildren)
aChildren - The child nodes to be appended. May be null and may
contain null values.MicroException - if this node cannot have childrendefault void appendChildren(@Nullable Iterable<? extends IMicroNode> aChildren)
aChildren - The child nodes to be appended. May be null and may
contain null values.MicroException - if this node cannot have children@Nullable <NODETYPE extends IMicroNode> NODETYPE insertBefore(@Nullable NODETYPE aChildNode, @Nonnull IMicroNode aSuccessor)
NODETYPE - Parameter type == return typeaChildNode - The new child node to be inserted.aSuccessor - The node before which the new node will be inserted.MicroException - if this node cannot have children@Nullable <NODETYPE extends IMicroNode> NODETYPE insertAfter(@Nullable NODETYPE aChildNode, @Nonnull IMicroNode aPredecessor)
NODETYPE - Parameter type == return typeaChildNode - The new child node to be inserted.aPredecessor - The node after which the new node will be inserted.MicroException - if this node cannot have children@Nullable <NODETYPE extends IMicroNode> NODETYPE insertAtIndex(@Nonnegative int nIndex, @Nullable NODETYPE aChildNode)
NODETYPE - Parameter type == return typenIndex - The index to insert. Must be ≥ 0.aChildNode - The new child node to be inserted.MicroException - if this node cannot have children@Nonnull default IMicroText appendText(@Nullable CharSequence sText)
sText - text to be addedMicroException - if this node cannot have children@Nonnull default IMicroText appendText(@Nonnull char[] aChars)
aChars - Characters to append. May not be nullMicroException - if this node cannot have children@Nonnull default IMicroText appendText(@Nonnull char[] aChars, @Nonnegative int nOfs, @Nonnegative int nLen)
aChars - Characters to append. May not be nullnOfs - Offset into the array where to start copying data. May not be <
0.nLen - Number of bytes to take from the array. May not be < 0.MicroException - if this node cannot have children@Nonnull default IMicroText appendTextWithConversion(@Nullable Object aValue)
String, the TypeConverter is
invoked to convert it to a String object.aValue - text to be addedMicroException - if this node cannot have children@Nonnull default IMicroText appendIgnorableWhitespaceText(@Nullable CharSequence sText)
sText - The whitespace content to be added.MicroException - if this node cannot have children@Nonnull default IMicroText appendIgnorableWhitespaceText(@Nonnull char[] aChars)
aChars - Characters to append. May not be nullMicroException - if this node cannot have children@Nonnull default IMicroText appendIgnorableWhitespaceText(@Nonnull char[] aChars, @Nonnegative int nOfs, @Nonnegative int nLen)
aChars - Characters to append. May not be nullnOfs - Offset into the array where to start copying data. May not be <
0.nLen - Number of bytes to take from the array. May not be < 0.MicroException - if this node cannot have children@Nonnull default IMicroCDATA appendCDATA(@Nullable CharSequence sText)
sText - CDATA textMicroException - if this node cannot have children@Nonnull default IMicroCDATA appendCDATA(@Nonnull char[] aChars)
aChars - Characters to append. May not be nullMicroException - if this node cannot have children@Nonnull default IMicroCDATA appendCDATA(@Nonnull char[] aChars, @Nonnegative int nOfs, @Nonnegative int nLen)
aChars - Characters to append. May not be nullnOfs - Offset into the array where to start copying data. May not be <
0.nLen - Number of bytes to take from the array. May not be < 0.MicroException - if this node cannot have children@Nonnull default IMicroCDATA appendCDATAWithConversion(@Nullable Object aValue)
String, the TypeConverter is
invoked to convert it to a String object.aValue - CDATA to be addedMicroException - if this node cannot have children@Nonnull default IMicroComment appendComment(@Nullable CharSequence sText)
sText - comment textMicroException - if this node cannot have children@Nonnull default IMicroComment appendComment(@Nonnull char[] aChars)
aChars - Characters to append. May not be nullMicroException - if this node cannot have children@Nonnull default IMicroComment appendComment(@Nonnull char[] aChars, @Nonnegative int nOfs, @Nonnegative int nLen)
aChars - Characters to append. May not be nullnOfs - Offset into the array where to start copying data. May not be <
0.nLen - Number of bytes to take from the array. May not be < 0.MicroException - if this node cannot have children@Nonnull default IMicroComment appendCommentWithConversion(@Nullable Object aValue)
String, the TypeConverter is
invoked to convert it to a String object.aValue - Comment to be addedMicroException - if this node cannot have children@Nonnull default IMicroEntityReference appendEntityReference(@Nonnull String sName)
sName - The name of the entity reference.MicroException - if this node cannot have children@Nonnull default IMicroElement appendElement(@Nonnull @Nonempty String sTagName)
sTagName - Element name to be created. May neither be null nor
empty.MicroException - if this node cannot have children@Nonnull default IMicroElement appendElement(@Nullable String sNamespaceURI, @Nonnull @Nonempty String sTagName)
sNamespaceURI - Namespace URI to use. May be null.sTagName - Element name to be created. May neither be null nor
empty.MicroException - if this node cannot have children@Nonnull default IMicroProcessingInstruction appendProcessingInstruction(@Nonnull @Nonempty String sTarget, @Nullable String sData)
sTarget - The PI targetsData - The PI dataMicroException - if this node cannot have children@Nonnull default IMicroContainer appendContainer()
MicroException - if this node cannot have children@Nonnull com.helger.commons.state.EChange removeChild(@Nonnull IMicroNode aChild)
aChild - The child to be removed. May not be null.EChange.CHANGED if the child was successfully removed,
EChange.UNCHANGED otherwise.@Nonnull com.helger.commons.state.EChange removeChildAtIndex(@Nonnegative int nIndex)
nIndex - The 0-based index of the item to be removed.EChange.CHANGED if the node was successfully removed,
EChange.UNCHANGED otherwise.@Nonnull com.helger.commons.state.EChange removeAllChildren()
EChange.CHANGED if at least one child was present, and was
successfully removed, EChange.UNCHANGED otherwise.@Nonnull default com.helger.commons.state.EChange replaceChild(@Nonnull IMicroNode aOldChild, @Nonnull IMicroNode aNewChild)
aOldChild - The child to be removed. May not be null.aNewChild - The child to be inserted instead. May not be null.EChange.CHANGED if the child was successfully replaced,
EChange.UNCHANGED if old child and new child are identical.@Nonnull EMicroNodeType getType()
null.boolean isDocument()
true if this node can safely be casted to
IMicroDocument.boolean isDocumentType()
true if this node can safely be casted to
IMicroDocumentType.boolean isText()
true if this node can safely be casted to
IMicroText.boolean isCDATA()
true if this node can safely be casted to
IMicroCDATA.boolean isComment()
true if this node can safely be casted to
IMicroComment.boolean isEntityReference()
true if this node can safely be casted to
IMicroEntityReference.boolean isElement()
true if this node can safely be casted to
IMicroElement.boolean isProcessingInstruction()
true if this node can safely be casted to
IMicroProcessingInstruction.boolean isContainer()
true if this node can safely be casted to
IMicroContainer.@Nonnull com.helger.commons.state.EChange registerEventTarget(@Nonnull EMicroEvent eEventType, @Nonnull IMicroEventTarget aTarget)
eEventType - The event type. May not be null.aTarget - The event target to be added. May not be null.EChange.CHANGED if the event listener was registered,
EChange.UNCHANGED otherwise.@Nonnull com.helger.commons.state.EChange unregisterEventTarget(@Nonnull EMicroEvent eEventType, @Nonnull IMicroEventTarget aTarget)
eEventType - The event type. May not be null.aTarget - The event target to be added. May not be null.EChange.CHANGED if the event listener was unregistered,
EChange.UNCHANGED otherwise.@Nonnull @ReturnsMutableCopy com.helger.commons.collection.impl.ICommonsMap<EMicroEvent,com.helger.commons.callback.CallbackList<IMicroEventTarget>> getAllEventTargets()
null.@Nonnull @ReturnsMutableCopy com.helger.commons.callback.CallbackList<IMicroEventTarget> getAllEventTargets(@Nullable EMicroEvent eEvent)
eEvent - The event to be queried. May be null.null.boolean isEqualContent(@Nullable IMicroNode aNode)
aNode - The node to compare to this.true if the nodes are of the same type and the same
content, false otherwise.Copyright © 2014–2021 Philip Helger. All rights reserved.