XmlUtil

From auWiki
Jump to: navigation, search

C# class that provides static functions for working with XML.

Namespace

au.util.io

Hierarchy
  • System.Object
    • au.util.io.XmlUtil

Usage

Public Methods

XMLEncode

static string XMLEncode(string s)

Encode a string to work with HTML or XML.

  • s = String to encode.
  • @return = Encoded string.

AddElement

static XmlElement AddElement(XmlNode parent, string name, object innerText)

static XmlElement AddElement(XmlNode parent, string name, string innerText)

static XmlElement AddElement(XmlNode parent, string name)

Add a new XML element as a child of another node.

  • parent = Node to add new element under.
  • name = Name of new element.
  • innerText = Text to add with new element.
  • @return = New element.

AddAttribute

static XmlAttribute AddAttribute(XmlElement el, string name, object val)

static XmlAttribute AddAttribute(XmlElement el, string name, string val)

Add an attribute to an XML element

  • el = XML Element to add an attribute to.
  • name = Name of attribute to add.
  • val = Value of attribute to add.
  • @return = New attribute.