C# Class Ikayzo.SDL.Tag

SDL documents are composed of tags. A tag is composed of a name and optionally a value list, attribute list, and child list. Tags and attributes may specify namespaces.
Datei anzeigen Open project: ikayzo/SDL.NET Class Usage Examples

Public Methods

Method Description
AddChild ( Tag child ) : void

Add a child to this tag

AddValue ( object value ) : void

Add a value to this tag

Equals ( object obj ) : bool

Tests for equality using ToString()

GetAttributesForNamespace ( string sdlNamespace ) : object>.IDictionary

Returns all attributes in the given namespace.

GetChild ( string childName ) : Tag

Get the first child with the given name. The search is not recursive.

GetChild ( string childName, bool recursive ) : Tag

Get the first child with the given name, optionally using a recursive search.

GetChildren ( bool recursively ) : IList

Get all the children of this tag optionally recursing through all descendents.

GetChildren ( string childName ) : IList

Get all children with the given name. The search is not recursive.

GetChildren ( string childName, bool recursive ) : IList

Get all the children with the given name (optionally searching descendants recursively)

GetChildrenForNamespace ( string sdlNamespace ) : IList

Get all children in the given namespace. The search is not recursive.

GetChildrenForNamespace ( string sdlNamespace, bool recursive ) : IList

Get all the children in the given namespace (optionally searching descendants recursively)

GetChildrenValues ( String name ) : IList

Get the values for all children with the given name. If the child has more than one value, all the values will be added as a list. If the child has no value, null will be added. The search is not recursive.

GetHashCode ( ) : int

Generates a hashcode using ToString().GetHashCode()

Read ( TextReader reader ) : Tag

Add all the tags specified in the given Reader to this Tag.

ReadFile ( String file ) : Tag

Add all the tags specified in the given file to this Tag.

ReadString ( String text ) : Tag

Add all the tags specified in the given String to this Tag.

ReadURL ( String url ) : Tag

Add all the tags specified in the file at the given URL to this Tag.

RemoveChild ( Tag child ) : bool

Remove a child from this tag

RemoveValue ( object value ) : bool

Remove a child from this tag

Tag ( string name ) : System

Create an empty tag with a name and no namespace

Tag ( string sdlNamespace, string name ) : System

Create a tag with the given namespace and name

ToString ( ) : string

Produces a full SDL "dump" of this tag. The output is valid SDL.

ToXMLString ( ) : string

Returns a string containing an XML representation of this tag. Values will be represented using _val0, _val1, etc.

Write ( TextWriter writer, bool includeRoot ) : void

Write this tag out to the given writer (optionally clipping the root.)

WriteFile ( string file ) : void

Write this tag out to the given file.

WriteFile ( string file, bool includeRoot ) : void

Write this tag out to the given file (optionally clipping the root.)

this ( int index ) : object

An indexer for the tag's values

this ( string key ) : object

An indexer for the tag's attributes. This indexer sets the attribute's namespace to an empty string ("")

this ( string sdlNamespace, string key ) : object

Set the key to the given value and sets the namespace.

Private Methods

Method Description
ToString ( String linePrefix ) : string

Produces a full SDL "dump" of this tag using the given prefix before each line.

ToXMLString ( string linePrefix ) : String

Returns a string containing an XML representation of this tag. Values will be represented using _val0, _val1, etc.

Method Details

AddChild() public method

Add a child to this tag
public AddChild ( Tag child ) : void
child Tag The child to add
return void

AddValue() public method

Add a value to this tag
public AddValue ( object value ) : void
value object The value to add
return void

Equals() public method

Tests for equality using ToString()
public Equals ( object obj ) : bool
obj object The object to test
return bool

GetAttributesForNamespace() public method

Returns all attributes in the given namespace.
public GetAttributesForNamespace ( string sdlNamespace ) : object>.IDictionary
sdlNamespace string The namespace to search
return object>.IDictionary

GetChild() public method

Get the first child with the given name. The search is not recursive.
public GetChild ( string childName ) : Tag
childName string The name of the child Tag
return Tag

GetChild() public method

Get the first child with the given name, optionally using a recursive search.
public GetChild ( string childName, bool recursive ) : Tag
childName string The name of the child Tag
recursive bool If the search should be recursive
return Tag

GetChildren() public method

Get all the children of this tag optionally recursing through all descendents.
public GetChildren ( bool recursively ) : IList
recursively bool If true, recurse through all descendents ///
return IList

