XML message wrapper is used as a shortcut to create a XMLDoc containing a named XML node. More...


Public Types | |
| enum | WRITE_MODE { FORMAT_SMART, FORMAT_ORIGINAL, FORMAT_PRETTY } |
Public Member Functions | |
| XMLMessage (string name) | |
| Constructs a XMLMessage object. | |
| void | readFile (string path, XmlReaderSettings xmlSettings=null) |
| void | read (TextReader reader, XmlReaderSettings xmlSettings=null) |
| override void | write (TextWriter w) |
| write XML stream preserving previous white space and comments | |
| override void | write (TextWriter w, WRITE_MODE mode) |
| write XML stream | |
| void | write (TextWriter w, WRITE_MODE mode, int indent) |
| Write node with children tree. | |
| void | writeFormating (TextWriter w) |
| write XML stream with formating | |
| void | writeFormating (string path) |
| void | writeFile (string path) |
| void | writeFile (string path, WRITE_MODE mode) |
| override string | getName () |
| override string | ToString () |
| void | clear () |
| void | assign (XMLNode other) |
| void | addChild (XMLNode child) |
| add a new child node | |
| override string | get (string attrName) |
| read only access to an attribute | |
| override string | get (string attrName, string def) |
| read only access to an attribute with default value | |
| void | put (string attrName, string value) |
| Write access to an attribute. | |
| string | getSubattrib (string nodeName, string attrName) |
| convenient value access in children node | |
| string | getSubattrib (string nodeName, string attrName, int n) |
| void | putSubattrib (string nodeName, string attrName, string value) |
| convenient storage of distinct values in children node | |
| void | putSubattrib (string nodeName, string attrName, string value, int n) |
| Children | getChildren () |
| override string | getContent () |
| void | setContent (string s) |
| void | setContent (string s, bool cdata) |
| XMLNode | getFirstChild () |
| XMLNode | find (string nodeName) |
| Find a children node by name. | |
| XMLNode | find (string nodeName, int n) |
| Find the n'th children node with tag nodeName. | |
| XMLNode | find (string nodeName, string attrName, string attrValue) |
| Search matching child node identified by key name and an attribute value. | |
| XMLNode | find (string nodeName, string attrName, string attrValue, int n) |
| Search matching child node identified by key name and an attribute value. | |
| XMLNode | findRelative (XPath xpath) |
| XPath find function. | |
| AbstractXMLNode | createRelative (XPath xpath) |
| relative XPath create function | |
| XMLInt | getInt (string attrName) |
| XMLInt | getInt (string attrName, int def) |
| XMLDecimal | getNumber (string attrName) |
| XMLDecimal | getNumber (string attrName, decimal def) |
| XMLBool | getBool (string attrName) |
| XMLBool | getBool (string attrName, bool def) |
| XMLString | getString (string attrName) |
| XMLString | getString (string attrName, string def) |
| void | setAttributes (XmlReader reader) |
| bool | hasAttributes () |
Public Attributes | |
| XMLHeader | _header = new XMLHeader() |
| string | _leading = "" |
| string | _endLeading = "" |
| string | _trailing = "" |
Static Public Attributes | |
| static string | XML_INDENT_SPACE = " " |
Protected Member Functions | |
| void | writeWorker (TextWriter w, int indent) |
| Write node with children tree using original white space. | |
| void | prettyWriteWorker (TextWriter w, int indent) |
| void | smartWriteWorker (TextWriter w, int indent) |
Protected Attributes | |
| string | _name |
| Children | _children = new Children() |
| Dictionary< string, string > | _attributes = new Dictionary<string, string>() |
Private Attributes | |
| XMLPos | _pos |
XML message wrapper is used as a shortcut to create a XMLDoc containing a named XML node.
Definition at line 46 of file XMLMessage.cs.
enum XMLStorage::XMLNode::WRITE_MODE [inherited] |
Definition at line 239 of file XMLNode.cs.
{
//TODO FORMAT_PLAIN, /// Write XML without any white space
FORMAT_SMART, /// preserve original white space and comments if present; pretty print otherwise
FORMAT_ORIGINAL, /// Write XML stream preserving original white space and comments
FORMAT_PRETTY /// pretty print node to stream without preserving original white space
};
| XMLStorage::XMLMessage::XMLMessage | ( | string | name ) | [inline] |
Constructs a XMLMessage object.
| name | tag name |
Definition at line 52 of file XMLMessage.cs.
References _pos, and XMLStorage::XMLPos::create().

