Struct quickxml_to_serde::Config
source · pub struct Config {
pub leading_zero_as_string: bool,
pub xml_attr_prefix: String,
pub xml_text_node_prop_name: String,
pub empty_element_handling: NullValue,
}
Expand description
Tells the converter how to perform certain conversions. See docs for individual fields for more info.
Fields§
§leading_zero_as_string: bool
Numeric values starting with 0 will be treated as strings.
E.g. convert <agent>007</agent>
into "agent":"007"
or "agent":7
Defaults to false
.
xml_attr_prefix: String
Prefix XML attribute names with this value to distinguish them from XML elements.
E.g. set it to @
for <x a="Hello!" />
to become {"x": {"@a":"Hello!"}}
or set it to a blank string for {"x": {"a":"Hello!"}}
Defaults to @
.
xml_text_node_prop_name: String
A property name for XML text nodes.
E.g. set it to text
for <x a="Hello!">Goodbye!</x>
to become {"x": {"@a":"Hello!", "text":"Goodbye!"}}
XML nodes with text only and no attributes or no child elements are converted into JSON properties with the
name of the element. E.g. <x>Goodbye!</x>
becomes {"x":"Goodbye!"}
Defaults to #text
empty_element_handling: NullValue
Defines how empty elements like <x />
should be handled.
Implementations§
source§impl Config
impl Config
sourcepub fn new_with_defaults() -> Self
pub fn new_with_defaults() -> Self
Numbers with leading zero will be treated as numbers.
Prefix XML Attribute names with @
Name XML text nodes #text
for XML Elements with other children