XML format with documentToRecord


I receive the following document as a string:

Invalid format
Bad Invoice Number

I then invoke the stringToDocument

Then, when I invoke the documentToRecord service, my document looks like this:

IPP102x IPP205d Invalid format Bad Invoice Number

In my Invoice record definition, my ERROR and ERRORMESSAGE tags are defined as string list.

Is there a way to keep the original format?


Try defining your invoice record like this:

Invoice (record list)
error (string)

This will keep the relationship between error and errormessage intact.

I must really be out of it. The record structure I specified is totally wrong. Working on the correct structure…

Sorry, but my response couldn’t be more wrong. I need to remember to engage the brain for pressing the keys.

If you wish to keep the current XML structure:

  • Using string lists, as you’ve already seen, collects all data for the same tag name into a single list. The order of the entries appears to be preserved. Thus, entry 0 in ERROR corresponds to entry 0 in ERRORMESSAGE and so on. I’m not certain that maintaing entry order is guaranteed so you may want to test thoroughly.

If you can change the XML structure, you may want to consider using:

IPP102x Invalid format IPP205d Bad Invoice Number

Then your record definition would be

Invoice (record)

  • ERROR (record list)
    …- CODE (string)
    …- MESSAGE (string)

and documentToRecord will parse create what you need. Hope this helps.