| void XMLStorage::XMLNode::addChild | ( | XMLNode | child ) | [inline, inherited] |
add a new child node
Definition at line 135 of file XMLNode.cs.
References XMLStorage::XMLNode::_children.
Referenced by XMLStorage::XMLPos::addDown(), XMLStorage::XMLNode::createRelative(), and XMLStorage::XMLNode::putSubattrib().
{
_children.AddLast(child);
}
| void XMLStorage::XMLNode::assign | ( | XMLNode | other ) | [inline, inherited] |
Definition at line 122 of file XMLNode.cs.
References XMLStorage::AbstractXMLNode::_attributes, XMLStorage::XMLNode::_children, XMLStorage::AbstractXMLNode::_content, XMLStorage::XMLNode::_endLeading, XMLStorage::XMLNode::_leading, XMLStorage::XMLNode::_trailing, and XMLStorage::XMLNode::Children::assign().
Referenced by XMLStorage::XMLNode::XMLNode().
{
_children.assign(other._children);
_attributes = (Dictionary<string, string>) other._attributes;//@@ .clone();
_leading = other._leading;
_content = other._content;
_endLeading = other._endLeading;
_trailing = other._trailing;
}

| void XMLStorage::XMLNode::clear | ( | ) | [inline, inherited] |
Definition at line 109 of file XMLNode.cs.
References XMLStorage::AbstractXMLNode::_attributes, XMLStorage::XMLNode::_children, XMLStorage::AbstractXMLNode::_content, XMLStorage::XMLNode::_endLeading, XMLStorage::XMLNode::_leading, XMLStorage::XMLNode::_name, and XMLStorage::XMLNode::_trailing.
Referenced by XMLStorage::XMLNode::Children::clear().
{
_leading = "";
_content = "";
_endLeading = "";
_trailing = "";
_attributes.Clear();
_children.Clear();
_name = "";
}
| AbstractXMLNode XMLStorage::XMLNode::createRelative | ( | XPath | xpath ) | [inline, inherited] |
relative XPath create function
Definition at line 363 of file XMLNode.cs.
References XMLStorage::XPathElement::_childName, XMLStorage::XPathElement::_mAttrAndAttr, XMLStorage::XMLNode::addChild(), XMLStorage::XPathElement::find(), XMLStorage::XMLNode::put(), and XMLStorage::XMLNode::XMLNode().
{
XMLNode node = this;
foreach(XPathElement elem in xpath) {
XMLNode child = elem.find(node);
if (child == null) {
child = new XMLNode(elem._childName);
node.addChild(child);
foreach(KeyValuePair<string, string> it in elem._mAttrAndAttr)
put(it.Key, it.Value);
}
node = child;
}
return node;
}

| XMLNode XMLStorage::XMLNode::find | ( | string | nodeName ) | [inline, inherited] |
Find a children node by name.
| nodeName |
Definition at line 287 of file XMLNode.cs.
References XMLStorage::XMLNode::_children, and XMLStorage::XMLNode::_name.
Referenced by XMLStorage::XMLNode::getSubattrib(), and XMLStorage::XMLNode::putSubattrib().
| XMLNode XMLStorage::XMLNode::find | ( | string | nodeName, |
| int | n | ||
| ) | [inline, inherited] |
Find the n'th children node with tag nodeName.
| nodeName | |
| n |
Definition at line 302 of file XMLNode.cs.
References XMLStorage::XMLNode::_children, and XMLStorage::XMLNode::_name.
| XMLNode XMLStorage::XMLNode::find | ( | string | nodeName, |
| string | attrName, | ||
| string | attrValue | ||
| ) | [inline, inherited] |
Search matching child node identified by key name and an attribute value.
| nodeName | |
| attrName | |
| attrValue |
Definition at line 319 of file XMLNode.cs.
References XMLStorage::XMLNode::_children, XMLStorage::XMLNode::_name, and XMLStorage::XMLNode::get().
{
foreach(XMLNode child in _children)
if (child._name==nodeName && child.get(attrName)==attrValue)
return child;
return null;
}

