on 2013 Aug 09 3:20 PM
Hi all,
I am trying to get data from a CGI service which provides the data only in XML format. I have used the xshttpdest file and xsjs file to access the service. I am able to get the data as text into a variable and display is as text.
The service returns:
<body>
<script/><response>
<status>0</status><hour value="1">
<inCount>30</inCount><outCount>
18</outCount></hour></response></body>
But what I want to achieve is to parse the XML file and put the data accordingly into respective tables. I am aware of such a functionality in terms of JSON format. See blog http://scn.sap.com/community/developer-center/hana/blog/2013/07/01/sap-hana-sps6--various-new-develo...
The Outbound data connectivity section explains about such feature.
But I am getting the output in XML format and need to feed this into tables. Is there a way achieve this?
Kindly suggest any thing that can be done to get the data in tables.
Thanks & Regards,
Shreepad Patil
Request clarification before answering.
Thanks to SAP - they have done xmltojson parser:
and just smth like this...
$.import('sap.hana.xs.lm.core', 'xml2json');
var xml2json = $.sap.hana.xs.lm.core.xml2json.xml2json;
var res = xml2json.parse(t);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Dmitriy
I had similar requirements. It was really helpful from your suggestion. Do you know, where will i get official information regarding the apis provided in this library. I saw the library but it would be more helpful if I get API documentation for this. Thank you.
Best Regards
Vivek
Hello Thomas
Thank you for your recommendation.
Currently we are parsing our XML-schema with complex string matching. Our schema is huge and it takes a lot of time. This way of XML to json conversion and then extracting data looked simpler way of doing it. Although, i am not sure if this will take the same time as parsing xml to json for the first time.
Is there any official support planned for XML-parsing in XS server side?
Best Regards
Vivek
Hi Thomas,
Can you please have a look at the below issue?
Corresponding statement to JSON.stringify for XML outputs in XSJS
Thanks!
I Read your blog. Idea is cool. But think of a huge XML document which is to be parsed with string search . But I am sure there is no donut for you in xsjs to parse the XML body freely(like DOM parser).May be you can try reguar expression matching or such complex stuffs to parse it and make a JSON out of it.
Sreehari
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
30 | |
9 | |
9 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.