View Full Version : Issue with XMLReader and colon in XML

14 May 2010, 1:39 AM
I have the following XML and XMLReader code which fails to load. It seems that it is the colon (:) in the tag names that is causing the issue, if i remove them from the XML and JS, the grid loads. Does anyone have any ideas? I have tried escaping but this doesnt seem to help.

<autn:time>13 May 10 15:55:02</autn:time>
<autn:duration>2.00 ms</autn:duration>

var store = new Ext.data.Store({
// load using HTTP
url: 'localhost.xml',

// the return will be XML, so lets set up a reader
reader: new Ext.data.XmlReader({
// records will have an "Item" tag
record: 'logentry',
id: 'autn:time',
totalRecords: '10'
}, [
// set up the fields mapping into the xml doc
// The first needs mapping, the others are very basic

'autn:client', 'autn:status', 'autn:thread'

// create the grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{header: "Client", width: 180, dataIndex: 'autn:client', sortable: true},
{header: "Status", width: 115, dataIndex: 'autn:status', sortable: true},
{header: "Thread", width: 100, dataIndex: 'autn:thread', sortable: true}

14 May 2010, 2:39 AM
according to XML Specification you are using namespaces in the XML, i dont know if the XMLReader is able to parse the XML namespaces, in which case the docs dont explain anything.

i recommend that you erase the namespaces of the xml in server with regex, or something like that and send clean XML...

14 May 2010, 2:47 AM
Hi. thanks for the response. Unfortunately i do have control of the XML Output. i could put an intermidiary parser in between my code and the xml output, but would rather avoid this if possible or i write my own XMLReader. All a bit of a shame if i have to do that.

14 May 2010, 3:01 AM
if you want, you could read al this topic http://www.extjs.com/forum/showthread.php?58153-How-to-recover-an-attribute-in-grid-with-xml&highlight=xml+namespace

but you'll find out that the domquery doesnt support xml namespaces...

14 May 2010, 3:02 AM
paulie, this link (http://www.extjs.com/forum/showthread.php?58153-How-to-recover-an-attribute-in-grid-with-xml&highlight=xmlreader+namespace) might help you out. Just use the "search" field at the top of this page: xmlreader namespace

EDIT: Same link as @Roth's ^^

14 May 2010, 3:05 AM
yes, i have readed the all 4 pages... :P

thinking that maybe they have a solution, and nothing... :(