| XMLNode XMLStorage::XMLNode::find | ( | string | nodeName, |
| string | attrName, | ||
| string | attrValue, | ||
| int | n | ||
| ) | [inline, inherited] |
Search matching child node identified by key name and an attribute value.
| nodeName | |
| attrName | |
| attrValue | |
| n |
Definition at line 336 of file XMLNode.cs.
References XMLStorage::XMLNode::_children, XMLStorage::XMLNode::_name, and XMLStorage::XMLNode::get().
{
foreach(XMLNode node in _children)
if (node._name==nodeName && node.get(attrName)==attrValue)
if (n-- == 0)
return node;
return null;
}

XPath find function.
Definition at line 347 of file XMLNode.cs.
References XMLStorage::XPathElement::find().
Referenced by XMLStorage::XMLPos::go().
{
XMLNode node = this;
foreach(XPathElement xelem in xpath)
{
node = xelem.find(node);
if (node == null)
break;
}
return node;
}

| override string XMLStorage::XMLNode::get | ( | string | attrName, |
| string | def | ||
| ) | [inline, virtual, inherited] |
read only access to an attribute with default value
Implements XMLStorage::AbstractXMLNode.
Definition at line 152 of file XMLNode.cs.
References XMLStorage::AbstractXMLNode::_attributes.
{
string found;
if (_attributes.TryGetValue(attrName, out found))
return found;
else
return def;
}
| override string XMLStorage::XMLNode::get | ( | string | attrName ) | [inline, virtual, inherited] |
read only access to an attribute
Implements XMLStorage::AbstractXMLNode.
Definition at line 141 of file XMLNode.cs.
References XMLStorage::AbstractXMLNode::_attributes.
Referenced by XMLStorage::XMLBoolRef::boolValue(), XMLStorage::XMLNumberRef::decimalValue(), XMLStorage::XMLDoubleRef::doubleValue(), XMLStorage::XMLNode::find(), XMLStorage::XMLPos::get(), XMLStorage::XMLStringRef::init(), XMLStorage::XMLIntRef::init(), XMLStorage::XMLDoubleRef::init(), XMLStorage::XMLNumberRef::init(), XMLStorage::XMLBoolRef::init(), XMLStorage::XMLIntRef::intValue(), and XMLStorage::XMLStringRef::ToString().
{
string found;
if (_attributes.TryGetValue(attrName, out found))
return found;
else
return "";
}
| XMLBool XMLStorage::AbstractXMLNode::getBool | ( | string | attrName ) | [inline, inherited] |
Definition at line 85 of file AbstractXMLNode.cs.
{
return new XMLBool(this, attrName);
}
| XMLBool XMLStorage::AbstractXMLNode::getBool | ( | string | attrName, |
| bool | def | ||
| ) | [inline, inherited] |
Definition at line 89 of file AbstractXMLNode.cs.
{
return new XMLBool(this, attrName, def);
}
| Children XMLStorage::XMLNode::getChildren | ( | ) | [inline, inherited] |
Definition at line 219 of file XMLNode.cs.
References XMLStorage::XMLNode::_children.
Referenced by XMLStorage::XMLDocReader::endElement(), XMLStorage::XMLChildrenFilter::filterChildren(), XMLStorage::XPathElement::find(), XMLStorage::XMLDocReader::read(), and XMLStorage::XMLDocReader::startElement().
{
return _children;
}
| override string XMLStorage::XMLNode::getContent | ( | ) | [inline, virtual, inherited] |
Implements XMLStorage::AbstractXMLNode.
Definition at line 224 of file XMLNode.cs.
References XMLStorage::AbstractXMLNode::_content, and XMLStorage::XMLHelper::decodeXMLString().
Referenced by XMLStorage::XMLPos::getContent().
{
return XMLHelper.decodeXMLString(_content);
}

