Skip to main content

xml_to_json_with_depth_limit

Function xml_to_json_with_depth_limit 

Source
pub fn xml_to_json_with_depth_limit(
    input: &str,
    max_depth: usize,
) -> Result<Value, CamelError>
Expand description

Convert XML to JSON with an explicit maximum nesting depth.

xml_to_json calls this with DEFAULT_MAX_XML_DEPTH. This is pub so XmlDataFormat can call it with a configurable depth per ADR-0033.

§DocType handling (R3-L3)

Unlike validate_xml, this function does not reject <!DOCTYPE ...>. The two have different contracts: validate_xml is a security gate that refuses DOCTYPE outright, while xml_to_json is a converter that swallows DOCTYPE via the catch-all _ => {} arm and only honors quick-xml’s predefined entity set (no external entity resolution, no DTD evaluation). This is intentional and not exploitable: quick-xml does not fetch external entities, and the result tree carries no DOCTYPE content.