Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
I am interested in utilize the XML to Infotable Snippet but I am having difficulties in utilize the same. Could you guys from Thingworx please provide a detailed example of the use of this snippet?
thanks
Richard
Did you look at the examples under Support/Examples?
Hi Pai
I am ok with the procedure to comsume XML. What I want to understand is how to utilize the FromXML Snippet that is labelled XML to Infotable. I havent found any reference to this one in the examples, except a basic syntax.
cheers
Richard
Hi Richard,
The FromXML snippet works to convert an XML to an Infotable if inside the XML there is a DataShape declared, together with a complete field definition. So, it will work when processing XML coming from ThingWorx REST API with the "accept=text/xml", as it has that DataShape fully defined.
If it doesn't find the DataShape definition, no infotable is generated, exactly as in the case of FromJSON.
So, in your case, you will have to go through the XML object and AddRows to an infotable you generate in your service as needed.
Parsing the XML is already done, because we're E4X built-in ThingWorx (see http://wso2.com/project/mashup/0.2/docs/e4xquickstart.html).
Also, the add rows/create infotable are Snippet themselves so it should be pretty easy to do that.
Hope it helps!
Vladimir
Thanks Vladimir
So I gonna stick to the traditional way to get data from XML. When I need to get data from Thingworx I will use this one.
cheers
Richard
Note that it's "Accept=text/xml" (with a capital 'A") not "accept" - ThingWorx's query params are case-sensitive