C# Класс GSF.Xml.XmlExtensions

Defines extension functions related to Xml elements.
Показать файл Открыть проект

Открытые методы

Метод Описание
ApplyXSLTransform ( this document, string transform ) : string

Transforms an XML document using the given XSL template.

Format ( this element ) : object

Formats the contents of an XML element and returns the result.

The format to be used is determined by the type and spec attributes of the element. The type attribute should be the fully qualified type name of an IFormattable type. The spec attribute defines the format string to be used when formatting the contents. If type or spec are not defined or if type resovles to a type that is not IFormattable, the contents are not formatted and are returned as-is.

GetAttributeValue ( this node, string name ) : string

Safely gets or sets an XML node's attribute.

If you get an attribute that does not exist, null will be returned.

GetDataSet ( this xmlData ) : DataSet

Gets a data set object from an XML data set formatted as a String.

GetXmlNode ( this xmlDoc, string xpath ) : XmlNode

Gets an XML node from given path, creating the entire path if it does not exist.

This overload just allows the start of the given XML document by using its root element.

GetXmlNode ( this xmlDoc, string xpath, bool &isDirty ) : XmlNode

Gets an XML node from given path, creating the entire path if it does not exist.

This overload just allows the start of the given XML document by using its root element.

Note that the isDirty parameter will be set to True if any items were added to the tree.

SetAttributeValue ( this node, string name, string value ) : void

Safely sets an XML node's attribute.

If you assign a value to an attribute that does not exist, the attribute will be created.

Приватные методы

Метод Описание
TransformAll ( this document, System.Xml.Linq.XName name, Func selector ) : void
TransformAll ( this document, System.Xml.Linq.XName name, object>.Func selector ) : void

Описание методов

ApplyXSLTransform() публичный статический Метод

Transforms an XML document using the given XSL template.
public static ApplyXSLTransform ( this document, string transform ) : string
document this The document to be transformed.
transform string The template that defines how the data should be transformed.
Результат string

Format() публичный статический Метод

Formats the contents of an XML element and returns the result.
The format to be used is determined by the type and spec attributes of the element. The type attribute should be the fully qualified type name of an IFormattable type. The spec attribute defines the format string to be used when formatting the contents. If type or spec are not defined or if type resovles to a type that is not IFormattable, the contents are not formatted and are returned as-is.
public static Format ( this element ) : object
element this The elements whose contents are to be formatted.
Результат object

GetAttributeValue() публичный статический Метод

Safely gets or sets an XML node's attribute.
If you get an attribute that does not exist, null will be returned.
public static GetAttributeValue ( this node, string name ) : string
node this A to query.
name string A name of the value to get.
Результат string

GetDataSet() публичный статический Метод

Gets a data set object from an XML data set formatted as a String.
public static GetDataSet ( this xmlData ) : DataSet
xmlData this XML data string in standard DataSet format.
Результат System.Data.DataSet

GetXmlNode() публичный статический Метод

Gets an XML node from given path, creating the entire path if it does not exist.
This overload just allows the start of the given XML document by using its root element.
public static GetXmlNode ( this xmlDoc, string xpath ) : XmlNode
xmlDoc this An to query.
xpath string A xpath query.
Результат System.Xml.XmlNode

GetXmlNode() публичный статический Метод

Gets an XML node from given path, creating the entire path if it does not exist.

This overload just allows the start of the given XML document by using its root element.

Note that the isDirty parameter will be set to True if any items were added to the tree.

public static GetXmlNode ( this xmlDoc, string xpath, bool &isDirty ) : XmlNode
xmlDoc this An to query.
xpath string A xpath query.
isDirty bool A value indicating if items were added to the tree.
Результат System.Xml.XmlNode

SetAttributeValue() публичный статический Метод

Safely sets an XML node's attribute.
If you assign a value to an attribute that does not exist, the attribute will be created.
public static SetAttributeValue ( this node, string name, string value ) : void
node this An node to operate on.
name string A indicating the node name to use.
value string A value to set the node attribute's value to.
Результат void