| XMLNode XMLStorage::XMLNode::getFirstChild | ( | ) | [inline, inherited] |
Definition at line 274 of file XMLNode.cs.
References XMLStorage::XMLNode::_children.
Referenced by XMLStorage::XMLPos::goDown().
| XMLInt XMLStorage::AbstractXMLNode::getInt | ( | string | attrName ) | [inline, inherited] |
Definition at line 67 of file AbstractXMLNode.cs.
{
return new XMLInt(this, attrName);
}
| XMLInt XMLStorage::AbstractXMLNode::getInt | ( | string | attrName, |
| int | def | ||
| ) | [inline, inherited] |
Definition at line 71 of file AbstractXMLNode.cs.
{
return new XMLInt(this, attrName, def);
}
| override string XMLStorage::XMLNode::getName | ( | ) | [inline, virtual, inherited] |
Implements XMLStorage::AbstractXMLNode.
Definition at line 69 of file XMLNode.cs.
References XMLStorage::XMLNode::_name.
Referenced by XMLStorage::XMLChildrenFilter::filterChildren().
{
return _name;
}
| XMLDecimal XMLStorage::AbstractXMLNode::getNumber | ( | string | attrName ) | [inline, inherited] |
Definition at line 76 of file AbstractXMLNode.cs.
{
return new XMLDecimal(this, attrName);
}
| XMLDecimal XMLStorage::AbstractXMLNode::getNumber | ( | string | attrName, |
| decimal | def | ||
| ) | [inline, inherited] |
Definition at line 80 of file AbstractXMLNode.cs.
{
return new XMLDecimal(this, attrName, def);
}
| XMLString XMLStorage::AbstractXMLNode::getString | ( | string | attrName, |
| string | def | ||
| ) | [inline, inherited] |
Definition at line 98 of file AbstractXMLNode.cs.
{
return new XMLString(this, attrName, def);
}
| XMLString XMLStorage::AbstractXMLNode::getString | ( | string | attrName ) | [inline, inherited] |
Definition at line 94 of file AbstractXMLNode.cs.
{
return new XMLString(this, attrName);
}
| string XMLStorage::XMLNode::getSubattrib | ( | string | nodeName, |
| string | attrName | ||
| ) | [inline, inherited] |
convenient value access in children node
Definition at line 174 of file XMLNode.cs.
References XMLStorage::XMLNode::find(), and XMLStorage::AbstractXMLNode::get().
{
AbstractXMLNode node = find(nodeName);
if (node != null)
return node.get(attrName);
else
return "";
}

| string XMLStorage::XMLNode::getSubattrib | ( | string | nodeName, |
| string | attrName, | ||
| int | n | ||
| ) | [inline, inherited] |
Definition at line 184 of file XMLNode.cs.
References XMLStorage::XMLNode::find(), and XMLStorage::AbstractXMLNode::get().
{
AbstractXMLNode node = find(nodeName, n);
if (node != null)
return node.get(attrName);
else
return "";
}

| bool XMLStorage::AbstractXMLNode::hasAttributes | ( | ) | [inline, inherited] |
Definition at line 117 of file AbstractXMLNode.cs.
References XMLStorage::AbstractXMLNode::_attributes.
Referenced by XMLStorage::XMLStreamReader::handlePendingEndElement().
{
return _attributes.Count > 0;
}
| void XMLStorage::XMLNode::prettyWriteWorker | ( | TextWriter | w, |
| int | indent | ||
| ) | [inline, protected, inherited] |
Definition at line 428 of file XMLNode.cs.
References XMLStorage::AbstractXMLNode::_attributes, XMLStorage::XMLNode::_children, XMLStorage::AbstractXMLNode::_content, XMLStorage::XMLNode::_name, XMLStorage::XMLHelper::encodeXMLString(), XMLStorage::XMLNode::prettyWriteWorker(), and XMLStorage::XMLNode::XML_INDENT_SPACE.
Referenced by XMLStorage::XMLNode::prettyWriteWorker(), and XMLStorage::XMLNode::write().
{
for(int i=indent; i-->0; )
w.Write(XML_INDENT_SPACE);
w.Write('<');
w.Write(XMLHelper.encodeXMLString(_name));
foreach(KeyValuePair<string,string> it in _attributes) {
string attrValue = it.Value;
if (attrValue != null) {
w.Write(' ');
w.Write(XMLHelper.encodeXMLString(it.Key));
w.Write("=\"");
w.Write(XMLHelper.encodeXMLString(attrValue));
w.Write("\"");
}
}
if (_children.Count>0 || _content.Length>0) {
w.Write(">\n");
foreach(XMLNode child in _children)
child.prettyWriteWorker(w, indent+1);
for(int i=indent; i-->0; )
w.Write(XML_INDENT_SPACE);
w.Write("</");
w.Write(XMLHelper.encodeXMLString(_name));
w.Write(">\n");
} else
w.Write("/>\n");
}

