public abstract class XmlNameTable
Object
XmlNameTable
System.Xml
XML
Creates a table that stores unique instances of String objects.
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.]
See the NameTable class for an example using this class.
System.Xml Namespace
XmlNameTable Constructors
XmlNameTable Methods
XmlNameTable.Add(System.String) Method
XmlNameTable.Add(char[], int, int) Method
XmlNameTable.Get(System.String) Method
XmlNameTable.Get(char[], int, int) Method
protected XmlNameTable();
Constructs a new instance of the XmlNameTable class.
System.Xml.XmlNameTable Class, System.Xml Namespace
public abstract string Add(string array);
Adds the specified String to the table if a String instance with the same value does not already exist in the table.
- array
- The String to add.
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.
Exception Type Condition ArgumentNullException array is null
.
[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. ]
System.Xml.XmlNameTable Class, System.Xml Namespace
public abstract string Add(char[] array, int offset, int length);
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.
- 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.
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.
Exception Type Condition IndexOutOfRangeException offset < 0. - or -
offset >= array.Length.
- or -
length > array.Length - offset.
The above conditions do not cause an exception to be thrown if length = 0.
ArgumentOutOfRangeException length < 0.
[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. ]
System.Xml.XmlNameTable Class, System.Xml Namespace
public abstract string Get(string array);
Looks up the value of the specified String in the table.
- array
- The String to look up.
The String instance previously stored in the table with a value equal to array, ornull
if it does not exist.
Exception Type Condition ArgumentNullException array is null
.
[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. ]
System.Xml.XmlNameTable Class, System.Xml Namespace
public abstract string Get(char[] array, int offset, int length);
Looks up the String equivalent of a specified subset of a Char array in the table.
- 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.
The String equivalent of the specified subset of the Char array that is stored in the table, ornull
if the equivalent String is not in the table.
Exception Type Condition IndexOutOfRangeException offset < 0. - or - offset >= array.Length.
- or -
length > array.Length - offset.
The above conditions do not cause an exception to be thrown if length = 0.
ArgumentOutOfRangeException length < 0.
[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. ]
System.Xml.XmlNameTable Class, System.Xml Namespace