public class XmlDataNode extends java.lang.Object implements XmlAddData_ifc
XmlJzReader
without semantic sorting of attributes and nodes.
The XmlJzReader
can now be used adequate a DOM XML reader, reads all what is found.
This is the destination.
The semantic sorting should be done by evaluation of the content.
This instance represents all nodes and refers all sub nodes.
If it is the root of a read XML file, it is the sum of all data.
XmlJzReader
till before was only: Only store adequate a given config file.
Now using this class the config file should only contain namespace declarations, no more.Modifier and Type | Class and Description |
---|---|
(package private) class |
XmlDataNode.OnlyOneNode
Dummy class to offer an iterator with one or zero nodes
|
Modifier and Type | Field and Description |
---|---|
java.util.List<XmlDataNode> |
allNodes
List of all sub nodes in order of appearance in the node.
|
java.util.Map<java.lang.String,java.lang.String> |
attribs
Index of all attributes sorted by name.
|
java.util.Map<java.lang.String,java.util.List<XmlDataNode>> |
multiNodes
As alternative to members in
singleNodes :
Index of sub nodes with a defined key as <name ... |
protected XmlDataNode |
parent |
java.util.Map<java.lang.String,XmlDataNode> |
singleNodes
Index of sub nodes with a defined key as <name ...
|
java.lang.String |
tag |
java.lang.String |
text
If this element is set, the node has only one text.
|
static java.lang.String |
version
Version, history and license.
|
Constructor and Description |
---|
XmlDataNode(XmlDataNode parent,
java.lang.String tag,
java.util.Map<java.lang.String,java.lang.String> attribs) |
Modifier and Type | Method and Description |
---|---|
void |
addNode(XmlAddData_ifc node)
Adds a new parsed node to the current list of nodes.
|
void |
addText(java.lang.String text)
Add a plain text to the node.
|
java.lang.String |
getAttrib(java.lang.String key) |
XmlDataNode |
getFirstNode(java.lang.String key) |
java.lang.String |
getText()
Get the whole plain text inside the node.
|
java.util.ListIterator<XmlDataNode> |
iterListNodes(java.lang.String tag)
ListIterator over all nodes of a defined tag, also applicable if no node is given.
|
java.lang.Iterable<XmlDataNode> |
iterNodes(java.lang.String tag)
Iterator over all nodes of a defined tag, also applicable if no node is given.
|
XmlAddData_ifc |
newNode(java.lang.String tag,
java.util.Map<java.lang.String,java.lang.String> attribs)
Creates a new node with all given attrib values.
|
java.lang.String |
toString() |
public static final java.lang.String version
#getTextSub()
for special cases, for example LibreOffc span is sometimes deep nested without necessity.
iterNodes(String)
and XmlDataNode.OnlyOneNode
to evaluate a dedicated tag of nodes.
XmlJzReader
should be used adequate a DOM XML reader, reads all what is found.
This is the destination.
protected final XmlDataNode parent
public final java.lang.String tag
public java.lang.String text
public final java.util.Map<java.lang.String,java.lang.String> attribs
public final java.util.Map<java.lang.String,XmlDataNode> singleNodes
public final java.util.Map<java.lang.String,java.util.List<XmlDataNode>> multiNodes
singleNodes
:
Index of sub nodes with a defined key as <name ...
with more as one member in the node.
This allows simple select all sub nodes with a defined <name in order of their appearance in the node.public final java.util.List<XmlDataNode> allNodes
public XmlDataNode(XmlDataNode parent, java.lang.String tag, java.util.Map<java.lang.String,java.lang.String> attribs)
public XmlAddData_ifc newNode(java.lang.String tag, java.util.Map<java.lang.String,java.lang.String> attribs)
XmlAddData_ifc
newNode
in interface XmlAddData_ifc
public void addNode(XmlAddData_ifc node)
XmlAddData_ifc
addNode
in interface XmlAddData_ifc
public void addText(java.lang.String text)
text
for a simple text.
If the node is not empty, then all texts are stored in order of all sub nodes in the List allNodes
.
A simple text before stored is added also there, but on first position because it was stored as first.addText
in interface XmlAddData_ifc
public java.lang.String getAttrib(java.lang.String key)
public XmlDataNode getFirstNode(java.lang.String key)
public java.lang.Iterable<XmlDataNode> iterNodes(java.lang.String tag)
tag
- public java.util.ListIterator<XmlDataNode> iterListNodes(java.lang.String tag)
tag
- public java.lang.String getText()
text
and returned.
Or there are some more text parts, stored as node with tag="$" in multiNodes
.
Then all these text parts are concatenated and returned as one.public java.lang.String toString()
toString
in class java.lang.Object