| void XMLStorage::XMLNode::put | ( | string | attrName, |
| string | value | ||
| ) | [inline, inherited] |
Write access to an attribute.
Definition at line 163 of file XMLNode.cs.
References XMLStorage::AbstractXMLNode::_attributes.
Referenced by XMLStorage::XMLStringRef::assign(), XMLStorage::XMLIntRef::assign(), XMLStorage::XMLDoubleRef::assign(), XMLStorage::XMLNumberRef::assign(), XMLStorage::XMLBoolRef::assign(), XMLStorage::XMLNode::createRelative(), XMLStorage::XMLPos::put(), XMLStorage::XMLNode::putSubattrib(), and XMLStorage::XMLPos::smartCreate().
{
try {
_attributes.Add(attrName, value);
} catch(ArgumentException) {
_attributes.Remove(attrName);
_attributes.Add(attrName, value);
}
}
| void XMLStorage::XMLNode::putSubattrib | ( | string | nodeName, |
| string | attrName, | ||
| string | value | ||
| ) | [inline, inherited] |
convenient storage of distinct values in children node
Definition at line 195 of file XMLNode.cs.
References XMLStorage::XMLNode::addChild(), XMLStorage::XMLNode::find(), XMLStorage::XMLNode::put(), and XMLStorage::XMLNode::XMLNode().
Referenced by XMLStorage::XMLPos::putSubattrib().
{
XMLNode node = find(nodeName);
if (node == null) {
node = new XMLNode(nodeName);
addChild(node);
}
node.put(attrName, value);
}

| void XMLStorage::XMLNode::putSubattrib | ( | string | nodeName, |
| string | attrName, | ||
| string | value, | ||
| int | n | ||
| ) | [inline, inherited] |
Definition at line 207 of file XMLNode.cs.
References XMLStorage::XMLNode::addChild(), XMLStorage::XMLNode::find(), XMLStorage::XMLNode::put(), and XMLStorage::XMLNode::XMLNode().
{
XMLNode node = find(nodeName, n);
if (node == null) {
node = new XMLNode(nodeName);
addChild(node);
}
node.put(attrName, value);
}

| void XMLStorage::XMLDoc::read | ( | TextReader | reader, |
| XmlReaderSettings | xmlSettings = null |
||
| ) | [inline, inherited] |
Definition at line 70 of file XMLDoc.cs.
References XMLStorage::XMLHeader::_additional, XMLStorage::XMLDoc::_header, XMLStorage::XMLDocReader::getInstructions(), and XMLStorage::XMLDocReader::read().
Referenced by XMLStorage::XMLDoc::readFile().
{
XMLDocReader docReader = new XMLDocReader(this);
docReader.read(reader, xmlSettings);
_header._additional = docReader.getInstructions();
}

| void XMLStorage::XMLDoc::readFile | ( | string | path, |
| XmlReaderSettings | xmlSettings = null |
||
| ) | [inline, inherited] |
Definition at line 65 of file XMLDoc.cs.
References XMLStorage::XMLDoc::read().
Referenced by Example3::testRead(), Example1::testRead(), and XMLStorage::XMLDoc::XMLDoc().
{
read(new StreamReader(path), xmlSettings);
}

