Class XmlExtensions
Contains functionality to map JSON values to XML constructs.
Inheritance
Inherited Members
Namespace: Manatee.Json
Assembly: Manatee.Json.dll
Syntax
public static class XmlExtensions
Methods
| Improve this Doc View SourceToJson(IEnumerable<XElement>)
Converts an System.Xml.Linq.XElement to a JsonObject.
Declaration
public static JsonValue ToJson(this IEnumerable<XElement> xElements)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement> | xElements | A collection of System.Xml.Linq.XElement objects. |
Returns
Type | Description |
---|---|
JsonValue | A single JsonValue which represents the list of System.Xml.Linq.XElement objects. |
Exceptions
Type | Condition |
---|---|
System.Xml.XmlException | Thrown if an error occurs while attempting to convert an array of elements. |
ToJson(XElement)
Converts an System.Xml.Linq.XElement to a JsonObject.
Declaration
public static JsonValue ToJson(this XElement xElement)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.Linq.XElement | xElement | An System.Xml.Linq.XElement. |
Returns
Type | Description |
---|---|
JsonValue | The JsonValue representation of the System.Xml.Linq.XElement. |
ToXElement(JsonValue, String)
Converts a JsonValue to an XElement
Declaration
public static XElement ToXElement(this JsonValue json, string key)
Parameters
Type | Name | Description |
---|---|---|
JsonValue | json | A JsonValue. |
System.String | key | The key to be used as a top-level element name. |
Returns
Type | Description |
---|---|
System.Xml.Linq.XElement | An System.Xml.Linq.XElement representation of the JsonValue. |
Remarks
The 'key' parameter may be null only when the underlying JSON is an object which contains a single key/value pair.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown if |