public class XmlNodeJdom extends java.lang.Object implements XmlNode
XmlNode.
So some algorithm using XmlNode can execute with a given JDOM XML Tree.
xml.CorrectHref. There a JDOM tree is used,
and WikistyleTextToSimpleXml is called there. The last class
WikistyleTextToSimpleXml don't know JDOM, but it works correct.| Constructor and Description |
|---|
XmlNodeJdom(Element jdomNode) |
| Modifier and Type | Method and Description |
|---|---|
XmlNode |
addContent(java.lang.String text)
Adds textual content.
|
XmlNode |
addContent(XmlNode node)
Adds a child node.
|
void |
addNamespaceDeclaration(java.lang.String name,
java.lang.String value)
Adds namespace declaration on the specified node.
|
XmlNode |
addNewNode(java.lang.String name,
java.lang.String namespaceKey)
adds and returns a new child node.
|
XmlNode |
createNode(java.lang.String name,
java.lang.String namespaceKey)
creates a XmlNode from the same implementation type as this, but without adding to the XML-tree.
|
java.lang.String |
getAttribute(java.lang.String name)
returns the requested attribute or null if it is not existing.
|
java.util.Map<java.lang.String,java.lang.String> |
getAttributes()
returns all attributes.
|
XmlNode |
getChild(java.lang.String key)
Searches the first child with given key from the given node this.
|
java.lang.String |
getName()
Returns the tagname of the node.
|
java.lang.String |
getNamespaceKey()
returns the alias or key of the namespace.
|
java.util.Map<java.lang.String,java.lang.String> |
getNamespaces()
Gets all namespace declaration at this node.
|
XmlNode |
getParent() |
boolean |
isTextNode()
returns true if the node is a text, not a XML element.
|
java.util.Iterator<XmlNode> |
iterChildren()
Returns an iterator through the list of all children of the node.
|
java.util.Iterator<XmlNode> |
iterChildren(java.lang.String key)
Returns an iterator through the list of all children with the given key.
|
java.util.List<XmlNode> |
listChildren()
Returns a List of all children of the node.
|
java.util.List<XmlNode> |
listChildren(java.lang.String key)
Returns a List of all children with the given key.
|
java.lang.String |
removeAttribute(java.lang.String name)
removes the requested attribute.
|
void |
removeChildren()
removes all children, also textual content, but not attributes.
|
void |
setAttribute(java.lang.String name,
java.lang.String value)
Sets an attribute by name.
|
void |
setParent(XmlNode parent) |
java.lang.String |
text()
Returns the text of the node.
|
java.lang.String |
toString() |
public XmlNodeJdom(Element jdomNode)
public XmlNode addContent(java.lang.String text)
org.vishia.xmlSimple.XmlNodeaddContent in interface XmlNodepublic XmlNode addContent(XmlNode node) throws XmlException
org.vishia.xmlSimple.XmlNodeXmlNode.getName() starts with "@", it is added as an attribute to this with the XmlNode.text()
as attribute value. This opens the possibility to create a XmlNode independent of a parent and independent of checking
whether it should be an attribute, and convert it to an attribute later.addContent in interface XmlNodenode - to addXmlExceptionpublic void addNamespaceDeclaration(java.lang.String name, java.lang.String value)
org.vishia.xmlSimple.XmlNodeaddNamespaceDeclaration in interface XmlNodename - namespace alias (key)value - namespace uri.public XmlNode addNewNode(java.lang.String name, java.lang.String namespaceKey) throws XmlException
org.vishia.xmlSimple.XmlNodeaddNewNode in interface XmlNodeXmlExceptionpublic XmlNode createNode(java.lang.String name, java.lang.String namespaceKey) throws XmlException
org.vishia.xmlSimple.XmlNodeXmlNode.addContent(XmlNode), because it may be necessary to built
a sub tree with the new node first, and than add, if there are multi threads.createNode in interface XmlNodenamespaceKey - The this-node should know the key, otherwise an XmlException is thrown.XmlExceptionpublic java.lang.String getAttribute(java.lang.String name)
org.vishia.xmlSimple.XmlNodegetAttribute in interface XmlNodepublic java.util.Map<java.lang.String,java.lang.String> getAttributes()
org.vishia.xmlSimple.XmlNodegetAttributes in interface XmlNodepublic XmlNode getChild(java.lang.String key)
org.vishia.util.SortedTreegetChild in interface SortedTree<XmlNode>key - The key of the demanded child. The implementation may have extra possibilities in addressing children
with strings. The sKey can be representing more as a simple string as a attribute in children.
It may be comparable with the ability of XPATH in XML.
But it will be a feature of Implementation and is not defined as a basic feature of this interface.
public java.lang.String getName()
org.vishia.xmlSimple.XmlNodeXmlNode.isTextNode().
public java.lang.String getNamespaceKey()
org.vishia.xmlSimple.XmlNodegetNamespaceKey in interface XmlNodepublic java.util.Map<java.lang.String,java.lang.String> getNamespaces()
org.vishia.xmlSimple.XmlNodegetNamespaces in interface XmlNodepublic XmlNode getParent()
getParent in interface SortedTree<XmlNode>public boolean isTextNode()
org.vishia.xmlSimple.XmlNodeisTextNode in interface XmlNodepublic java.util.Iterator<XmlNode> iterChildren()
org.vishia.util.SortedTreeiterChildren in interface SortedTree<XmlNode>public java.util.Iterator<XmlNode> iterChildren(java.lang.String key)
org.vishia.util.SortedTreeiterChildren in interface SortedTree<XmlNode>key - The key of the demanded child. The implementation may have extra possibilities, see getChild(String).public java.util.List<XmlNode> listChildren()
org.vishia.util.SortedTreelistChildren in interface SortedTree<XmlNode>public java.util.List<XmlNode> listChildren(java.lang.String key)
org.vishia.util.SortedTreelistChildren in interface SortedTree<XmlNode>key - The key of the demanded child. The implementation may have extra possibilities, see getChild(String).public java.lang.String removeAttribute(java.lang.String name)
org.vishia.xmlSimple.XmlNoderemoveAttribute in interface XmlNodepublic void removeChildren()
org.vishia.xmlSimple.XmlNoderemoveChildren in interface XmlNodepublic void setAttribute(java.lang.String name, java.lang.String value)
org.vishia.xmlSimple.XmlNodesetAttribute in interface XmlNodepublic java.lang.String text()
org.vishia.xmlSimple.XmlNodepublic java.lang.String toString()
toString in class java.lang.Object