| void XMLStorage::AbstractXMLNode::setAttributes | ( | XmlReader | reader ) | [inline, inherited] |
Definition at line 103 of file AbstractXMLNode.cs.
References XMLStorage::AbstractXMLNode::_attributes.
Referenced by XMLStorage::XMLStreamReader::startElement(), and XMLStorage::XMLDocReader::startElement().
{
while(reader.MoveToNextAttribute()) {
string attrNS = reader.NamespaceURI;
string attrName = reader.Name;
string attrValue = reader.Value;
if (attrNS.Length > 0)
attrName = attrNS + ":" + attrName;
_attributes.Add(attrName, attrValue);
}
}
| void XMLStorage::XMLNode::setContent | ( | string | s, |
| bool | cdata | ||
| ) | [inline, inherited] |
Definition at line 234 of file XMLNode.cs.
References XMLStorage::AbstractXMLNode::_content, and XMLStorage::XMLHelper::encodeXMLString().
{
_content = XMLHelper.encodeXMLString(s, cdata);
}

| void XMLStorage::XMLNode::setContent | ( | string | s ) | [inline, inherited] |
Definition at line 229 of file XMLNode.cs.
Referenced by XMLStorage::XMLPos::setContent().
{
setContent(s, false);
}
| void XMLStorage::XMLNode::smartWriteWorker | ( | TextWriter | w, |
| int | indent | ||
| ) | [inline, protected, inherited] |
Definition at line 464 of file XMLNode.cs.
References XMLStorage::AbstractXMLNode::_attributes, XMLStorage::XMLNode::_children, XMLStorage::AbstractXMLNode::_content, XMLStorage::XMLNode::_endLeading, XMLStorage::XMLNode::_leading, XMLStorage::XMLNode::_name, XMLStorage::XMLNode::_trailing, XMLStorage::XMLHelper::encodeXMLString(), and XMLStorage::XMLNode::XML_INDENT_SPACE.
Referenced by XMLStorage::XMLNode::write().
{
if (_leading.Length == 0)
for(int i=indent; i-->0; )
w.Write(XML_INDENT_SPACE);
else
w.Write(_leading);
w.Write('<');
w.Write(XMLHelper.encodeXMLString(_name));
foreach(KeyValuePair<string,string> it in _attributes) {
string attrValue = it.Value;
if (attrValue != null) {
w.Write(' ');
w.Write(XMLHelper.encodeXMLString(it.Key));
w.Write("=\"");
w.Write(XMLHelper.encodeXMLString(attrValue));
w.Write("\"");
}
}
if (_children.Count==0 && _content.Length==0)
w.Write("/>");
else {
w.Write('>');
if (_content.Length == 0)
w.Write('\n');
else
w.Write(_content);
LinkedListNode<XMLNode> it = _children.First;
if (it != null) {
for( ; it != null; it = it.Next )
it.Value.smartWriteWorker( w, indent + 1 );
if (_endLeading.Length == 0)
for(int i=indent; i-->0; )
w.Write(XML_INDENT_SPACE);
else
w.Write(_endLeading);
} else
w.Write(_endLeading);
w.Write("</");
w.Write(XMLHelper.encodeXMLString(_name));
w.Write('>');
}
if (_trailing.Length == 0)
w.Write('\n');
else
w.Write(_trailing);
}

| override string XMLStorage::XMLNode::ToString | ( | ) | [inline, virtual, inherited] |
Implements XMLStorage::AbstractXMLNode.
Definition at line 74 of file XMLNode.cs.
References XMLStorage::XMLNode::_name.
Referenced by XMLStorage::XMLPos::ToString().
{
return _name;
}
| void XMLStorage::XMLNode::write | ( | TextWriter | w, |
| WRITE_MODE | mode, | ||
| int | indent | ||
| ) | [inline, inherited] |
Write node with children tree.
Definition at line 257 of file XMLNode.cs.
References XMLStorage::XMLNode::prettyWriteWorker(), XMLStorage::XMLNode::smartWriteWorker(), and XMLStorage::XMLNode::writeWorker().
{
switch(mode) {
case WRITE_MODE.FORMAT_PRETTY:
prettyWriteWorker(w, indent);
break;
case WRITE_MODE.FORMAT_ORIGINAL:
writeWorker(w, indent);
break;
default: // FORMAT_SMART
smartWriteWorker(w, indent);
break;
}
}

