Kjell
Posts: 0
Joined: Fri Jun 07, 2013 12:25 pm

Data mapping xml attributes

My rest service returns an xml which looks like:
ulli
span class="type1"data1/span
span class="type2"data2/span
span class="type3"data3/span
/li/ul

And I want to map $(".type2").val() to an input text box.

It works fine if I change the javascript span[0] to span[1]
'responseMapping': [{
'PATH': ['html', 'body', 'div', 'ul', 'li', 'span[1]', 'content'],

But can it be done by using the data mapping only, i.e. without any javascript editing?

Kjell
Posts: 0
Joined: Fri Jun 07, 2013 12:25 pm

Data mapping xml attributes

The xml was not readable, I try with this
<!--
<ul<li
<span class="type1"data1</span
<span class="type2"data2</span
<span class="type3"data3</span
</li</ul
--

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Data mapping xml attributes

Hello! Please use < code < /code tag to post your code.

Kjell
Posts: 0
Joined: Fri Jun 07, 2013 12:25 pm

Data mapping xml attributes

Ok,

My rest service returns an xml which looks like:
code
<ul><li>
<span class="type1">data1<&#47;span>
<span class="type2">data2<&#47;span>
<span class="type3">data3<&#47;span>
<&#47;li><&#47;ul>
/code

And I want to map $(".type2").val() to an input text box.

It works fine if I change the generated javascript span[0] to span[1]
'responseMapping': [{
'PATH': ['html', 'body', 'div', 'ul', 'li', 'span[1]', 'content'],

But can it be done by using the data mapping only, i.e. without any javascript editing?

Or is there a better way to get the data than to edit the generated javascript?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Data mapping xml attributes

Hi,

We'll take a look.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Data mapping xml attributes

Sorry, no updates yet. Working on it.

Kjell
Posts: 0
Joined: Fri Jun 07, 2013 12:25 pm

Data mapping xml attributes

I hope you can find a solution for this. I can also imagine that there are people that want to write simple mobile apps towards existing web sites which are returning html.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Data mapping xml attributes

  1. You should not interfere in the generated service code until it's finally exported from the builder.

    1. There is no way to do this. It is usually assumed that the filtering of data is on the server side but the server does not send extra data.

      You can create a generic service and handle the response as you need, and then map it to the screen.

      You can also pass the usual response to localStorage and add there JS code that performs manual mapping.

Return to “Issues”