XMLPos is the iterator for XML trees in XMLStorage. More...

Public Member Functions | |
| XMLPos (XMLNode root) | |
| Construct an XMLPos, which points to the given XMLNode. | |
| XMLPos (final XMLPos other) | |
| Construct an XMLPos as copy of another. | |
| XMLPos (final XMLPos other, final String nodeName) | |
| Create XML tree iterator positioned at subnode node_name of current other position. | |
| XMLPos (final XMLPos other, final String nodeName, final String attrName, final String attrValue) | |
| Create XML tree iterator positioned at subnode node_name with attribute attrName and attribute value attrValue. | |
| XMLNode | cur () |
| Return the current node. | |
| String | get (final String attrName) |
| Return the value of an attribute in the current node or "". | |
| String | get (final String attrName, final String def) |
| Return the value of an attribute in the current node or a default value. | |
| void | put (final String attrName, final String value) |
| Set an attribute value. | |
| void | addDown (XMLNode child) |
| Insert children when building tree. | |
| boolean | back () |
| Go back to previous position. | |
| boolean | goDown () |
| Go down to first child. | |
| boolean | goDown (final String name) |
| Search for child and go down. | |
| boolean | go (String path) |
| Move X-Path like to position in XML tree. | |
| boolean | go (XPath xpath) |
| Move X-Path like to position in XML tree. | |
| void | create (final String name) |
| Create node and move to it. | |
| void | smartCreate (final String name) |
| Create node if not already existing and move to it. | |
| void | smartCreate (final String name, final String attrName, final String attrValue) |
| Search matching child node identified by key name and an attribute value. | |
| String | getContent () |
| void | setContent (final String s) |
| void | setContent (final String s, boolean cdata) |
| String | toString () |
| Return the name oif the current node. | |
| void | putSubattrib (final String nodeName, final String attrName, final String value) |
| Set an attribute in a subnode. | |
Protected Member Functions | |
| void | goTo (XMLNode child) |
| Go to the specified node. | |
Protected Attributes | |
| XMLNode | _root |
| XMLNode | _cur |
| Stack< XMLNode > | _stack = new Stack<XMLNode>() |
XMLPos is the iterator for XML trees in XMLStorage.
Definition at line 48 of file XMLPos.java.
| de.mfuchs.xmlstorage.XMLPos.XMLPos | ( | XMLNode | root ) |
Construct an XMLPos, which points to the given XMLNode.
| root | root node |
Definition at line 54 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur, and de.mfuchs.xmlstorage.XMLPos._root.
| de.mfuchs.xmlstorage.XMLPos.XMLPos | ( | final XMLPos | other ) |
Construct an XMLPos as copy of another.
| other | XMLPos original |
Definition at line 64 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur, and de.mfuchs.xmlstorage.XMLPos._root.
| de.mfuchs.xmlstorage.XMLPos.XMLPos | ( | final XMLPos | other, |
| final String | nodeName | ||
| ) |
Create XML tree iterator positioned at subnode node_name of current other position.
| other | position to be copied |
| nodeName | new node name |
Definition at line 76 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur, de.mfuchs.xmlstorage.XMLPos._root, and de.mfuchs.xmlstorage.XMLPos.smartCreate().
{
_root = other._root;
_cur = other._cur;
// don't copy _stack
smartCreate(nodeName);
}

| de.mfuchs.xmlstorage.XMLPos.XMLPos | ( | final XMLPos | other, |
| final String | nodeName, | ||
| final String | attrName, | ||
| final String | attrValue | ||
| ) |
Create XML tree iterator positioned at subnode node_name with attribute attrName and attribute value attrValue.
| other | position to be copied |
| nodeName | new node name |
| attrName | attribute name |
| attrValue | attribute value |
Definition at line 93 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur, de.mfuchs.xmlstorage.XMLPos._root, and de.mfuchs.xmlstorage.XMLPos.smartCreate().
{
_root = other._root;
_cur = other._cur;
// don't copy _stack
smartCreate(nodeName, attrName, attrValue);
}

| void de.mfuchs.xmlstorage.XMLPos.addDown | ( | XMLNode | child ) |
Insert children when building tree.
| child | new child |
Definition at line 145 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur, de.mfuchs.xmlstorage.XMLNode.addChild(), and de.mfuchs.xmlstorage.XMLPos.goTo().
Referenced by de.mfuchs.xmlstorage.XMLPos.create(), de.mfuchs.xmlstorage.XMLPos.smartCreate(), and de.mfuchs.xmlstorage.XMLDocReader.startElement().

