Skip to content

Instantly share code, notes, and snippets.

@clarle
Created November 10, 2013 17:50
Show Gist options
  • Save clarle/7401427 to your computer and use it in GitHub Desktop.
Save clarle/7401427 to your computer and use it in GitHub Desktop.
Reproduction for issue #1371
<html>
<head>
<title>Hello DataSource!</title>
<script src="/yui/yui.js"></script>
</head>
<body>
<p>Hello XML!</p>
<script>
YUI({
filter: 'raw'
}).use('datasource-io', 'datasource-xmlschema', function (Y) {
var toolData = new Y.DataSource.IO({
source: './tools'
});
toolData.plug({
fn: Y.Plugin.DataSourceXMLSchema,
cfg: {
schema: {
resultListLocator: 'Tool',
resultFields: [
{
key: 'assetId',
locator: '@assetId'
}
]
}
}
});
toolData.sendRequest({
request: {
foo: 'bar'
},
on: {
success: function (e) {
console.log('success: ' + e.response);
},
failure: function (e) {
console.log('error: ' + e.error.message);
}
}
});
});
</script>
</body>
</html>
var express = require('express'),
app = express();
app.use(express.static(__dirname + '/build'));
app.get('/', function (req, res) {
res.sendfile('index.html');
});
app.get('/tools', function (req, res) {
var body = '<Tools></Tools>';
res.setHeader('Content-Type', 'application/xml');
res.end(body);
});
app.listen(3000);
console.log('App listening on http://localhost:3000');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment