PDA

View Full Version : Using XTemplate to send XML



cayenne_08
19 May 2011, 1:39 PM
This is what I am trying to do to post custom XML on editor form submit:



(function() {
Q.dxi.QXmlWriter = Ext.extend(Ext.data.XmlWriter, {
constructor: function(config){
Q.dxi.QXmlWriter.superclass.constructor.call(this,
Ext.applyIf(config, {
writeAllFields: true,
render : function(params, baseParams, data) {
formatDate(data);
var tpl = new Ext.XTemplate(
'<?xml version="1.0" encoding="ISO-8859-15"?>',
'<Event xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ThrottleEventType">',
'<EventTypeName>{data.EventTypeName.value}</EventTypeName>',
'<StartDate>{data.StartDate.value}</StartDate>',
'<EndDate>{values.data.EndDate.value}</EndDate>',
'<Title>{data.Title.value}</Title>',
'<Bandwidth>{data.Bandwidth.value}</Bandwidth>',
'<EventId>{data.EventId.value}</EventId>',
'</Event>');
Q.dxi.QXmlWriter.superclass.render.call(this, params, baseParams, tpl);
}
}));
}
});
Ext.reg('QXmlWriter', Q.dxi.QXmlWriter);
}

)();


I get the following error in Firebug:

XML
XML Parsing Error: not well-formed Location: moz-nullprincipal:{1f5f63f9-60fc-4caa-940c-6fee33f420b8} Line Number 1, Column 53:

...ml version="1.0" encoding="ISO-8859-15"?><Event><></></Event>
...-------------------------------------------------^

Source
<?xml version="1.0" encoding="ISO-8859-15"?><Event><></></Event>

Any help would be greatly appreciated.

Thanks!