parse_interface

Function parse_interface 

Source
pub fn parse_interface(xml: &str) -> Result<Interface, Error>
Expand description

Parse the XML file into a Rust struct

§Arguments

  • xml - The XML file as a string

§Returns

  • Result<Interface, serde_xml_rs::Error> - The parsed interface or an error

§Example

let xml = r#"<?xml version="1.0" encoding="UTF-8"?>
<interface name="HeartbeatAPING" owner="BDP" version="1.0.0" date="now()" namespace="com.betfair.heartbeat.api"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <description>Heartbeat</description>
    <operation name="heartbeat" since="1.0.0">
        <description>...</description>
        <parameters>...</parameters>
    </operation>
</interface>"#;

let interface: Interface = xml.into();

§Errors

  • serde_xml_rs::Error - If the XML file is not valid