Package de.pdark.decentxml
Class Document
java.lang.Object
de.pdark.decentxml.NodeWithChildren
de.pdark.decentxml.Document
This class represents an XML document.
If you add a ProcessingInstruction as the first node of the document,
it will be converted into an XMLDeclaration.
Note: The automatic creation of XMLDeclaration is not perfect; if you
manipulate the list of nodes yourself (for example, via getNodes().add()),
then you're on your own.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DocTypeprivate Namespacesprivate Elementprivate XMLDeclaration -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddNodes(int index, Collection<? extends Node> nodes) addNodes(Collection<? extends Node> nodes) protected voidcopy()Simulate clone()Copy all data fromorigintothisSimulate clone()protected XMLDeclarationFind a child element (not a node!) by pathgetNamespace(String prefix) getType()Get the node typebooleaniterator()voidParse a possible XML declaration and fill the internal fields with the data.removeNode(int index) Remove a node from the listbooleanremoveNode(Node n) Remove a node from the listvoidsetDocType(DocType docType) setEncoding(String encoding) voidsetNamespaces(Namespaces namespaces) setRootNode(Element rootNode) voidsetStandalone(boolean standalone) setVersion(String version) voidsetXmlDeclaration(XMLDeclaration xmlDeclaration) Fast way to convert many nodes to XMLMethods inherited from class de.pdark.decentxml.NodeWithChildren
clearNodes, getNode, getNodes, getNodes, hasNodes, nodeCount, nodeIndexOf, toString, toXMLMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface de.pdark.decentxml.Parent
clearNodes, getNode, getNodes, hasNodes, nodeCount, nodeIndexOf
-
Field Details
-
rootNode
-
xmlDeclaration
-
docType
-
namespaces
-
-
Constructor Details
-
Document
public Document() -
Document
-
-
Method Details
-
addNode
- Specified by:
addNodein interfaceParent- Overrides:
addNodein classNodeWithChildren
-
addNode
- Specified by:
addNodein interfaceParent- Overrides:
addNodein classNodeWithChildren
-
addNodes
- Specified by:
addNodesin interfaceParent- Overrides:
addNodesin classNodeWithChildren
-
addNodes
- Specified by:
addNodesin interfaceParent- Overrides:
addNodesin classNodeWithChildren
-
addNodes
- Specified by:
addNodesin interfaceParent- Overrides:
addNodesin classNodeWithChildren
-
addNodes
- Specified by:
addNodesin interfaceParent- Overrides:
addNodesin classNodeWithChildren
-
removeNode
Description copied from interface:ParentRemove a node from the list- Specified by:
removeNodein interfaceParent- Overrides:
removeNodein classNodeWithChildren- Returns:
- The removed node.
-
removeNode
Description copied from interface:ParentRemove a node from the list- Specified by:
removeNodein interfaceParent- Overrides:
removeNodein classNodeWithChildren- Returns:
- true, if the node is in the list
-
getChild
Description copied from interface:ParentFind a child element (not a node!) by path -
getChild
-
getType
Description copied from interface:NodeGet the node type -
getRootElement
-
setRootNode
-
getXmlDeclaration
-
setXmlDeclaration
-
getVersion
-
setVersion
-
createXMLDeclaration
-
getEncoding
-
setEncoding
-
isStandalone
public boolean isStandalone() -
setStandalone
public void setStandalone(boolean standalone) -
toXML
Description copied from interface:NodeFast way to convert many nodes to XML- Specified by:
toXMLin interfaceNode- Overrides:
toXMLin classNodeWithChildren- Throws:
IOException
-
parseXMLDeclaration
public void parseXMLDeclaration()Parse a possible XML declaration and fill the internal fields with the data. -
clearXMLDeclaration
protected void clearXMLDeclaration() -
getDocType
-
setDocType
-
getNamespaces
-
setNamespaces
-
getNamespace
-
createClone
Description copied from interface:NodeSimulate clone()- Specified by:
createClonein interfaceNode
-
copy
Description copied from interface:NodeCopy all data fromorigintothis- Specified by:
copyin interfaceNode- Overrides:
copyin classNodeWithChildren
-
copy
Description copied from interface:NodeSimulate clone()- Specified by:
copyin interfaceNode- Overrides:
copyin classNodeWithChildren
-
iterator
-