System.Xml.XmlNameTable Class

public abstract class XmlNameTable

Base Types

Object
  XmlNameTable

Assembly

System.Xml

Library

XML

Summary

Creates a table that stores unique instances of String objects.

Description

Only a single instance of any given string is stored even if the string is added multiple times to the table.

Using this class provides an efficient means for an XML parser to use the same String object for all repeated element and attribute names in an XML document. If the same object is used for all repeated names, the efficiency of name comparisons is increased by allowing the names to be compared using object comparisons rather than string comparisons.

[Note: This class is abstract and is implemented in the NameTable class.

]

Example

See the NameTable class for an example using this class.

See Also

System.Xml Namespace

Members

XmlNameTable Constructors

XmlNameTable Constructor

XmlNameTable Methods

XmlNameTable.Add(System.String) Method
XmlNameTable.Add(char[], int, int) Method
XmlNameTable.Get(System.String) Method
XmlNameTable.Get(char[], int, int) Method


XmlNameTable Constructor

protected XmlNameTable();

Summary

Constructs a new instance of the XmlNameTable class.

See Also

System.Xml.XmlNameTable Class, System.Xml Namespace

XmlNameTable.Add(System.String) Method

public abstract string Add(string array);

Summary

Adds the specified String to the table if a String instance with the same value does not already exist in the table.

Parameters

array
The String to add.

Return Value

array, if it did not exist in the table at the time of the call, or the String instance previously stored in the table with a value equal to array.

Exceptions

Exception TypeCondition
ArgumentNullExceptionarray is null .

Description

[Behaviors: Only a single instance of any given String is stored in the table. If the value of array is already stored in the table, the String instance with that value is returned.]

[Overrides: This method must be overridden in order to provide the functionality described above, as there is no default implementation. ]

See Also

System.Xml.XmlNameTable Class, System.Xml Namespace

XmlNameTable.Add(char[], int, int) Method

public abstract string Add(char[] array, int offset, int length);

Summary

Adds the String equivalent of a specified subset of a Char array to the table if the string equivalent does not already exist in the table.

Parameters

array
A Char array containing the string to add.
offset
A Int32 specifying the zero-based index into the array of the first character of the string.
length
A Int32 containing the number of characters in the string.

Return Value

The String equivalent of the specified subset of the Char array that is stored in the table, or System.String.Empty if length is zero.

Exceptions

Exception TypeCondition
IndexOutOfRangeExceptionoffset < 0.

- or -

offset >= array.Length.

- or -

length > array.Length - offset.

The above conditions do not cause an exception to be thrown if length = 0.

ArgumentOutOfRangeExceptionlength < 0.

Description

[Behaviors: Only a single instance of any given String is stored in the table. Calling this method with the same subset (containing the same characters) of any Char array, returns the same instance of the String equivalent.]

[Overrides: This method must be overridden in order to provide the functionality described above, as there is no default implementation. ]

See Also

System.Xml.XmlNameTable Class, System.Xml Namespace

XmlNameTable.Get(System.String) Method

public abstract string Get(string array);

Summary

Looks up the value of the specified String in the table.

Parameters

array
The String to look up.

Return Value

The String instance previously stored in the table with a value equal to array, or null if it does not exist.

Exceptions

Exception TypeCondition
ArgumentNullExceptionarray is null .

Description

[Behaviors: Only a single instance of any given String is stored in the table. If the value of array is already stored in the table, the String instance with that value is returned. ]

[Overrides: This method must be overridden in order to provide the functionality described above, as there is no default implementation. ]

See Also

System.Xml.XmlNameTable Class, System.Xml Namespace

XmlNameTable.Get(char[], int, int) Method

public abstract string Get(char[] array, int offset, int length);

Summary

Looks up the String equivalent of a specified subset of a Char array in the table.

Parameters

array
A Char array containing the string to look up.
offset
A Int32 specifying the zero-based index into the array of the first character of the string.
length
A Int32 containing the number of characters in the string.

Return Value

The String equivalent of the specified subset of the Char array that is stored in the table, or null if the equivalent String is not in the table.

Exceptions

Exception TypeCondition
IndexOutOfRangeExceptionoffset < 0. - or -

offset >= array.Length.

- or -

length > array.Length - offset.

The above conditions do not cause an exception to be thrown if length = 0.

ArgumentOutOfRangeExceptionlength < 0.

Description

[Behaviors: Only a single instance of any given String is stored in the table. Calling this method with the same subset (containing the same characters) of any Char array, returns the same instance of the String equivalent, if it exists. ]

[Overrides: This method must be overridden in order to provide the functionality described above, as there is no default implementation. ]

See Also

System.Xml.XmlNameTable Class, System.Xml Namespace