Forum Discussion

matt_bostrom's avatar
matt_bostrom
New Contributor II
9 years ago

XML Parsing To Get Values

Hello I am receiving some XML in the following structure/format and want SnapLogic to convert each row to a document with the attributes as the value. So here is the sample of the XML coming in from a DB query where it is stored:

When I tag on the XML Formatter and Parser it doesn’t seem to break it down for me with the retrievable values:

2 Replies

  • del's avatar
    del
    Contributor III

    If you don’t need additional fields from the database other than the invoice XML, I think your solution would be to replace the XML Formatter snap with a Document to Binary snap and make sure your mapper maps the XML field name to “$content”

    Example:

    • If Get Invoices has a statement like “Select invoiceXML from InvoiceTable”
    • The Mapper would map $invoiceXML to $content
    • The Document to Binary snap would have encoding set to “None”
    • XML Parser should then produce your expected results
    • matt_bostrom's avatar
      matt_bostrom
      New Contributor II

      YES! that is perfect and it works for me. Thank you Del.