Class XmlUtils

String utility class that provides a host of string related operations

System.Object
  Westwind.Utilities.XmlUtils
public static class XmlUtils : object

Class Members

MemberDescription

CreateXmlNamespaceManager

Creates an Xml NamespaceManager for an XML document by looking at all of the namespaces defined on the document root element.

public static XmlNamespaceManager CreateXmlNamespaceManager(XmlDocument doc,     string defaultNamespace)

GetXmlAttributeBool

Returns an bool value from an attribute

public static bool? GetXmlAttributeBool(XmlNode node,     string attributeName)

GetXmlAttributeInt

Returns an integer value from an attribute

public static int GetXmlAttributeInt(XmlNode node,     string attributeName,     int defaultValue)

GetXmlAttributeString

Gets an attribute by name

public static string GetXmlAttributeString(XmlNode node,     string attributeName)

GetXmlBool

Retrieves a result bool from an XPATH query. false if not found.

public static bool GetXmlBool(XmlNode node,     string xPath,     XmlNamespaceManager ns)

GetXmlDateTime

Retrieves a result DateTime from an XPATH query. 1/1/1900 if not found.

public static DateTime GetXmlDateTime(XmlNode node,     string xPath,     XmlNamespaceManager ns)

GetXmlDecimal

Retrieves a result decimal value from an XPATH query. 0 if not found.

public static decimal GetXmlDecimal(XmlNode node,     string XPath,     XmlNamespaceManager ns)

GetXmlEnum

Gets an Enum value from an xml node. Returns enum type value. Either flag or string based keys will work

public static T GetXmlEnum(XmlNode node,     string xPath,     XmlNamespaceManager ns)

GetXmlInt

Retrieves a result int value from an XPATH query. 0 if not found.

public static int GetXmlInt(XmlNode node,     string XPath,     XmlNamespaceManager ns)

GetXmlNode

Retrieves a result string from an XPATH query. Null if not found.

public static XmlNode GetXmlNode(XmlNode node,     string xPath,     XmlNamespaceManager ns)

GetXmlString

Retrieves a result string from an XPATH query. Null if not found.

public static string GetXmlString(XmlNode node,     string xPath,     XmlNamespaceManager ns)

MapTypeToXmlType

Converts a .NET type into an XML compatible type - roughly

public static string MapTypeToXmlType(Type type)

MapXmlTypeToType

public static Type MapXmlTypeToType(string xmlType)

XmlString

Turns a string into a properly XML Encoded string. Uses simple string replacement.

Also see XmlUtils.XmlString() which uses XElement to handle additional extended characters.

public static string XmlString(string text,     bool isAttribute)

Requirements

Namespace: Westwind.Utilities
Assembly: westwind.utilities.dll

© West Wind Technologies, 1996-2020 • Updated: 07/15/20
Comment or report problem with topic