| override void XMLStorage::XMLDoc::write | ( | TextWriter | w, |
| WRITE_MODE | mode | ||
| ) | [inline, virtual, inherited] |
write XML stream
Reimplemented from XMLStorage::XMLNode.
Definition at line 87 of file XMLDoc.cs.
References XMLStorage::XMLNode::_children, XMLStorage::XMLDoc::_header, and XMLStorage::XMLHeader::print().
{
_header.print(w);//TODO, mode!=FORMAT_PLAIN
if (_children.Count == 1)
_children.First.Value.write(w, mode);
else if (_children.Count > 0)
throw new Exception("more than one XML root entry");
}

| override void XMLStorage::XMLDoc::write | ( | TextWriter | w ) | [inline, virtual, inherited] |
write XML stream preserving previous white space and comments
Reimplemented from XMLStorage::XMLNode.
Definition at line 80 of file XMLDoc.cs.
Referenced by XMLStorage::XMLDoc::writeFile(), and XMLStorage::XMLDoc::writeFormating().
{
write(w, WRITE_MODE.FORMAT_SMART);
}
| void XMLStorage::XMLDoc::writeFile | ( | string | path, |
| WRITE_MODE | mode | ||
| ) | [inline, inherited] |
Definition at line 108 of file XMLDoc.cs.
References XMLStorage::XMLHeader::_encoding, XMLStorage::XMLDoc::_header, and XMLStorage::XMLDoc::write().
{
string encoding = _header._encoding.Length>0? _header._encoding: "UTF-8";
TextWriter w = new StreamWriter(path, false, Encoding.GetEncoding(encoding));
try {
write(w, mode);
} finally {
w.Close();
}
}

| void XMLStorage::XMLDoc::writeFile | ( | string | path ) | [inline, inherited] |
Definition at line 103 of file XMLDoc.cs.
Referenced by Example3::testWrite(), Example2::testWrite(), and Example1::testWrite().
{
writeFile(path, WRITE_MODE.FORMAT_SMART);
}
| void XMLStorage::XMLDoc::writeFormating | ( | TextWriter | w ) | [inline, inherited] |
write XML stream with formating
Definition at line 98 of file XMLDoc.cs.
References XMLStorage::XMLDoc::write().
Referenced by XMLStorage::XMLDoc::writeFormating().
{
write(w, WRITE_MODE.FORMAT_PRETTY);
}

| void XMLStorage::XMLDoc::writeFormating | ( | string | path ) | [inline, inherited] |
Definition at line 121 of file XMLDoc.cs.
References XMLStorage::XMLDoc::writeFormating().
{
TextWriter w = new StreamWriter(path, false, Encoding.UTF8);
try {
writeFormating(w);
} finally {
w.Close();
}
}

| void XMLStorage::XMLNode::writeWorker | ( | TextWriter | w, |
| int | indent | ||
| ) | [inline, protected, inherited] |
Write node with children tree using original white space.
| o | |
| indent |
Definition at line 390 of file XMLNode.cs.
References XMLStorage::AbstractXMLNode::_attributes, XMLStorage::XMLNode::_children, XMLStorage::AbstractXMLNode::_content, XMLStorage::XMLNode::_endLeading, XMLStorage::XMLNode::_leading, XMLStorage::XMLNode::_name, XMLStorage::XMLNode::_trailing, XMLStorage::XMLHelper::encodeXMLString(), and XMLStorage::XMLNode::writeWorker().
Referenced by XMLStorage::XMLNode::write(), and XMLStorage::XMLNode::writeWorker().
{
w.Write(_leading);
w.Write('<');
w.Write(XMLHelper.encodeXMLString(_name));
foreach(KeyValuePair<string,string> it in _attributes) {
string attrValue = it.Value;
if (attrValue != null) {
w.Write(' ');
w.Write(XMLHelper.encodeXMLString(it.Key));
w.Write("=\"");
w.Write(XMLHelper.encodeXMLString(attrValue));
w.Write("\"");
}
}
if (_children.Count>0 || _content.Length>0) {
w.Write('>');
w.Write(_content);
foreach(XMLNode child in _children)
child.writeWorker(w, indent+1);
w.Write(_endLeading);
w.Write("</");
w.Write(XMLHelper.encodeXMLString(_name));
w.Write('>');
} else
w.Write("/>");
w.Write(_trailing);
}