| boolean de.mfuchs.xmlstorage.XMLPos.back | ( | ) |
Go back to previous position.
Definition at line 155 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur, and de.mfuchs.xmlstorage.XMLPos._stack.
Referenced by de.mfuchs.xmlstorage.XMLDocReader.endElement(), de.mfuchs.XMLTest.test1(), de.mfuchs.XMLTest.test2Read(), de.mfuchs.XMLTest.test2Write(), de.mfuchs.XMLTest.test3Write(), de.mfuchs.Example3.testRead(), de.mfuchs.Example2.testRead(), de.mfuchs.Example1.testRead(), de.mfuchs.Example3.testWrite(), de.mfuchs.Example2.testWrite(), and de.mfuchs.Example1.testWrite().
| void de.mfuchs.xmlstorage.XMLPos.create | ( | final String | name ) |
Create node and move to it.
| name | name of the new node |
Definition at line 227 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos.addDown().
Referenced by de.mfuchs.XMLTest.test2Write(), de.mfuchs.XMLTest.test3Write(), de.mfuchs.Example3.testWrite(), de.mfuchs.Example2.testWrite(), de.mfuchs.Example1.testWrite(), and de.mfuchs.xmlstorage.XMLMessage.XMLMessage().
{
addDown(new XMLNode(name));
}

| XMLNode de.mfuchs.xmlstorage.XMLPos.cur | ( | ) |
Return the current node.
Definition at line 105 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur.
Referenced by de.mfuchs.xmlstorage.XMLDocReader.endElement(), de.mfuchs.xmlstorage.XMLDocReader.read(), de.mfuchs.xmlstorage.XMLDocReader.startElement(), de.mfuchs.xmlstorage.XMLBool.XMLBool(), de.mfuchs.xmlstorage.XMLChildrenFilter.XMLChildrenFilter(), de.mfuchs.xmlstorage.XMLInt.XMLInt(), de.mfuchs.xmlstorage.XMLIntRef.XMLIntRef(), de.mfuchs.xmlstorage.XMLNumber.XMLNumber(), de.mfuchs.xmlstorage.XMLString.XMLString(), and de.mfuchs.xmlstorage.XMLStringRef.XMLStringRef().
{
return _cur;
}
| String de.mfuchs.xmlstorage.XMLPos.get | ( | final String | attrName ) |
Return the value of an attribute in the current node or "".
| attrName | attribute name |
Definition at line 115 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur, and de.mfuchs.xmlstorage.XMLNode.get().
Referenced by de.mfuchs.Example3.testRead(), and de.mfuchs.Example2.testRead().
{
return _cur.get(attrName);
}

| String de.mfuchs.xmlstorage.XMLPos.get | ( | final String | attrName, |
| final String | def | ||
| ) |
Return the value of an attribute in the current node or a default value.
| attrName | attribute name |
| def | default value |
Definition at line 126 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur, and de.mfuchs.xmlstorage.XMLNode.get().
{
return _cur.get(attrName, def);
}

| String de.mfuchs.xmlstorage.XMLPos.getContent | ( | ) |
Definition at line 269 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur, and de.mfuchs.xmlstorage.XMLNode.getContent().
Referenced by de.mfuchs.XMLTest.test2Read(), and de.mfuchs.Example1.testRead().
{
return _cur.getContent();
}

| boolean de.mfuchs.xmlstorage.XMLPos.go | ( | String | path ) |
Move X-Path like to position in XML tree.
| path | XPath expression |
Definition at line 200 of file XMLPos.java.
Referenced by de.mfuchs.XMLTest.test1(), de.mfuchs.XMLTest.test2Read(), de.mfuchs.Example3.testRead(), de.mfuchs.Example2.testRead(), and de.mfuchs.Example1.testRead().
{
return go(new XPath(path));
}
| boolean de.mfuchs.xmlstorage.XMLPos.go | ( | XPath | xpath ) |
Move X-Path like to position in XML tree.
| xpath | XPath object |
Definition at line 210 of file XMLPos.java.
References de.mfuchs.xmlstorage.XPath._absolute, de.mfuchs.xmlstorage.XMLPos._cur, de.mfuchs.xmlstorage.XMLPos._root, de.mfuchs.xmlstorage.XMLNode.findRelative(), and de.mfuchs.xmlstorage.XMLPos.goTo().
{
XMLNode node = xpath._absolute? _root: _cur;
node = node.findRelative(xpath);
if (node != null) {
goTo(node);
return true;
} else
return false;
}

| boolean de.mfuchs.xmlstorage.XMLPos.goDown | ( | final String | name ) |
Search for child and go down.
| name | node name |
Definition at line 184 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur, de.mfuchs.xmlstorage.XMLNode.find(), and de.mfuchs.xmlstorage.XMLPos.goTo().
{
XMLNode node = _cur.find(name);
if (node != null) {
goTo(node);
return true;
} else
return false;
}

| boolean de.mfuchs.xmlstorage.XMLPos.goDown | ( | ) |
Go down to first child.
Definition at line 168 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur, de.mfuchs.xmlstorage.XMLNode.getFirstChild(), and de.mfuchs.xmlstorage.XMLPos.goTo().
Referenced by de.mfuchs.XMLTest.test1(), de.mfuchs.XMLTest.test2Read(), and de.mfuchs.Example1.testRead().
{
XMLNode node = _cur.getFirstChild();
if (node != null) {
goTo(node);
return true;
} else
return false;
}

