Show / Hide Table of Contents

Class XmlExtensions

Contains extension methods for xml readers and writers.

Inheritance
System.Object
XmlExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: System.Dynamic.ExpandoObject
Assembly: cs.temp.dll.dll
Syntax
public static class XmlExtensions

Methods

GetAttributeBool(XmlReader, String)

Reads a boolean attribute.

Declaration
public static bool ? GetAttributeBool(this XmlReader reader, string name)
Parameters
XmlReader reader

System.String name

Returns
System.Nullable<System.Boolean>

GetAttributeDateTime(XmlReader, String)

Reads a datetime attribute.

Declaration
public static DateTime? GetAttributeDateTime(this XmlReader reader, string name)
Parameters
XmlReader reader

System.String name

Returns
System.Nullable<System.DateTime>

GetAttributeDouble(XmlReader, String)

Reads a double attribute.

Declaration
public static double ? GetAttributeDouble(this XmlReader reader, string name)
Parameters
XmlReader reader

System.String name

Returns
System.Nullable<System.Double>

GetAttributeEnum<T>(XmlReader, String)

Reads an enum attribute.

Declaration
public static T? GetAttributeEnum<T>(this XmlReader reader, string name)where T : struct
Parameters
XmlReader reader

System.String name

Returns
System.Nullable<T>

Type Parameters
T

GetAttributeInt32(XmlReader, String)

Reads an Int32 attribute.

Declaration
public static int ? GetAttributeInt32(this XmlReader reader, string name)
Parameters
XmlReader reader

System.String name

Returns
System.Nullable<System.Int32>

GetAttributeInt64(XmlReader, String)

Reads an Int64 attribute.

Declaration
public static long ? GetAttributeInt64(this XmlReader reader, string name)
Parameters
XmlReader reader

System.String name

Returns
System.Nullable<System.Int64>

GetAttributeSingle(XmlReader, String)

Reads a single attribute.

Declaration
public static float ? GetAttributeSingle(this XmlReader reader, string name)
Parameters
XmlReader reader

System.String name

Returns
System.Nullable<System.Single>

GetElements(XmlReader, Dictionary<String, Action>)

Gets elements using the given actions.

Declaration
public static void GetElements(this XmlReader reader, Dictionary<string, Action> getElements)
Parameters
XmlReader reader

Dictionary<System.String, System.Action> getElements

GetElements(XmlReader, Tuple<String, Action>[])

Gets elements using the given actions.

Declaration
public static void GetElements(this XmlReader reader, params Tuple<string, Action>[] getElements)
Parameters
XmlReader reader

System.Tuple<System.String, System.Action>[] getElements

ReadElementContentAsEnum<T>(XmlReader)

Reads the current element content and returns the contents as an enum.

Declaration
public static T? ReadElementContentAsEnum<T>(this XmlReader reader)where T : struct
Parameters
XmlReader reader

Returns
System.Nullable<T>

Type Parameters
T

SerializeToXml<T>(T)

Serializes to xml with default settings for OSM-related entities.

Declaration
public static string SerializeToXml<T>(this T value)
Parameters
T value

Returns
System.String

Type Parameters
T

WriteAttribute(XmlWriter, String, Nullable<Boolean>)

Writes a bool as an attribute.

Declaration
public static void WriteAttribute(this XmlWriter writer, string name, bool ? value)
Parameters
XmlWriter writer

System.String name

System.Nullable<System.Boolean> value

WriteAttribute(XmlWriter, String, Nullable<DateTime>)

Writes a datetime as an attribute.

Declaration
public static void WriteAttribute(this XmlWriter writer, string name, DateTime? value)
Parameters
XmlWriter writer

System.String name

System.Nullable<System.DateTime> value

WriteAttribute(XmlWriter, String, Nullable<Double>)

Writes a double as an attribute.

Declaration
public static void WriteAttribute(this XmlWriter writer, string name, double ? value)
Parameters
XmlWriter writer

System.String name

System.Nullable<System.Double> value

WriteAttribute(XmlWriter, String, Nullable<Int32>)

Writes an Int32 as an attribute.

Declaration
public static void WriteAttribute(this XmlWriter writer, string name, int ? value)
Parameters
XmlWriter writer

System.String name

System.Nullable<System.Int32> value

WriteAttribute(XmlWriter, String, Nullable<Int64>)

Writes an Int64 as an attribute.

Declaration
public static void WriteAttribute(this XmlWriter writer, string name, long ? value)
Parameters
XmlWriter writer

System.String name

System.Nullable<System.Int64> value

WriteAttribute(XmlWriter, String, Nullable<Single>)

Writes a single as an attribute.

Declaration
public static void WriteAttribute(this XmlWriter writer, string name, float ? value)
Parameters
XmlWriter writer

System.String name

System.Nullable<System.Single> value

WriteAttribute(XmlWriter, String, String)

Writes a string as an attribute.

Declaration
public static void WriteAttribute(this XmlWriter writer, string name, string value)
Parameters
XmlWriter writer

System.String name

System.String value

WriteElement(XmlWriter, String, IXmlSerializable)

Writes an xml serializable object as an element.

Declaration
public static void WriteElement(this XmlWriter writer, string name, IXmlSerializable xmlSerializable)
Parameters
XmlWriter writer

System.String name

IXmlSerializable xmlSerializable

WriteElements(XmlWriter, String, IXmlSerializable[])

Writes an xml serializable object as an element.

Declaration
public static void WriteElements(this XmlWriter writer, string name, IXmlSerializable[] xmlSerializables)
Parameters
XmlWriter writer

System.String name

IXmlSerializable[] xmlSerializables

WriteStartAndEndElementWithContent(XmlWriter, String, String)

Writes a xml start [Name] element, then the string content, then an end element.

Declaration
public static void WriteStartAndEndElementWithContent(this XmlWriter writer, string name, string content)
Parameters
XmlWriter writer

System.String name

System.String content

Back to top Built by Itinero, MIT licensed.