Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes

XMLStorage::XMLMessage Class Reference

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

Inheritance diagram for XMLStorage::XMLMessage:
Inheritance graph
[legend]
Collaboration diagram for XMLStorage::XMLMessage:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

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.


Member Enumeration Documentation

Enumerator:
FORMAT_SMART 
FORMAT_ORIGINAL 

preserve original white space and comments if present; pretty print otherwise

FORMAT_PRETTY 

Write XML stream preserving original white space and comments.

pretty print node to stream without preserving original white space

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
    };

Constructor & Destructor Documentation

XMLStorage::XMLMessage::XMLMessage ( string  name ) [inline]

Constructs a XMLMessage object.

Parameters:
nametag name

Definition at line 52 of file XMLMessage.cs.

References _pos, and XMLStorage::XMLPos::create().

    {
        _pos = new XMLPos(this);

        _pos.create(name);
    }

Here is the call graph for this function:


Member Function Documentation

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;
    }

Here is the call graph for this function:

void XMLStorage::XMLNode::clear (  ) [inline, inherited]
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;
    }

Here is the call graph for this function:

XMLNode XMLStorage::XMLNode::find ( string  nodeName ) [inline, inherited]

Find a children node by name.

Parameters:
nodeName
Returns:

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().

    {
        foreach(XMLNode child in _children)
            if (child._name == nodeName)
                return child;

        return null;
    }
XMLNode XMLStorage::XMLNode::find ( string  nodeName,
int  n 
) [inline, inherited]

Find the n'th children node with tag nodeName.

Parameters:
nodeName
n
Returns:

Definition at line 302 of file XMLNode.cs.

References XMLStorage::XMLNode::_children, and XMLStorage::XMLNode::_name.

    {
        foreach(XMLNode child in _children)
            if (child._name == nodeName)
                if (n-- == 0)
                    return child;

        return null;
    }
XMLNode XMLStorage::XMLNode::find ( string  nodeName,
string  attrName,
string  attrValue 
) [inline, inherited]

Search matching child node identified by key name and an attribute value.

Parameters:
nodeName
attrName
attrValue
Returns:
XMLNode

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;
    }

Here is the call graph for this function:

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.

Parameters:
nodeName
attrName
attrValue
n
Returns:
XMLNode

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;
    }

Here is the call graph for this function:

XMLNode XMLStorage::XMLNode::findRelative ( XPath  xpath ) [inline, inherited]

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;
    }

Here is the call graph for this function:

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]
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]
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);
    }

Here is the call graph for this function:

XMLNode XMLStorage::XMLNode::getFirstChild (  ) [inline, inherited]

Definition at line 274 of file XMLNode.cs.

References XMLStorage::XMLNode::_children.

Referenced by XMLStorage::XMLPos::goDown().

    {
        if (_children.Count > 0)
            return _children.First.Value;
        else
            return null;
    }
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 "";
    }

Here is the call graph for this function:

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 "";
    }

Here is the call graph for this function:

bool XMLStorage::AbstractXMLNode::hasAttributes (  ) [inline, inherited]
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");
    }

Here is the call graph for this function:

void XMLStorage::XMLNode::put ( string  attrName,
string  value 
) [inline, inherited]
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);
    }

Here is the call graph for this function:

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);
    }

Here is the call graph for this function:

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();
    }

Here is the call graph for this function:

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);
    }

Here is the call graph for this function:

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);
    }

Here is the call graph for this function:

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);
    }

Here is the call graph for this function:

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;
        }
    }

Here is the call graph for this function:

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");
    }

Here is the call graph for this function:

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();
        }
    }

Here is the call graph for this function:

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);
    }

Here is the call graph for this function:

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();
        }
    }

Here is the call graph for this function:

void XMLStorage::XMLNode::writeWorker ( TextWriter  w,
int  indent 
) [inline, protected, inherited]

Write node with children tree using original white space.

Parameters:
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);
    }

Here is the call graph for this function:


Member Data Documentation

Dictionary<string, string> XMLStorage::AbstractXMLNode::_attributes = new Dictionary<string, string>() [protected, inherited]
Children XMLStorage::XMLNode::_children = new Children() [protected, inherited]
string XMLStorage::XMLNode::_endLeading = "" [inherited]
string XMLStorage::XMLNode::_leading = "" [inherited]
string XMLStorage::XMLNode::_name [protected, inherited]

Definition at line 59 of file XMLMessage.cs.

Referenced by XMLMessage().

string XMLStorage::XMLNode::_trailing = "" [inherited]
string XMLStorage::XMLNode::XML_INDENT_SPACE = " " [static, inherited]

The documentation for this class was generated from the following file: