pub fn parse(document: &str) -> Result<EposRequest, DialectError>Expand description
Parses a request: a SOAP envelope with an epos-print body, or a bare epos-print
document. Elements and attribute values the manual does not define are an error, which
the endpoint answers as SchemaError.
use hardless_http_dialects::epos;
let req = epos::parse(r#"<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body>
<epos-print xmlns="http://www.epson-pos.com/schemas/2011/03/epos-print">
<text align="center">Hello </text><cut type="feed"/>
</epos-print></s:Body></s:Envelope>"#).unwrap();
assert_eq!(req.print.escpos, b"\x1b@\x1ba\x01Hello\n\x1dVB\x00");