Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Xml.​XmlAttribute
Assembly: System.Xml.ReaderWriter
Inheritance: object → XmlNode → XmlAttribute
Implemented Interfaces
- Collections.​IEnumerable Implemented by: XmlNode
- ICloneable Implemented by: XmlNode
- IXPathNavigable Implemented by: XmlNode
Represents an attribute. Valid and default values for the attribute are defined in a document type definition (DTD) or schema.
Properties
public
string
BaseURI
Gets the base Uniform Resource Identifier (URI) of the node.
public
string
InnerText
Sets the concatenated values of the node and all its children.
public
string
InnerXml
Sets the value of the attribute.
public
string
LocalName
Gets the local name of the node.
public
string
Name
Gets the qualified name of the node.
public
string
NamespaceURI
Gets the namespace URI of this node.
public
XmlNodeType
NodeType
Gets the type of the current node.
public
XmlDocument
OwnerDocument
Gets the <see cref="T:System.Xml.XmlDocument" /> to which this node belongs.
public
XmlElement
OwnerElement
Gets the <see cref="T:System.Xml.XmlElement" /> to which the attribute belongs.
public
XmlNode
ParentNode
Gets the parent of this node. For <see langword="XmlAttribute" /> nodes, this property always returns <see langword="null" /> .
public
string
Prefix
Gets or sets the namespace prefix of this node.
public
IXmlSchemaInfo
SchemaInfo
Gets the post-schema-validation-infoset that has been assigned to this node as a result of schema validation.
public
bool
Specified
Gets a value indicating whether the attribute value was explicitly set.
public
string
Value
Gets or sets the value of the node.
public
XmlAttributeCollection
Attributes
Gets an <see cref="T:System.Xml.XmlAttributeCollection" /> containing the attributes of this node.
public
XmlNodeList
ChildNodes
Gets all the child nodes of the node.
public
XmlNode
FirstChild
Gets the first child of the node.
public
bool
HasChildNodes
Gets a value indicating whether this node has any child nodes.
public
string
InnerText
Gets or sets the concatenated values of the node and all its child nodes.
public
string
InnerXml
Gets or sets the markup representing only the child nodes of this node.
public
bool
IsReadOnly
Gets a value indicating whether the node is read-only.
public
XmlElement
Item
public
XmlElement
Item
public
XmlNode
LastChild
Gets the last child of the node.
public
XmlNode
NextSibling
Gets the node immediately following this node.
public
string
OuterXml
Gets the markup containing this node and all its child nodes.
public
XmlNode
PreviousSibling
Gets the node immediately preceding this node.
public
XmlNode
PreviousText
Gets the text node that immediately precedes this node.
Methods
public
XmlNode
AppendChild​(XmlNode newChild)
Adds the specified node to the end of the list of child nodes, of this node.
Returns The <see cref="T:System.Xml.XmlNode" /> added.
newChild
The <see cref="T:System.Xml.XmlNode" /> to add.
Returns The duplicate node.
deep
<see langword="true" /> to recursively clone the subtree under the specified node; <see langword="false" /> to clone only the node itself.
public
XmlNode
InsertAfter​(XmlNode newChild,
XmlNode refChild)
Inserts the specified node immediately after the specified reference node.
Returns The <see cref="T:System.Xml.XmlNode" /> inserted.
newChild
The <see cref="T:System.Xml.XmlNode" /> to insert.
refChild
The <see cref="T:System.Xml.XmlNode" /> that is the reference node. The <paramref name="newChild" /> is placed after the <paramref name="refChild" /> .
public
XmlNode
InsertBefore​(XmlNode newChild,
XmlNode refChild)
Inserts the specified node immediately before the specified reference node.
Returns The <see cref="T:System.Xml.XmlNode" /> inserted.
newChild
The <see cref="T:System.Xml.XmlNode" /> to insert.
refChild
The <see cref="T:System.Xml.XmlNode" /> that is the reference node. The <paramref name="newChild" /> is placed before this node.
public
XmlNode
PrependChild​(XmlNode newChild)
Adds the specified node to the beginning of the list of child nodes for this node.
Returns The <see cref="T:System.Xml.XmlNode" /> added.
newChild
The <see cref="T:System.Xml.XmlNode" /> to add. If it is an <see cref="T:System.Xml.XmlDocumentFragment" /> , the entire contents of the document fragment are moved into the child list of this node.
Returns The <see cref="T:System.Xml.XmlNode" /> removed.
oldChild
The <see cref="T:System.Xml.XmlNode" /> to remove.
public
XmlNode
ReplaceChild​(XmlNode newChild,
XmlNode oldChild)
Replaces the child node specified with the new child node specified.
Returns The <see cref="T:System.Xml.XmlNode" /> replaced.
newChild
The new child <see cref="T:System.Xml.XmlNode" /> .
oldChild
The <see cref="T:System.Xml.XmlNode" /> to replace.
public
void
WriteContentTo​(XmlWriter w)
Saves all the children of the node to the specified <see cref="T:System.Xml.XmlWriter" /> .
w
The <see langword="XmlWriter" /> to which you want to save.
public
void
WriteTo​(XmlWriter w)
Saves the node to the specified <see cref="T:System.Xml.XmlWriter" /> .
w
The <see langword="XmlWriter" /> to which you want to save.
Returns The cloned node.
public
XPathNavigator
CreateNavigator​()
Inherited from XmlNode
Creates an <see cref="T:System.Xml.XPath.XPathNavigator" /> for navigating this object.
Returns An <see langword="XPathNavigator" /> object used to navigate the node. The <see langword="XPathNavigator" /> is positioned on the node from which the method was called. It is not positioned on the root of the document.
GetEnumerator​()
Inherited from XmlNode
Gets an enumerator that iterates through the child nodes in the current node.
Returns An <see cref="T:System.Collections.IEnumerator" /> object that can be used to iterate through the child nodes in the current node.
public
string
GetNamespaceOfPrefix​(string prefix)
Inherited from XmlNode
Looks up the closest xmlns declaration for the given prefix that is in scope for the current node and returns the namespace URI in the declaration.
Returns The namespace URI of the specified prefix.
prefix
The prefix whose namespace URI you want to find.
public
string
GetPrefixOfNamespace​(string namespaceURI)
Inherited from XmlNode
Looks up the closest xmlns declaration for the given namespace URI that is in scope for the current node and returns the prefix defined in that declaration.
Returns The prefix for the specified namespace URI.
namespaceURI
The namespace URI whose prefix you want to find.
public
void
Normalize​()
Inherited from XmlNode
Puts all XmlText nodes in the full depth of the sub-tree underneath this XmlNode into a "normal" form where only markup (that is, tags, comments, processing instructions, CDATA sections, and entity references) separates XmlText nodes, that is, there are no adjacent XmlText nodes.
public
void
RemoveAll​()
Inherited from XmlNode
Removes all the child nodes and/or attributes of the current node.
public
XmlNodeList
SelectNodes​(string xpath)
Inherited from XmlNode
Selects a list of nodes matching the XPath expression.
Returns An <see cref="T:System.Xml.XmlNodeList" /> containing a collection of nodes matching the XPath query.
xpath
The XPath expression.
public
XmlNodeList
SelectNodes​(string xpath,
XmlNamespaceManager nsmgr)
Inherited from XmlNode
Selects a list of nodes matching the XPath expression. Any prefixes found in the XPath expression are resolved using the supplied <see cref="T:System.Xml.XmlNamespaceManager" /> .
Returns An <see cref="T:System.Xml.XmlNodeList" /> containing a collection of nodes matching the XPath query.
xpath
The XPath expression. See XPath Examples.
nsmgr
An <see cref="T:System.Xml.XmlNamespaceManager" /> to use for resolving namespaces for prefixes in the XPath expression.
public
XmlNode
SelectSingleNode​(string xpath)
Inherited from XmlNode
Selects the first <see langword="XmlNode" /> that matches the XPath expression.
Returns The first <see langword="XmlNode" /> that matches the XPath query or <see langword="null" /> if no matching node is found.
xpath
The XPath expression. See XPath Examples.
public
XmlNode
SelectSingleNode​(string xpath,
XmlNamespaceManager nsmgr)
Inherited from XmlNode
Selects the first <see langword="XmlNode" /> that matches the XPath expression. Any prefixes found in the XPath expression are resolved using the supplied <see cref="T:System.Xml.XmlNamespaceManager" /> .
Returns The first <see langword="XmlNode" /> that matches the XPath query or <see langword="null" /> if no matching node is found.
xpath
The XPath expression. See XPath Examples.
nsmgr
An <see cref="T:System.Xml.XmlNamespaceManager" /> to use for resolving namespaces for prefixes in the XPath expression.
public
bool
Supports​(string feature,
string version)
Inherited from XmlNode
Tests if the DOM implementation implements a specific feature.
Returns <see langword="true" /> if the feature is implemented in the specified version; otherwise, <see langword="false" /> . The following table describes the combinations that return <see langword="true" /> .
<list type="table">
<listheader>
<term> Feature</term>
<description> Version</description>
</listheader>
<item>
<term> XML</term>
<description> 1.0</description>
</item>
<item>
<term> XML</term>
<description> 2.0</description>
</item>
</list>
feature
The package name of the feature to test. This name is not case-sensitive.
version
The version number of the package name to test. If the version is not specified (null), supporting any version of the feature causes the method to return true.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object