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 (XMLPos other) | |
| Construct an XMLPos as copy of another. | |
| XMLPos (XMLPos other, string nodeName) | |
| Create XML tree iterator positioned at subnode node_name of current other position. | |
| XMLPos (XMLPos other, string nodeName, string attrName, 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 (string attrName) |
| Return the value of an attribute in the current node or "". | |
| string | get (string attrName, string def) |
| Return the value of an attribute in the current node or a default value. | |
| void | put (string attrName, string value) |
| Set an attribute value. | |
| void | addDown (XMLNode child) |
| Insert children when building tree. | |
| bool | back () |
| Go back to previous position. | |
| bool | goDown () |
| Go down to first child. | |
| bool | goDown (string child_name) |
| Search for child and go down. | |
| bool | goDown (string child_name, int child_idx) |
| Search for child and go down. | |
| bool | go (string path) |
| Move X-Path like to position in XML tree. | |
| bool | go (XPath xpath) |
| Move X-Path like to position in XML tree. | |
| void | create (string name) |
| Create node and move to it. | |
| void | smartCreate (string child_name) |
| Create node if not already existing and move to it. | |
| void | smartCreate (string name, string attrName, string attrValue) |
| Search matching child node identified by key name and an attribute value. | |
| string | getContent () |
| void | setContent (string s) |
| void | setContent (string s, bool cdata) |
| override string | ToString () |
| Return the name oif the current node. | |
| void | putSubattrib (string nodeName, string attrName, 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.cs.
| XMLStorage::XMLPos::XMLPos | ( | XMLNode | root ) | [inline] |
| XMLStorage::XMLPos::XMLPos | ( | XMLPos | other ) | [inline] |
| XMLStorage::XMLPos::XMLPos | ( | XMLPos | other, |
| string | nodeName | ||
| ) | [inline] |
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.cs.
References _cur, _root, and smartCreate().
{
_root = other._root;
_cur = other._cur;
// don't copy _stack
smartCreate(nodeName);
}

| XMLStorage::XMLPos::XMLPos | ( | XMLPos | other, |
| string | nodeName, | ||
| string | attrName, | ||
| string | attrValue | ||
| ) | [inline] |
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.cs.
References _cur, _root, and smartCreate().
{
_root = other._root;
_cur = other._cur;
// don't copy _stack
smartCreate(nodeName, attrName, attrValue);
}

| void XMLStorage::XMLPos::addDown | ( | XMLNode | child ) | [inline] |
Insert children when building tree.
| child | new child |
Definition at line 145 of file XMLPos.cs.
References _cur, XMLStorage::XMLNode::addChild(), and goTo().
Referenced by create(), smartCreate(), and XMLStorage::XMLDocReader::startElement().

| bool XMLStorage::XMLPos::back | ( | ) | [inline] |
Go back to previous position.
Definition at line 155 of file XMLPos.cs.
Referenced by XMLStorage::XMLDocReader::endElement(), Example3::testRead(), Example2::testRead(), Example1::testRead(), Example3::testWrite(), Example2::testWrite(), and Example1::testWrite().
| void XMLStorage::XMLPos::create | ( | string | name ) | [inline] |
Create node and move to it.
| name | name of the new node |
Definition at line 238 of file XMLPos.cs.
References addDown().
Referenced by Example3::testWrite(), Example2::testWrite(), Example1::testWrite(), and XMLStorage::XMLMessage::XMLMessage().
{
addDown(new XMLNode(name));
}

| XMLNode XMLStorage::XMLPos::cur | ( | ) | [inline] |
Return the current node.
Definition at line 105 of file XMLPos.cs.
References _cur.
Referenced by XMLStorage::XMLDocReader::endElement(), XMLStorage::XMLChildrenFilter::filterChildren(), XMLStorage::XMLDocReader::read(), XMLStorage::XMLDocReader::startElement(), XMLStorage::XMLBool::XMLBool(), XMLStorage::XMLDecimal::XMLDecimal(), XMLStorage::XMLDouble::XMLDouble(), XMLStorage::XMLDoubleRef::XMLDoubleRef(), XMLStorage::XMLInt::XMLInt(), XMLStorage::XMLIntRef::XMLIntRef(), XMLStorage::XMLString::XMLString(), and XMLStorage::XMLStringRef::XMLStringRef().
{
return _cur;
}
| string XMLStorage::XMLPos::get | ( | string | attrName ) | [inline] |
Return the value of an attribute in the current node or "".
| attrName | attribute name |
Definition at line 115 of file XMLPos.cs.
References _cur, and XMLStorage::XMLNode::get().
Referenced by Example3::testRead(), and Example2::testRead().
{
return _cur.get(attrName);
}

| string XMLStorage::XMLPos::get | ( | string | attrName, |
| string | def | ||
| ) | [inline] |
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.cs.
References _cur, and XMLStorage::XMLNode::get().
{
return _cur.get(attrName, def);
}

| string XMLStorage::XMLPos::getContent | ( | ) | [inline] |
Definition at line 280 of file XMLPos.cs.
References _cur, and XMLStorage::XMLNode::getContent().
Referenced by Example1::testRead().
{
return _cur.getContent();
}

| bool XMLStorage::XMLPos::go | ( | string | path ) | [inline] |
Move X-Path like to position in XML tree.
| path | XPath expression |
Definition at line 211 of file XMLPos.cs.
Referenced by Example3::testRead(), Example2::testRead(), and Example1::testRead().
{
return go(new XPath(path));
}
| bool XMLStorage::XMLPos::go | ( | XPath | xpath ) | [inline] |
Move X-Path like to position in XML tree.
| path | XPath objhect |
Definition at line 221 of file XMLPos.cs.
References XMLStorage::XPath::_absolute, _cur, _root, XMLStorage::XMLNode::findRelative(), and goTo().
{
XMLNode node = xpath._absolute ? _root : _cur;
node = node.findRelative(xpath);
if (node != null) {
goTo(node);
return true;
} else
return false;
}

| bool XMLStorage::XMLPos::goDown | ( | string | child_name ) | [inline] |
| bool XMLStorage::XMLPos::goDown | ( | string | child_name, |
| int | child_idx | ||
| ) | [inline] |
Search for child and go down.
| child_name | node name |
| child_idx | child index |
Definition at line 195 of file XMLPos.cs.
References _cur, XMLStorage::XPathElement::find(), and goTo().
{
XMLNode node = new XPathElement(child_name, child_idx).find(_cur);
if (node != null) {
goTo(node);
return true;
} else
return false;
}

| bool XMLStorage::XMLPos::goDown | ( | ) | [inline] |
Go down to first child.
Definition at line 168 of file XMLPos.cs.
References _cur, XMLStorage::XMLNode::getFirstChild(), and goTo().
Referenced by goDown(), and Example1::testRead().
{
XMLNode node = _cur.getFirstChild();
if (node != null) {
goTo(node);
return true;
} else
return false;
}

| void XMLStorage::XMLPos::goTo | ( | XMLNode | child ) | [inline, protected] |
| void XMLStorage::XMLPos::put | ( | string | attrName, |
| string | value | ||
| ) | [inline] |
Set an attribute value.
| attrName | attribute name |
| value | new attribute value |
Definition at line 136 of file XMLPos.cs.
References _cur, and XMLStorage::XMLNode::put().
Referenced by Example3::testWrite(), and Example2::testWrite().
{
_cur.put(attrName, value);
}

| void XMLStorage::XMLPos::putSubattrib | ( | string | nodeName, |
| string | attrName, | ||
| string | value | ||
| ) | [inline] |
Set an attribute in a subnode.
| nodeName | node name |
| attrName | attribute name |
| value | attribute value |
Definition at line 330 of file XMLPos.cs.
References _cur, and XMLStorage::XMLNode::putSubattrib().
{
_cur.putSubattrib(nodeName, attrName, value);
}

| void XMLStorage::XMLPos::setContent | ( | string | s, |
| bool | cdata | ||
| ) | [inline] |
| s | new content string |
| cdata | write in CDATA format if true |
Definition at line 297 of file XMLPos.cs.
References _cur, and XMLStorage::XMLNode::setContent().
{
_cur.setContent(s, cdata);
}

| void XMLStorage::XMLPos::setContent | ( | string | s ) | [inline] |
| s | new content string |
Definition at line 288 of file XMLPos.cs.
Referenced by Example1::testWrite().
{
setContent(s, false);
}
| void XMLStorage::XMLPos::smartCreate | ( | string | name, |
| string | attrName, | ||
| string | attrValue | ||
| ) | [inline] |
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 264 of file XMLPos.cs.
References _cur, addDown(), XMLStorage::XPathElement::find(), goTo(), and XMLStorage::XMLNode::put().
{
XMLNode node = new XPathElement(name, 0, attrName, attrValue).find(_cur);
if (node != null)
goTo(node);
else {
node = new XMLNode(name);
addDown(node);
node.put(attrName, attrValue);
}
}

| void XMLStorage::XMLPos::smartCreate | ( | string | child_name ) | [inline] |
Create node if not already existing and move to it.
| child_name | name of the new node |
Definition at line 247 of file XMLPos.cs.
References _cur, addDown(), XMLStorage::XPathElement::find(), and goTo().
Referenced by XMLPos().
{
XMLNode node = new XPathElement(child_name).find(_cur);
if (node != null)
goTo(node);
else
addDown(new XMLNode(child_name));
}

| override string XMLStorage::XMLPos::ToString | ( | ) | [inline] |
Return the name oif the current node.
Definition at line 305 of file XMLPos.cs.
References _cur, and XMLStorage::XMLNode::ToString().
{
return _cur.ToString();
}

XMLNode XMLStorage::XMLPos::_cur [protected] |
Definition at line 311 of file XMLPos.cs.
Referenced by addDown(), back(), cur(), get(), getContent(), go(), goDown(), goTo(), put(), putSubattrib(), setContent(), smartCreate(), ToString(), and XMLPos().
XMLNode XMLStorage::XMLPos::_root [protected] |
Stack<XMLNode> XMLStorage::XMLPos::_stack = new Stack<XMLNode>() [protected] |
1.7.2