View Full Version : Read XML data that contains HTML elements

12 Mar 2012, 9:53 AM

I'm trying to output HTML content that is contained inside a XML structure. I'm using a dataview with a store/model. My XML would be something like.

<?xml version="1.0" encoding="ISO-8859-1" ?>
<msg>line 1<br/>line 2</msg>
<msg>line 1<br/>line 2<br/>line 3</msg>

in my model, I roughly do my mapping like this

{name: 'msg', mapping: '/', type: 'string'}

the simplified dataview template is be:

<tpl for="."><div>{msg}</div></tpl>

the issue is that the data returned by {msg} stops at the <br/>. It only shows "line 1". It's like {msg} treats <br/> like an element to map and stops there. What I would like to be able to get is the whole "line 1<br/>line 2" so I can output that as html.

I get the same result when i try to get the data from a command like: this.getDiscussionStore().getAt(0).get('msg')

anybody know how to do this?

12 Mar 2012, 10:24 AM
Why do you have mapping : '/'?

12 Mar 2012, 10:36 AM
That was the only way I was able to get some data to show up. It works, but its not outputing the rest of the <msg> content..i get

"line 1"

i'd like to get

"line 1<br/>line2"

12 Mar 2012, 10:39 AM
my store proxy reader is

reader: {
type: 'xml',
record: 'msg',
successProperty: 'success'

13 Mar 2012, 7:06 AM
Why do you have mapping : '/'?

is that the final "answer"?

i tried several mapping, so far that was the only one that return me some data.

I'm sure this is feasible, it seems so basic, I'm sure I'm just missing one little detail.

So... nobody ever tried to parse HTML contain in a XML store?

Any help would be appreciated.


11 Jul 2013, 10:36 AM
Check the value of itemSelector in your Dataview, if itemSelector is set to a tag that exists into store record, the content will be "escaped".

This looks like a bug.