I all,
I have an XML with a TAG "Attachment" that contains a binary file (in my case a PDF), part of xml is:
<tag1>
<tag2>
<subtag1>123</subtag1>
<AttachmentType>PDF</AttachmentType>
<Attachment>JVBERi0xLjQKJeLjz9MKMiAwIG9iagpbL1BERi9UZXh0L0ltYWdlQi9JbWFnZUMvSW1hZ2VJXQpl
bmRvYmoKNCAwIG9iago8PC9GaWx0ZXIvRmxhdGVEZWNvZGUvTGVuZ3RoIDE1NzQ+PnN0cmVhbQp4
2pVZy47jNhC8z1fouHtYWCIp0QIGBoIEAeaQBzK5BXvQgxoYyMiGx3OYv4+trra7DI4XWWCXS1l8
[...]
</Attachment>
</tag2>
</tag1>
I can read everything with units laz2_XMLRead e laz2_DOM, but I don't know how to save the binary data.
My approach is:
TForm1 = class(TForm)
[...]
private
Attachment: TFileStream;
public
end;
[...]
Attachment:= TFileStream.Create('myfile.pdf',fmCreate);
Attachment.WriteAnsiString(AttachmentXML.ChildNodes[0].NodeValue); //where AttachmentXML is a TDOMNode (filled right)
Attachment.Free;
[...]
This code generates a file with the text in Attachment, not a binary readable from a PDF reader...
This XML works with other integrated software, at work. I need to manage a lot of xml files, so I need to develop a sw to extract data and binary pdf automatically.
Thank you!