Skip to content

Extensible Markup Language

Taiizor edited this page Mar 1, 2023 · 3 revisions

XmlExtension Class

The XmlExtension class is a collection of extension methods for XML manipulation. This class contains the following methods:

Methods

public static string ToJson(string Xml = MXXM.Xml, bool Format = MXXM.Format, bool Root = MXXM.Root)

Converts an XML string to a JSON string.

Parameters:

  • Xml (optional): The XML string to convert. Default value is MXXM.Xml.
  • Format (optional): A flag indicating whether the output should be indented or not. Default value is MXXM.Format.
  • Root (optional): A flag indicating whether to include the root element in the output. Default value is MXXM.Root.

Returns:

A JSON string representing the XML document.

Exceptions:

  • E: If an exception occurs while converting the XML to JSON.

public static Task<string> ToJsonAsync(string Xml = MXXM.Xml, bool Format = MXXM.Format, bool Root = MXXM.Root)

Converts an XML string to a JSON string asynchronously.

Parameters:

  • Xml (optional): The XML string to convert. Default value is MXXM.Xml.
  • Format (optional): A flag indicating whether the output should be indented or not. Default value is MXXM.Format.
  • Root (optional): A flag indicating whether to include the root element in the output. Default value is MXXM.Root.

Returns:

A task representing the asynchronous operation that returns a JSON string representing the XML document.

Exceptions:

  • E: If an exception occurs while converting the XML to JSON.

public static string ToBeauty(string Xml = MXXM.Xml)

Beautifies an XML string.

Parameters:

  • Xml (optional): The XML string to beautify. Default value is MXXM.Xml.

Returns:

A beautified XML string.

Exceptions:

  • E: If an exception occurs while beautifying the XML string.

public static Task<string> ToBeautyAsync(string Xml = MXXM.Xml)

Beautifies an XML string asynchronously.

Parameters:

  • Xml (optional): The XML string to beautify. Default value is MXXM.Xml.

Returns:

Clone this wiki locally