C# Class erminas.SmartAPI.Utils.XmlUtil

显示文件 Open project: erminas/smartapi

Public Methods

Method Description
AddAttribute ( this xmlElement, string attributeName, string value ) : void

Creates an attribute via the owner document of xmlElement , sets its value and appends it to .

AddElement ( this node, string name ) : XmlElement

Creates an XmlElement and appends it as child to the XmlNode

GetAttributeValue ( this xmlElement, string attributeName ) : string

Gets the value of an attribute. If the attribute does not exists, null is returned.

GetBoolAttributeValue ( this xmlElement, string attributeName ) : bool?
GetDoubleAttributeValue ( this xmlElement, string attributeName ) : double?
GetGuid ( this xmlElement ) : System.Guid
GetGuid ( this xmlElement, String attributeName ) : System.Guid
GetIntAttributeValue ( this xmlElement, string attributeName ) : int?
GetName ( this xmlElement ) : string
GetOADate ( this element, string attributeName = "date" ) : DateTime?
GetSingleElement ( this doc, string tagName ) : XmlElement
IsAttributeSet ( this xmlElement, ISessionObject session, string attributeName ) : bool
IsContainingOk ( this xmlDoc ) : bool
NodeToString ( this xmlElement ) : string

Creates a string representation of an XmlNode

SetAttributeValue ( this xmlElement, string attributeName, string value ) : void

Sets an attribute to a value. If no fitting XmlAttribute exists, a new one is created/appended and its value set.

ToOADate ( this value ) : System.DateTime
TryGetGuid ( this xmlElement, System.Guid &guid ) : bool
TryGetGuid ( this xmlElement, string attributeName, System.Guid &guid ) : bool

Method Details

AddAttribute() public static method

Creates an attribute via the owner document of xmlElement , sets its value and appends it to .
public static AddAttribute ( this xmlElement, string attributeName, string value ) : void
xmlElement this The node, the attribute gets added to
attributeName string Name of the attribute
value string Value of the attribute
return void

AddElement() public static method

Creates an XmlElement and appends it as child to the XmlNode
public static AddElement ( this node, string name ) : XmlElement
node this The parent node
name string Name of the newly created element
return System.Xml.XmlElement

GetAttributeValue() public static method

Gets the value of an attribute. If the attribute does not exists, null is returned.
public static GetAttributeValue ( this xmlElement, string attributeName ) : string
xmlElement this The node
attributeName string Name of the attribute
return string

GetBoolAttributeValue() public static method

public static GetBoolAttributeValue ( this xmlElement, string attributeName ) : bool?
xmlElement this
attributeName string
return bool?

GetDoubleAttributeValue() public static method

public static GetDoubleAttributeValue ( this xmlElement, string attributeName ) : double?
xmlElement this
attributeName string
return double?

GetGuid() public static method

public static GetGuid ( this xmlElement ) : System.Guid
xmlElement this
return System.Guid

GetGuid() public static method

public static GetGuid ( this xmlElement, String attributeName ) : System.Guid
xmlElement this
attributeName String
return System.Guid

GetIntAttributeValue() public static method

public static GetIntAttributeValue ( this xmlElement, string attributeName ) : int?
xmlElement this
attributeName string
return int?

GetName() public static method

public static GetName ( this xmlElement ) : string
xmlElement this
return string

GetOADate() public static method

public static GetOADate ( this element, string attributeName = "date" ) : DateTime?
element this
attributeName string
return DateTime?

GetSingleElement() public static method

public static GetSingleElement ( this doc, string tagName ) : XmlElement
doc this
tagName string
return System.Xml.XmlElement

IsAttributeSet() public static method

public static IsAttributeSet ( this xmlElement, ISessionObject session, string attributeName ) : bool
xmlElement this
session ISessionObject
attributeName string
return bool

IsContainingOk() public static method

public static IsContainingOk ( this xmlDoc ) : bool
xmlDoc this
return bool

NodeToString() public static method

Creates a string representation of an XmlNode
public static NodeToString ( this xmlElement ) : string
xmlElement this The node
return string

SetAttributeValue() public static method

Sets an attribute to a value. If no fitting XmlAttribute exists, a new one is created/appended and its value set.
public static SetAttributeValue ( this xmlElement, string attributeName, string value ) : void
xmlElement this The node
attributeName string Name of the attribute
value string Value to set the attribute to
return void

ToOADate() public static method

public static ToOADate ( this value ) : System.DateTime
value this
return System.DateTime

TryGetGuid() public static method

public static TryGetGuid ( this xmlElement, System.Guid &guid ) : bool
xmlElement this
guid System.Guid
return bool

TryGetGuid() public static method

public static TryGetGuid ( this xmlElement, string attributeName, System.Guid &guid ) : bool
xmlElement this
attributeName string
guid System.Guid
return bool