from_str_secure

Function from_str_secure 

Source
pub fn from_str_secure<'a, T: Deserialize<'a>>(
    xml: &'a str,
    limits: SecurityLimits,
) -> Result<T, SecureParseError>
Expand description

Parse PLCopen XML string with security limits.

This function validates the XML against security limits before parsing to prevent denial-of-service attacks via malicious XML.

§Arguments

  • xml - The XML content to parse
  • limits - Security limits to enforce

§Returns

Returns the parsed structure or an error if validation fails or parsing fails.

§Example

use plcopen::{Project, from_str_secure, security::SecurityLimits};

let xml = std::fs::read_to_string("untrusted.xml")?;
let project = from_str_secure::<Project>(&xml, SecurityLimits::strict())?;