Package com.helger.xml.microdom
Class MicroDocument
- java.lang.Object
-
- com.helger.xml.microdom.AbstractMicroNode
-
- com.helger.xml.microdom.AbstractMicroNodeWithChildren
-
- com.helger.xml.microdom.MicroDocument
-
- All Implemented Interfaces:
com.helger.commons.hierarchy.IHasChildren<IMicroNode>,com.helger.commons.hierarchy.IHasChildrenRecursive<IMicroNode>,com.helger.commons.hierarchy.IHasChildrenSorted<IMicroNode>,com.helger.commons.hierarchy.IHasParent<IMicroNode>,com.helger.commons.lang.ICloneable<IMicroNode>,IMicroDocument,IMicroNode,IMicroNodeWithChildren,Serializable
public final class MicroDocument extends AbstractMicroNodeWithChildren implements IMicroDocument
Default implementation of theIMicroDocumentinterface.- Author:
- Philip Helger
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static com.helger.commons.state.ETriStateDEFAULT_STANDALONE
-
Constructor Summary
Constructors Constructor Description MicroDocument()MicroDocument(IMicroDocumentType aDocType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IMicroDocumentgetClone()IMicroDocumentTypegetDocType()IMicroElementgetDocumentElement()StringgetNodeName()com.helger.commons.state.ETriStategetStandalone()EMicroNodeTypegetType()booleanisEqualContent(IMicroNode o)As instances of this class may not implement equals/hashCode we need a way to determine, if 2 nodes are equal by content.protected voidonAppendChild(AbstractMicroNode aChildNode)Callback that is invoked once a child is to be appended.voidsetStandalone(com.helger.commons.state.ETriState eStandalone)Change the standalone state of this document.StringtoString()-
Methods inherited from class com.helger.xml.microdom.AbstractMicroNodeWithChildren
containsAnyChild, directGetAllChildren, findFirstChild, findFirstChildMapped, forAllChildren, forAllChildren, forAllChildrenBreakable, forAllChildrenMapped, getAllChildren, getChildAtIndex, getChildCount, getChildren, getFirstChild, getLastChild, getTextContent, getTextContentWithConversion, hasChildren, onInsertAfter, onInsertAtIndex, onInsertBefore, onRemoveAllChildren, onRemoveChild, onRemoveChildAtIndex
-
Methods inherited from class com.helger.xml.microdom.AbstractMicroNode
appendChild, detachFromParent, findParentElement, getAllEventTargets, getAllEventTargets, getNextSibling, getParent, getPreviousSibling, hasParent, insertAfter, insertAtIndex, insertBefore, internalResetParentNode, internalSetParentNode, internalTriggerEvent, isCDATA, isComment, isContainer, isDocument, isDocumentType, isElement, isEntityReference, isProcessingInstruction, isText, onEvent, registerEventTarget, removeAllChildren, removeChild, removeChildAtIndex, unregisterEventTarget
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.commons.hierarchy.IHasChildren
forAllChildren, forAllChildren, forAllChildrenBreakable, forAllChildrenMapped, getChildCount, getChildren, hasChildren, hasNoChildren
-
Methods inherited from interface com.helger.commons.hierarchy.IHasChildrenRecursive
forAllChildrenRecursive, forAllChildrenRecursive
-
Methods inherited from interface com.helger.commons.hierarchy.IHasChildrenSorted
findFirstChild, findFirstChildMapped, getChildAtIndex
-
Methods inherited from interface com.helger.xml.microdom.IMicroDocument
isStandalone, setStandalone
-
Methods 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, getNodeValue, getParent, getParentElementWithName, getParentElementWithName, getPreviousSibling, hasParent, insertAfter, insertAtIndex, insertBefore, isCDATA, isComment, isContainer, isDocument, isDocumentType, isElement, isEntityReference, isProcessingInstruction, isText, registerEventTarget, removeAllChildren, removeChild, removeChildAtIndex, replaceChild, unregisterEventTarget
-
Methods inherited from interface com.helger.xml.microdom.IMicroNodeWithChildren
getTextContent, getTextContentTrimmed, getTextContentWithConversion
-
-
-
-
Constructor Detail
-
MicroDocument
public MicroDocument()
-
MicroDocument
public MicroDocument(@Nullable IMicroDocumentType aDocType)
-
-
Method Detail
-
getType
@Nonnull public EMicroNodeType getType()
- Specified by:
getTypein interfaceIMicroNode- Returns:
- The node type. Never
null.
-
getNodeName
public String getNodeName()
- Specified by:
getNodeNamein interfaceIMicroNode- Returns:
- Just an abstract name that depends on the implementing class. For
IMicroElementnodes this is the same as the tag name.
-
onAppendChild
protected void onAppendChild(@Nonnull AbstractMicroNode aChildNode)
Description copied from class:AbstractMicroNodeCallback that is invoked once a child is to be appended.- Overrides:
onAppendChildin classAbstractMicroNodeWithChildren- Parameters:
aChildNode- The appended child node.
-
getStandalone
@Nonnull public com.helger.commons.state.ETriState getStandalone()
- Specified by:
getStandalonein interfaceIMicroDocument- Returns:
- The standalone value. Never
null.
-
setStandalone
public void setStandalone(@Nonnull com.helger.commons.state.ETriState eStandalone)
Description copied from interface:IMicroDocumentChange the standalone state of this document.- Specified by:
setStandalonein interfaceIMicroDocument- Parameters:
eStandalone- The new value. May not benull.
-
getDocType
@Nullable public IMicroDocumentType getDocType()
- Specified by:
getDocTypein interfaceIMicroDocument- Returns:
- May be
null.
-
getDocumentElement
@Nullable public IMicroElement getDocumentElement()
- Specified by:
getDocumentElementin interfaceIMicroDocument- Returns:
- May be
null.
-
getClone
@Nonnull public IMicroDocument getClone()
Description copied from interface:IMicroDocument- Specified by:
getClonein interfacecom.helger.commons.lang.ICloneable<IMicroNode>- Specified by:
getClonein interfaceIMicroDocument- Specified by:
getClonein interfaceIMicroNodeWithChildren
-
isEqualContent
public boolean isEqualContent(@Nullable IMicroNode o)
Description copied from interface:IMicroNodeAs instances of this class may not implement equals/hashCode we need a way to determine, if 2 nodes are equal by content.- Specified by:
isEqualContentin interfaceIMicroNode- Overrides:
isEqualContentin classAbstractMicroNodeWithChildren- Parameters:
o- The node to compare to this.- Returns:
trueif the nodes are of the same type and the same content,falseotherwise.
-
toString
public String toString()
- Overrides:
toStringin classAbstractMicroNodeWithChildren
-
-