Better XML Parsing
The universal connectors for FTP, HTTP and Webhooks all support reading an XML file and parsing it into JSON. But they all convert the xml file in a different way
Consider this example xml:
<?xml version="1.0" encoding="UTF-8"?>
<order>
<group1>
<line>value</line>
<line>value</line>
</group1>
<group2>
<line myattrib="test">value</line>
<line>value</line>
</group2>
<group3>
<line>value</line>
</group3>
<group4>
<line myattrib="test">value</line>
</group4>
</order>
- Webhook XML parser parses //group2/line[1] as an object but //group2/line[2] as a text value, making it so the array cannot be handled in an import mapping:
"group2": {
"line": [{
"_": "value",
"$": { "myattrib": "test" }
},
"value"
]
}
- Webhook XML parser does not detect group3 and group4 as arrays:
"group3": {
"line": "value"
}
- HTTP XML parser does recognise arrays, matching FTP Automatic xml parser results but cannot be set to custom parsing.
- FTP custom parser also parses //group2/line[1] as an object and //group2/line[2] as a text value, but parses attributes differently from the webhook parser.
"group2": {
"line": [{
"myattrib": "test",
"&txt": "value"
},
"value"
]
},
Please consider having one xml parsing module that is used for all these connectors, and having that one be configurable so arrays and attributes can be parsed without having to use a javascript hook to repair the parsed data.
4
Comments
Please sign in to leave a comment.