| void de.mfuchs.xmlstorage.XMLPos.goTo | ( | XMLNode | child ) | [protected] |
Go to the specified node.
| child | new position |
Definition at line 307 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur, and de.mfuchs.xmlstorage.XMLPos._stack.
Referenced by de.mfuchs.xmlstorage.XMLPos.addDown(), de.mfuchs.xmlstorage.XMLPos.go(), de.mfuchs.xmlstorage.XMLPos.goDown(), and de.mfuchs.xmlstorage.XMLPos.smartCreate().
| void de.mfuchs.xmlstorage.XMLPos.put | ( | final String | attrName, |
| final String | value | ||
| ) |
Set an attribute value.
| attrName | attribute name |
| value | new attribute value |
Definition at line 136 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur, and de.mfuchs.xmlstorage.XMLNode.put().
Referenced by de.mfuchs.XMLTest.test3Write(), de.mfuchs.Example3.testWrite(), and de.mfuchs.Example2.testWrite().
{
_cur.put(attrName, value);
}

| void de.mfuchs.xmlstorage.XMLPos.putSubattrib | ( | final String | nodeName, |
| final String | attrName, | ||
| final String | value | ||
| ) |
Set an attribute in a subnode.
| nodeName | node name |
| attrName | attribute name |
| value | attribute value |
Definition at line 319 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur, and de.mfuchs.xmlstorage.XMLNode.putSubattrib().
{
_cur.putSubattrib(nodeName, attrName, value);
}

| void de.mfuchs.xmlstorage.XMLPos.setContent | ( | final String | s, |
| boolean | cdata | ||
| ) |
| s | new content string |
| cdata | write in CDATA format if true |
Definition at line 286 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur, and de.mfuchs.xmlstorage.XMLNode.setContent().
{
_cur.setContent(s, cdata);
}

| void de.mfuchs.xmlstorage.XMLPos.setContent | ( | final String | s ) |
| s | new content string |
Definition at line 277 of file XMLPos.java.
Referenced by de.mfuchs.XMLTest.test2Write(), de.mfuchs.XMLTest.test3Write(), and de.mfuchs.Example1.testWrite().
{
setContent(s, false);
}
| void de.mfuchs.xmlstorage.XMLPos.smartCreate | ( | final String | name ) |
Create node if not already existing and move to it.
| name | name of the new node |
Definition at line 236 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur, de.mfuchs.xmlstorage.XMLPos.addDown(), de.mfuchs.xmlstorage.XMLNode.find(), and de.mfuchs.xmlstorage.XMLPos.goTo().
Referenced by de.mfuchs.xmlstorage.XMLPos.XMLPos().

| void de.mfuchs.xmlstorage.XMLPos.smartCreate | ( | final String | name, |
| final String | attrName, | ||
| final String | attrValue | ||
| ) |
Search matching child node identified by key name and an attribute value.
It it doesn't exist, create it.
| name | name of the new node |
| attrName | attribute name |
| attrValue | attribute value |
Definition at line 253 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur, de.mfuchs.xmlstorage.XMLPos.addDown(), de.mfuchs.xmlstorage.XMLNode.find(), de.mfuchs.xmlstorage.XMLPos.goTo(), and de.mfuchs.xmlstorage.XMLNode.put().
{
XMLNode node = _cur.find(name, attrName, attrValue);
if (node != null)
goTo(node);
else {
node = new XMLNode(name);
addDown(node);
node.put(attrName, attrValue);
}
}

| String de.mfuchs.xmlstorage.XMLPos.toString | ( | ) |
Return the name oif the current node.
Definition at line 294 of file XMLPos.java.
References de.mfuchs.xmlstorage.XMLPos._cur, and de.mfuchs.xmlstorage.XMLNode.toString().
{
return _cur.toString();
}

XMLNode de.mfuchs.xmlstorage.XMLPos._cur [protected] |
Definition at line 300 of file XMLPos.java.
Referenced by de.mfuchs.xmlstorage.XMLPos.addDown(), de.mfuchs.xmlstorage.XMLPos.back(), de.mfuchs.xmlstorage.XMLPos.cur(), de.mfuchs.xmlstorage.XMLPos.get(), de.mfuchs.xmlstorage.XMLPos.getContent(), de.mfuchs.xmlstorage.XMLPos.go(), de.mfuchs.xmlstorage.XMLPos.goDown(), de.mfuchs.xmlstorage.XMLPos.goTo(), de.mfuchs.xmlstorage.XMLPos.put(), de.mfuchs.xmlstorage.XMLPos.putSubattrib(), de.mfuchs.xmlstorage.XMLPos.setContent(), de.mfuchs.xmlstorage.XMLPos.smartCreate(), de.mfuchs.xmlstorage.XMLPos.toString(), and de.mfuchs.xmlstorage.XMLPos.XMLPos().
XMLNode de.mfuchs.xmlstorage.XMLPos._root [protected] |
Definition at line 299 of file XMLPos.java.
Referenced by de.mfuchs.xmlstorage.XMLPos.go(), and de.mfuchs.xmlstorage.XMLPos.XMLPos().
Stack<XMLNode> de.mfuchs.xmlstorage.XMLPos._stack = new Stack<XMLNode>() [protected] |
Definition at line 301 of file XMLPos.java.
Referenced by de.mfuchs.xmlstorage.XMLPos.back(), and de.mfuchs.xmlstorage.XMLPos.goTo().
1.7.2