XML¶
Serialization and parsing helpers for invoice XML.
Serialize¶
Serialize to XML
Convert invoice types to XML.
ToXml::to_xml(&self) -> Result<String, InvoiceXmlError>
ToXml::to_xml_with_format(&self, format: XmlFormat) -> Result<String, InvoiceXmlError>
SignedInvoice::xml(&self) -> &str
FinalizedInvoice.xml() -> str
SignedInvoice.xml() -> str
FfiResult_FfiString fatoora_invoice_to_xml(FfiFinalizedInvoice* invoice);
FfiResult_FfiString fatoora_signed_invoice_xml(FfiSignedInvoice* signed);
Args
format: compact or pretty XML format (Rust).invoice/signed: invoice handles.
Returns
string: XML string.
Parse¶
Parse from XML
Parse XML into invoice handles.
parse_finalized_invoice_xml(xml: &str) -> Result<FinalizedInvoice, ParseError>
parse_finalized_invoice_xml_file(path: impl AsRef<Path>) -> Result<FinalizedInvoice, ParseError>
parse_signed_invoice_xml(xml: &str) -> Result<SignedInvoice, ParseError>
parse_signed_invoice_xml_file(path: impl AsRef<Path>) -> Result<SignedInvoice, ParseError>
parse_finalized_invoice_xml(xml: str) -> FinalizedInvoice
parse_finalized_invoice_xml_file(path: str) -> FinalizedInvoice
parse_signed_invoice_xml(xml: str) -> SignedInvoice
parse_signed_invoice_xml_file(path: str) -> SignedInvoice
FfiResult_FfiFinalizedInvoice fatoora_parse_finalized_invoice_xml(const char* xml);
FfiResult_FfiFinalizedInvoice fatoora_parse_finalized_invoice_xml_file(const char* path);
FfiResult_FfiSignedInvoice fatoora_parse_signed_invoice_xml(const char* xml);
FfiResult_FfiSignedInvoice fatoora_parse_signed_invoice_xml_file(const char* path);
Args
xml: XML string.path: path to XML file.
Returns
FinalizedInvoice/SignedInvoice: parsed invoice handles.
Types¶
InvoiceXml<T>wraps an InvoiceView for serialization.InvoiceXmlErrorreports serialization failures.ParseErrorreports XML parsing failures and missing/invalid fields.
See also: Validation Guide