PDA

View Full Version : [FIXED]XmlWriter forcing a DocumentRoot



margozzi
9 Mar 2011, 4:57 PM
I need a way to completely suppress the inclusion of the "documentRoot" that the XmlWriter wnats to append to my XML. I only want a complete record to be sent when I do an "add" or "update" operation. I tried setting the documentRoot to null, "", and '." all to no avail. This was not an issue in 3.x.

My XmlWriter portion of the Store config:

writer: {
type: 'xml',
writeAllFields : true,
documentRoot: null,
record: "Library"
}

The model looks like this:

Ext.regModel('Library', {
fields: [
{ name: 'State', type: 'string' },
{ name: 'DriveState', type: 'string' },
{ name: 'Name', type: 'string' },
{ name: 'SerialNumber', type: 'string' },
{ name: 'Type', type: 'string' },
{ name: 'ProductId', type: 'string' },
{ name: 'Archive', type: 'string'},
{ name: 'ServerHostName', type: 'string'},
{ name: 'ACS', type: 'int'},
{ name: 'Client', type: 'string'},
{ name: 'DualIsle', type: 'boolean'}
]
});

evant
10 Mar 2011, 1:16 AM
This, along with a couple of other improvements will be in the next release.

margozzi
10 Mar 2011, 7:13 AM
Great news! Has Sencha even given any thought to supporting XML Schemas? There are so many nice tools in Java like JAXB, Castor and XML beans that all compile an XSD file and generate classes that can marshal and unmarshal XML into classes. They also provide validation.

evant
10 Mar 2011, 7:20 AM
Not particularly, no. I don't really see the value in it, especially since it makes much more sense to work with JSON if you're doing JS.

margozzi
10 Mar 2011, 7:39 AM
Consider the case where you have no choice in the matter. The RESTful web service you are going to communicate with only has XML and provides you with a schema. Sometimes we have no control over the data format. Hence, the more flexible ExtJS can be on the format of the exchanged data, the better. If ExtJS could compile a schema, they could not only generate the classes ( essentially records ) they could even create the complex models all based on the schema. Just some food for thought.

Also, I wanted to thank you for the quick replies! I look forward to the next release.

evant
10 Mar 2011, 2:38 PM
I can see how it could be useful, but XML is hard enough to work with compared to JSON, I don't think there's a great deal of value introducing more complexity in that area.