PrintDocument.fromXML constructor
PrintDocument.fromXML(
- String xmlSTR
Implementation
factory PrintDocument.fromXML(String xmlSTR) {
final document = XmlDocument.parse(xmlSTR);
List<XmlElement> pdfElements =
document.findAllElements("pdfPrintDocument").toList();
List<XmlElement> textElements =
document.findAllElements("simpleTextPrintDocumentTextNode").toList();
String documentID = document.rootElement.attributes
.firstWhere((p0) => p0.name.toString() == "documentID")
.value;
String stockName = document.rootElement.attributes
.firstWhere((p0) => p0.name.toString() == "stockName")
.value;
List<String> pdfs = pdfElements.map((e) => e.text).toList();
List<DocumentNode> texts =
textElements.map((e) => DocumentNode.fromXML(e.toXmlString())).toList();
// List<TextNode> texts = nodesElements.map((e) => TextNode.fromXML(e.toXmlString())).toList();
return PrintDocument(
pdfs: pdfs,
textDocuments: texts,
documentID: documentID,
stockName: stockName);
}