Path: redb-route/redb.Route.DataFormats.XmlJson/XmlJsonOptions.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.DataFormats.XmlJson/XmlJsonOptions.cs
----
namespace redb.Route.DataFormats.XmlJson;
/// How element and attribute names carry their XML namespaces in JSON.
public enum XmlJsonNamespaces
{
///
/// Names keep the prefix of the document ("soap:Envelope"), and namespace declarations appear as attributes
/// where the document declares them ("@xmlns:soap": "uri").
///
Keep,
/// Names are local names ("Envelope"), and namespace declarations are left out.
Drop,
}
/// Options of the xmljson data format.
public sealed class XmlJsonOptions
{
///
/// The key of an element's text when the element also has attributes or child elements. Default #text, as
/// Json.NET writes it; $ matches WSO2 Micro Integrator.
///
public string TextKey { get; set; } = "#text";
/// The prefix of an attribute's key. Default @, as Json.NET and WSO2 write it.
public string AttributePrefix { get; set; } = "@";
/// How names carry their namespaces. Default .
public XmlJsonNamespaces Namespaces { get; set; } = XmlJsonNamespaces.Keep;
///
/// Paths of the elements that are always a JSON array, even when the document holds one of them:
/// /Order/Items/Item from the root, //Line at any depth. A step is a local name, or a
/// prefix:name compared with the name as the document writes it.
///
public IList Arrays { get; } = new List();
///
/// The plural-wrapper rule, off by default: a parent named as the English plural of its children's name
/// (Incidents holding only Incident) holds a list, so its children are an array even when there is
/// one. Regular plurals (-s, -es, -ies) and a short list of irregular ones
/// (Children / Child); silent on every other name.
///
public bool Plural { get; set; }
///
/// The root element of JSON to XML. Without it the JSON is an object of one key, and that key is the root; with it
/// the whole JSON is the root's content. A name with a prefix (o:Order) needs the prefix declared by an
/// @xmlns:o key.
///
public string? Root { get; set; }
///
/// Prefixes for the namespaces of JSON to XML by a schema, prefix to namespace URI ("o" = "urn:orders").
/// A namespace the JSON declares with an @xmlns:p key keeps that prefix; one neither declares gets
/// ns0, ns1 and so on. Every declaration goes on the root element.
///
public IDictionary Prefixes { get; } = new Dictionary(StringComparer.Ordinal);
/// Whether the output, JSON or XML, is indented. Default false.
public bool Indent { get; set; }
///
/// Path of the XSD that describes the documents: which elements repeat, the types of values, nillable elements.
/// Its imports and includes are read from files under , never from the network.
///
public string? Schema { get; set; }
///
/// The directory the imports and includes of may read from; a relative one is relative to the
/// schema's own directory (.. for a schema in maindoc/ that imports ../common/). Default: the
/// directory of the schema itself.
///
public string? SchemaRoot { get; set; }
/// A schema set built in code, in place of ; it is compiled when the format first uses it.
public System.Xml.Schema.XmlSchemaSet? SchemaSet { get; set; }
}