C# Class SimpleFramework.Xml.Stream.OutputElement

The OutputElement object represents an XML element. Attributes can be added to this before ant child element has been acquired from it. Once a child element has been acquired the attributes will be written an can no longer be manipulated, the same applies to any text value set for the element.
Inheritance: OutputNode
Mostra file Open project: ngallagher/simplexml Class Usage Examples

Public Methods

Method Description
Commit ( ) : void

This will commit this element and any uncommitted elements elements that are decendents of this node. For instance if any child or grand child remains open under this element then those elements will be closed before this is closed.

GetChild ( String name ) : OutputNode

This is used to create a child element within the element that this object represents. When a new child is created with this method then the previous child is committed to the document. The created OutputNode object can be used to add attributes to the child element as well as other elements.

GetPrefix ( ) : String

This is used to acquire the prefix for this output node. This will search its parent nodes until the prefix that is currently in scope is found. If a prefix is not found in the parent nodes then a prefix in the current nodes namespace mappings is searched, failing that the prefix returned is null.

GetPrefix ( bool inherit ) : String
IsCommitted ( ) : bool

This is used to determine whether this node has been committed. If the node is committed then no further child elements can be created from this node instance. A node is considered to be committed if a parent creates another child element or if the commit method is invoked.

IsRoot ( ) : bool
OutputElement ( OutputNode parent, NodeWriter writer, String name ) : System

Constructor for the OutputElement object. This is used to create an output element that can create elements for an XML document. This requires the writer that is used to generate the actual document and the name of this node.

Remove ( ) : void

This is used to remove any uncommitted changes. Removal of an output node can only be done if it has no siblings and has not yet been committed. If the node is committed then this will throw an exception to indicate that it cannot be removed.

SetAttribute ( String name, String value ) : OutputNode
ToString ( ) : String

This is the string representation of the element. It is used for debugging purposes. When evaluating the element the to string can be used to print out the element name.

Method Details

Commit() public method

This will commit this element and any uncommitted elements elements that are decendents of this node. For instance if any child or grand child remains open under this element then those elements will be closed before this is closed.
public Commit ( ) : void
return void

GetChild() public method

This is used to create a child element within the element that this object represents. When a new child is created with this method then the previous child is committed to the document. The created OutputNode object can be used to add attributes to the child element as well as other elements.
public GetChild ( String name ) : OutputNode
name String /// this is the name of the child element to create ///
return OutputNode

GetPrefix() public method

This is used to acquire the prefix for this output node. This will search its parent nodes until the prefix that is currently in scope is found. If a prefix is not found in the parent nodes then a prefix in the current nodes namespace mappings is searched, failing that the prefix returned is null.
public GetPrefix ( ) : String
return String

GetPrefix() public method

public GetPrefix ( bool inherit ) : String
inherit bool /// if there is no explicit prefix then inherit ///
return String

IsCommitted() public method

This is used to determine whether this node has been committed. If the node is committed then no further child elements can be created from this node instance. A node is considered to be committed if a parent creates another child element or if the commit method is invoked.
public IsCommitted ( ) : bool
return bool

IsRoot() public method

public IsRoot ( ) : bool
return bool

OutputElement() public method

Constructor for the OutputElement object. This is used to create an output element that can create elements for an XML document. This requires the writer that is used to generate the actual document and the name of this node.
public OutputElement ( OutputNode parent, NodeWriter writer, String name ) : System
parent OutputNode /// this is the parent node to this output node ///
writer NodeWriter /// this is the writer used to generate the file ///
name String /// this is the name of the element this represents ///
return System

Remove() public method

This is used to remove any uncommitted changes. Removal of an output node can only be done if it has no siblings and has not yet been committed. If the node is committed then this will throw an exception to indicate that it cannot be removed.
public Remove ( ) : void
return void

SetAttribute() public method

public SetAttribute ( String name, String value ) : OutputNode
name String /// this is the name of the attribute to be added ///
value String /// this is the value of the node to be added ///
return OutputNode

ToString() public method

This is the string representation of the element. It is used for debugging purposes. When evaluating the element the to string can be used to print out the element name.
public ToString ( ) : String
return String