null+****@clear*****
null+****@clear*****
2012年 7月 19日 (木) 18:11:46 JST
SHIMODA Hiroshi 2012-07-19 18:11:46 +0900 (Thu, 19 Jul 2012) New Revision: 40626c6177ead4954aa472e8808ea10ab96f8c24 https://github.com/groonga/gcs/commit/40626c6177ead4954aa472e8808ea10ab96f8c24 Log: Generate response XML for IndexDocuments action by xmlbuilder Modified files: lib/api/2011-02-01/configuration.js Modified: lib/api/2011-02-01/configuration.js (+14 -13) =================================================================== --- lib/api/2011-02-01/configuration.js 2012-07-19 18:10:00 +0900 (970e945) +++ lib/api/2011-02-01/configuration.js 2012-07-19 18:11:46 +0900 (9203819) @@ -249,19 +249,20 @@ handlers.DeleteIndexField = function(context, request, response) { }; function createIndexDocumentsResponse(options) { - return '<?xml version="1.0"?>\n' + - '<IndexDocumentsResponse xmlns="' + XMLNS + '">' + - '<IndexDocumentsResult>' + - '<FieldNames>' + - options.fieldNames.map(function(fieldName) { - return '<member>' + fieldName + '</member>'; - }).join('') + - '</FieldNames>' + - '</IndexDocumentsResult>' + - '<ResponseMetadata>' + - '<RequestId>' + (options.requestId || '') + '</RequestId>' + - '</ResponseMetadata>' + - '</IndexDocumentsResponse>'; + var doc = xmlbuilder.create(); + doc.begin('IndexDocumentsResponse', {version: '1.0'}) + .attribute('xmlns', XMLNS) + .element('IndexDocumentsResult') + .addFragment(options.fieldNames.map(function(fieldName) { + var member = new xmlbuilder.XMLFragment(null, 'member'); + member.text(fieldName); + return member; + })) + .up() + .element('ResponseMetadata') + .element('RequestId').text(options.requestId || '').up() + .up(); + return doc.toString(); } handlers.IndexDocuments = function(context, request, response) { -------------- next part -------------- HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B... 下載