PDA

View Full Version : content:encoded from xml



pgdavid
16 Feb 2011, 9:08 AM
Hi there,

We'd need to parse an RSS feed that is using some of the specifications from http://web.resource.org/rss/1.0/modules/content/ like <content:encoded>

Is it possible to have a model identify these tags and return the values when invoking the data store?



Ext.regModel('Item', {
fields: ['title','content:encoded','description','link','category'],
proxy: {
type: 'ajax',
url : XMLPATH + 'feed.xml',
reader: {
type: 'xml',
root: 'channel',
record: 'item'
}
}
});

itemStore = new Ext.data.Store({
autoLoad: true,
model: 'Item',
listeners: {
datachanged: function(xml){
itemLoaded = xml;
store.load();
}
}
});


We get the following error because of 'content:encoded': "SYNTAX_ERR: DOM Exception 12: An invalid or illegal string was specified."

Any help would be much appreciated.

Cheers,

pgdavid
22 Feb 2011, 7:24 AM
managed to find a workaround for this that is pretty clean actually. Turns out that looking into the raw attribute stored in my itemStore, I could trace all the nodes stored and see that the one named "content:encoded" in the xml was actually being stored as "encoded".


Not sure if this applies as a general rule, but to those looking into parsing feeds, xml, rss and whatnots with specific namespaces (elements with colons mostly), I'd encourage you to look into the raw item and see if the store is catching them with an specific name... most likely the word after the colon.

Hope this helps!