Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :
03/24/2008
Times viewed :
392
The System.Xml.XmlElement Class
Supported Versions
.NET Framework 1.0, 1.1, 1.2
Public Members
Bold members are covered in the sample code.
Public Properties
Public Methods
Attributes
AppendChild
BaseURI
Clone
ChildNodes
CloneNode
FirstChild
CreateNavigator
HasAttributes
Equals
HasChildNodes
GetAttribute
InnerText
GetAttributeNode
InnerXml
GetElementsByTagName
IsEmpty
GetEnumerator
IsReadOnly
GetHashCode
LastChild
GetNamespaceOfPrefix
LocalName
GetPrefixOfNamespace
Name
GetType
NamespaceURI
HasAttribute
NextSibling
InsertAfter
NodeType
InsertBefore
OuterXml
Normalize
OwnerDocument
PrependChild
ParentNode
RemoveAll
Prefix
RemoveAllAttributes
PreviousSibling
RemoveAttribute
Value
RemoveAttributeAt
RemoveAttributeNode
RemoveChild
ReplaceChild
SelectNodes
SelectSingleNode
SetAttribute
SetAttributeNode
Supports
ToString
WriteContentTo
WriteTo
Overview
Another core part of the System.Xml class library, the XmlElement
class represents element nodes within XML documents. It contains many important
methods, including a variety of Get, Insert, and Remove methods used to
manipulate the structure and content of XmlDocument objects.
Example (VB.NET): Two
ways to loop through an XML document's XmlElement nodes.
In the example below we demonstrate how to step through the
contents of an XML document in order to extract XmlElement node information.
The first For Each construct loops through the
XmlDocument.DocumentElement.ChildNodes collection and looks for any nodes that
are XmlElements. It then displays properties of each element. The second For
Each construct does the same, except that this time we look for all nodes
within the ChildNodes collection, and then test each node to determine whether
it is of type “Element”, prior to displaying its properties.
Dim objDocument As New System.Xml.XmlDocument
Dim objElement As System.Xml.XmlElement
Dim objXmlNodeList As System.Xml.XmlNodeList
Dim objXmlNode As System.Xml.XmlNode
Dim strValues As String
objDocument.LoadXml("<sampleElement1><sampleElement2>We
are demonstrating XML.</sampleElement2></sampleElement1>")