Dictionary<string, string> XMLStorage::AbstractXMLNode::_attributes = new Dictionary<string, string>() [protected, inherited] |
Definition at line 52 of file AbstractXMLNode.cs.
Referenced by XMLStorage::XMLStreamNode::assign(), XMLStorage::XMLNode::assign(), XMLStorage::XMLNode::clear(), XMLStorage::XMLStreamNode::get(), XMLStorage::XMLNode::get(), XMLStorage::AbstractXMLNode::hasAttributes(), XMLStorage::XMLNode::prettyWriteWorker(), XMLStorage::XMLNode::put(), XMLStorage::AbstractXMLNode::setAttributes(), XMLStorage::XMLNode::smartWriteWorker(), and XMLStorage::XMLNode::writeWorker().
Children XMLStorage::XMLNode::_children = new Children() [protected, inherited] |
Definition at line 103 of file XMLNode.cs.
Referenced by XMLStorage::XMLNode::addChild(), XMLStorage::XMLNode::assign(), XMLStorage::XMLNode::clear(), XMLStorage::XMLNode::find(), XMLStorage::XMLNode::getChildren(), XMLStorage::XMLNode::getFirstChild(), XMLStorage::XMLNode::prettyWriteWorker(), XMLStorage::XMLNode::smartWriteWorker(), XMLStorage::XMLDoc::write(), and XMLStorage::XMLNode::writeWorker().
string XMLStorage::XMLNode::_endLeading = "" [inherited] |
Definition at line 106 of file XMLNode.cs.
Referenced by XMLStorage::XMLNode::assign(), XMLStorage::XMLNode::clear(), XMLStorage::XMLDocReader::endElement(), XMLStorage::XMLNode::smartWriteWorker(), and XMLStorage::XMLNode::writeWorker().
XMLHeader XMLStorage::XMLDoc::_header = new XMLHeader() [inherited] |
Definition at line 52 of file XMLDoc.cs.
Referenced by XMLStorage::XMLDoc::read(), XMLStorage::XMLDoc::write(), and XMLStorage::XMLDoc::writeFile().
string XMLStorage::XMLNode::_leading = "" [inherited] |
Definition at line 105 of file XMLNode.cs.
Referenced by XMLStorage::XMLNode::assign(), XMLStorage::XMLNode::clear(), XMLStorage::XMLNode::smartWriteWorker(), XMLStorage::XMLNode::writeWorker(), and XMLStorage::XMLNode::XMLNode().
string XMLStorage::XMLNode::_name [protected, inherited] |
Definition at line 67 of file XMLNode.cs.
Referenced by XMLStorage::XMLNode::clear(), XMLStorage::XMLNode::find(), XMLStorage::XMLNode::getName(), XMLStorage::XMLNode::prettyWriteWorker(), XMLStorage::XMLNode::smartWriteWorker(), XMLStorage::XMLNode::ToString(), XMLStorage::XMLNode::writeWorker(), and XMLStorage::XMLNode::XMLNode().
XMLPos XMLStorage::XMLMessage::_pos [private] |
Definition at line 59 of file XMLMessage.cs.
Referenced by XMLMessage().
string XMLStorage::XMLNode::_trailing = "" [inherited] |
Definition at line 107 of file XMLNode.cs.
Referenced by XMLStorage::XMLNode::assign(), XMLStorage::XMLNode::clear(), XMLStorage::XMLDocReader::read(), XMLStorage::XMLNode::smartWriteWorker(), XMLStorage::XMLDocReader::startElement(), and XMLStorage::XMLNode::writeWorker().
string XMLStorage::XMLNode::XML_INDENT_SPACE = " " [static, inherited] |
Definition at line 426 of file XMLNode.cs.
Referenced by XMLStorage::XMLNode::prettyWriteWorker(), XMLStorage::XMLNode::smartWriteWorker(), XMLStorage::XMLStreamWriter::writePost(), and XMLStorage::XMLStreamWriter::writePre().
1.7.2