GetChildren() public method

Get all children with the given name. The search is not recursive.
public GetChildren ( string childName ) : IList
childName string The name of the children to fetch
return IList

GetChildren() public method

Get all the children with the given name (optionally searching descendants recursively)
public GetChildren ( string childName, bool recursive ) : IList
childName string The name of the children to fetch
recursive bool If true search all descendents
return IList

GetChildrenForNamespace() public method

Get all children in the given namespace. The search is not recursive.
public GetChildrenForNamespace ( string sdlNamespace ) : IList
sdlNamespace string
return IList

GetChildrenForNamespace() public method

Get all the children in the given namespace (optionally searching descendants recursively)
public GetChildrenForNamespace ( string sdlNamespace, bool recursive ) : IList
sdlNamespace string The namespace of the children to /// fetch
recursive bool If true search all descendents
return IList

GetChildrenValues() public method

Get the values for all children with the given name. If the child has more than one value, all the values will be added as a list. If the child has no value, null will be added. The search is not recursive.
public GetChildrenValues ( String name ) : IList
name String The name of the children from which values are /// retrieved
return IList

GetHashCode() public method

Generates a hashcode using ToString().GetHashCode()
public GetHashCode ( ) : int
return int

Read() public method

Add all the tags specified in the given Reader to this Tag.
If there is an IO problem /// while reading the source If the SDL input is malformed ///
public Read ( TextReader reader ) : Tag
reader TextReader A reader containing SDL source
return Tag

ReadFile() public method

Add all the tags specified in the given file to this Tag.
If there is an IO problem /// while reading the source If the SDL input is malformed ///
public ReadFile ( String file ) : Tag
file String A UTF8 encoded .sdl file
return Tag

ReadString() public method

Add all the tags specified in the given String to this Tag.
If the SDL input is malformed ///
public ReadString ( String text ) : Tag
text String An SDL string
return Tag

ReadURL() public method

Add all the tags specified in the file at the given URL to this Tag.
If there is an IO problem /// while reading the source If the SDL input is malformed ///
public ReadURL ( String url ) : Tag
url String url A UTF8 encoded .sdl file
return Tag

RemoveChild() public method

Remove a child from this tag
public RemoveChild ( Tag child ) : bool
child Tag The child to remove
return bool

RemoveValue() public method

Remove a child from this tag
public RemoveValue ( object value ) : bool
value object
return bool

Tag() public method

Create an empty tag with a name and no namespace
If the name is not /// a valid SDL identifier
public Tag ( string name ) : System
name string The name of this tag
return System

Tag() public method

Create a tag with the given namespace and name
If name is not /// a valid SDL identifier or sdlNamespace is not empty and is /// not a valid SDL identifier
public Tag ( string sdlNamespace, string name ) : System
sdlNamespace string The namespace for this tag. null will /// be coerced to the empty string("")
name string The name for this tag
return System

ToString() public method

Produces a full SDL "dump" of this tag. The output is valid SDL.
public ToString ( ) : string
return string

ToXMLString() public method

Returns a string containing an XML representation of this tag. Values will be represented using _val0, _val1, etc.
public ToXMLString ( ) : string
return string

Write() public method

Write this tag out to the given writer (optionally clipping the root.)
If there is an IO problem during the /// write operation
public Write ( TextWriter writer, bool includeRoot ) : void
writer System.IO.TextWriter The writer to which we will write this tag ///
includeRoot bool If true this tag will be written out as /// the root element, if false only the children will be written
return void

WriteFile() public method

Write this tag out to the given file.
If there is an IO problem during the /// write operation
public WriteFile ( string file ) : void
file string The file path to which we will write the children /// of this tag.
return void

WriteFile() public method

Write this tag out to the given file (optionally clipping the root.)
If there is an IO problem during the /// write operation
public WriteFile ( string file, bool includeRoot ) : void
file string The file path to which we will write this tag ///
includeRoot bool If true this tag will be included in the /// file as the root element, if false only the children will be written ///
return void

this() public method

An indexer for the tag's values
public this ( int index ) : object
index int The index to get or set
return object

this() public method

An indexer for the tag's attributes. This indexer sets the attribute's namespace to an empty string ("")
public this ( string key ) : object
key string The key for this attribute
return object

this() public method

Set the key to the given value and sets the namespace.
public this ( string sdlNamespace, string key ) : object
sdlNamespace string The namespace for this attribute
key string The key for this attribute
return object