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.
Afficher le fichier Open project: ikayzo/SDL.NET Class Usage Examples

Méthodes publiques

Méthode 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

Méthode 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 méthode

Add a child to this tag
public AddChild ( Tag child ) : void
child Tag The child to add
Résultat void

AddValue() public méthode

Add a value to this tag
public AddValue ( object value ) : void
value object The value to add
Résultat void

Equals() public méthode

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

GetAttributesForNamespace() public méthode

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

GetChild() public méthode

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
Résultat Tag

GetChild() public méthode

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
Résultat Tag

GetChildren() public méthode

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 ///
Résultat IList

GetChildren() public méthode

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
Résultat IList

GetChildren() public méthode

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
Résultat IList

GetChildrenForNamespace() public méthode

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

GetChildrenForNamespace() public méthode

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
Résultat IList

GetChildrenValues() public méthode

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
Résultat IList

GetHashCode() public méthode

Generates a hashcode using ToString().GetHashCode()
public GetHashCode ( ) : int
Résultat int

Read() public méthode

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
Résultat Tag

ReadFile() public méthode

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
Résultat Tag

ReadString() public méthode

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
Résultat Tag

ReadURL() public méthode

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
Résultat Tag

RemoveChild() public méthode

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

RemoveValue() public méthode

Remove a child from this tag
public RemoveValue ( object value ) : bool
value object
Résultat bool

Tag() public méthode

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
Résultat System

Tag() public méthode

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
Résultat System

ToString() public méthode

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

ToXMLString() public méthode

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

Write() public méthode

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
Résultat void

WriteFile() public méthode

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.
Résultat void

WriteFile() public méthode

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 ///
Résultat void

this() public méthode

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

this() public méthode

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
Résultat object

this() public méthode

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
Résultat object