XmlElementConverter class

Estimated reading time: 3 minutes

Provides methods for converting between XmlElement objects and their string, boolean, and child element representations.

Namespace: ASNA.DataGate.Common Assembly: ASNA.QSys.DataGate.Client.dll

Inheritance: Object

Constructors

Name Description
XmlElementConverter(XmlNode, ISchemaElementName) Initializes a new instance of the class with the specified XML container and element name.
XmlElementConverter(XmlNode, XmlElement, ISchemaElementName) Initializes a new instance of the class with the specified XML container, XML element, and element name.

Properties

Type Name Description
XmlDocument Doc Gets the XmlDocument that the current XmlElement belongs to.
XmlElement Element Gets or sets the XmlElement that is being converted.
ISchemaElementName ElementName Gets the name of the current XmlElement.
XmlNode Parent Gets the parent XmlNode of the current XmlElement.
String XsdFalse Represents the string “false” in XSD format.
String XsdTrue Represents the string “true” in XSD format.

Methods

Signature Description
CreateElement(Boolean) Creates a new XmlElement with the specified name and appends it to the parent node.
GetAttribute(String) Gets the value of the attribute with the specified name from the current XmlElement.
GetAttribute(String, Object) Gets the value of the attribute with the specified name from the current XmlElement. If the attribute does not exist, returns the specified default value.
GetChildCount(String, String) Gets the number of child elements of the current XmlElement with the specified name and namespace.
GetChildren(String, String) Gets all child elements of the current XmlElement with the specified name and namespace.
GetChildrenOrThrow(String, String) Gets all child elements of the current XmlElement with the specified name and namespace. If the current element is null, throws an InvalidOperationException.
GetDocumentOrThrow() Gets the XmlDocument that the current XmlElement belongs to. If the document is null, throws an InvalidOperationException.
GetElementOrThrow() Gets the XmlElement that is being converted. If the element is null, throws an InvalidOperationException.
GetElementText() Gets the text of the current XmlElement.
GetElementText(XmlElement) Gets the text of the specified XmlElement.
GetFirstElement() Gets the first child element of the parent node that matches the specified element name and namespace. The element is stored in the Element property of this class.
GetParentOrThrow() Gets the parent XmlNode of the current XmlElement. If the parent is null, throws an InvalidOperationException.
GetXsdBool(Boolean) Converts a boolean value to its equivalent string representation in XSD format.
GetXsdBooleanAttribute(String, Boolean) Gets the value of the attribute with the specified name from the current XmlElement and converts it to a boolean. If the attribute does not exist, returns the specified default value.
HasAttribute(String) Determines whether the current XmlElement has an attribute with the specified name.
SetAttribute(String, Object) Sets the value of the attribute with the specified name in the current XmlElement.
SetElementName(ISchemaElementName) Sets the name of the current XmlElement to the specified value.
SetElementText(String) Sets the text of the current XmlElement to the specified value.