mirror of
https://github.com/sstent/alex_app1.git
synced 2026-02-15 19:55:33 +00:00
almost working
This commit is contained in:
197
app.js
197
app.js
@@ -2,89 +2,63 @@
|
|||||||
/**
|
/**
|
||||||
* Module dependencies.
|
* Module dependencies.
|
||||||
*/
|
*/
|
||||||
|
var eresult;
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var mongo = require('mongodb');
|
var mongo = require('mongodb');
|
||||||
|
var async = require('async');
|
||||||
var BSON = mongo.BSONPure;
|
var BSON = mongo.BSONPure;
|
||||||
var db = require('mongoskin').db('localhost:27017/test');
|
var db = require('mongoskin').db('localhost:27017/test');
|
||||||
var testcollection = db.collection('testcollection');
|
var testcollection = db.collection('testcollection');
|
||||||
var exercisecollection = db.collection('exercisecollection');
|
var exercisecollection = db.collection('exercisecollection');
|
||||||
var expressocollection = db.collection('expressocollection');
|
|
||||||
var hrdatacollection = db.collection('hrdatacollection');
|
|
||||||
var util = require('util');
|
var util = require('util');
|
||||||
var formidable = require('formidable');
|
//var parser = new xml2js.Parser();
|
||||||
var xml2js = require('xml2js');
|
|
||||||
var parser = new xml2js.Parser();
|
|
||||||
var dateFormat = require('dateformat');
|
var dateFormat = require('dateformat');
|
||||||
|
|
||||||
var app = require('http').createServer(function handler(request, response) {
|
var app = require('http').createServer(function handler(request, response) {
|
||||||
|
|
||||||
console.log('request starting...;' + request.url);
|
console.log('request starting...;' + request.url);
|
||||||
|
|
||||||
// switch(request.url) {
|
switch(request.url) {
|
||||||
// case '/upload':
|
|
||||||
// var form = new formidable.IncomingForm(),
|
|
||||||
// files = [],
|
|
||||||
// fields = [];
|
|
||||||
|
|
||||||
// var tempdirectory = "/tmp/";
|
case '/admin':
|
||||||
|
|
||||||
// // //tempdirectory changes if the operating system is windows
|
//var filePath = '.' + request.url;
|
||||||
// if(process.platform == "windows")
|
//if (filePath == './')
|
||||||
// {
|
filePath = './admin.html';
|
||||||
// tempdirectory = "c:\\temp\\";
|
|
||||||
// }
|
|
||||||
// form.uploaddir = tempdirectory;
|
|
||||||
|
|
||||||
// //tempDirectory = "c:\\Temp\\";
|
var extname = path.extname(filePath);
|
||||||
// //form.uploadDir = tempDirectory;
|
var contentType = 'text/html';
|
||||||
|
switch (extname) {
|
||||||
|
case '.js':
|
||||||
|
contentType = 'text/javascript';
|
||||||
|
break;
|
||||||
|
case '.css':
|
||||||
|
contentType = 'text/css';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
path.exists(filePath, function(exists) {
|
||||||
|
|
||||||
// form.on('error', function(err) {
|
if (exists) {
|
||||||
// response.writeHead(200, {'content-type': 'text/plain'});
|
fs.readFile(filePath, function(error, content) {
|
||||||
// response.end('error:\n\n'+util.inspect(err));
|
if (error) {
|
||||||
// });
|
response.writeHead(500);
|
||||||
// form.on('field', function(field, value) {
|
response.end();
|
||||||
// console.log(field, value);
|
}
|
||||||
// fields.push([field, value]);
|
else {
|
||||||
// });
|
response.writeHead(200, { 'Content-Type': contentType });
|
||||||
// form.on('file', function(field, file) {
|
response.end(content, 'utf-8');
|
||||||
// console.log(field, file);
|
}
|
||||||
// files.push([field, file]);
|
});
|
||||||
// });
|
}
|
||||||
// form.on('end', function() {
|
else {
|
||||||
// console.log('-> upload done');
|
response.writeHead(404);
|
||||||
// response.writeHead(200, {'content-type': 'text/plain'});
|
response.end();
|
||||||
// response.write('received fields:\n\n '+util.inspect(fields));
|
}
|
||||||
// response.write('\n\n');
|
});
|
||||||
// response.write('received files:\n\n '+util.inspect(files));
|
break;
|
||||||
// });
|
// default case
|
||||||
|
default:
|
||||||
// form.parse(request, function(err, fields, files) {
|
|
||||||
// console.log('-> uploaded -' + files.upload.path);
|
|
||||||
// fs.readFile(files.upload.path, function(err, data) {
|
|
||||||
// parser.parseString(data, function (err, result) {
|
|
||||||
// response.write('received file contents:\n\n ');
|
|
||||||
// response.end(JSON.stringify(result));
|
|
||||||
// console.log('Done');
|
|
||||||
|
|
||||||
// //hrdatacollectionJSON.stringify(result)
|
|
||||||
// var data = JSON.stringify(result);
|
|
||||||
// var buf1 = new Buffer(12);
|
|
||||||
// var dataid = JSON.parse(data).Activities.Activity.Id;
|
|
||||||
// var datadate = Date.parse(dataid);
|
|
||||||
// //console.log('TCX ID' + JSON.parse(data).Activities.Activity.Id);
|
|
||||||
// console.log('TCX ID ' + datadate);
|
|
||||||
// var document_id = new BSON.ObjectID(datadate);
|
|
||||||
// console.log('inserted BSONID ' + document_id);
|
|
||||||
// hrdatacollection.update({_id:document_id}, data,{upsert:true} , function(err, result) {
|
|
||||||
// if (err) throw err;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
var filePath = '.' + request.url;
|
var filePath = '.' + request.url;
|
||||||
if (filePath == './')
|
if (filePath == './')
|
||||||
filePath = './index.html';
|
filePath = './index.html';
|
||||||
@@ -118,7 +92,7 @@ var app = require('http').createServer(function handler(request, response) {
|
|||||||
response.end();
|
response.end();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// }
|
}
|
||||||
}).listen(3000);
|
}).listen(3000);
|
||||||
|
|
||||||
|
|
||||||
@@ -129,10 +103,10 @@ io.set("transports", ["websocket"]);
|
|||||||
});
|
});
|
||||||
|
|
||||||
io.sockets.on('connection', function(socket) {
|
io.sockets.on('connection', function(socket) {
|
||||||
console.log('Client connected');
|
// console.log('Client connected');
|
||||||
|
|
||||||
socket.on('getactivites', function(data) {
|
socket.on('getactivites', function(data) {
|
||||||
console.log('getactivites');
|
// console.log('getactivites');
|
||||||
testcollection.find().toArray(function(err, result) {
|
testcollection.find().toArray(function(err, result) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
socket.emit('populateactivities', result);
|
socket.emit('populateactivities', result);
|
||||||
@@ -140,18 +114,57 @@ io.sockets.on('connection', function(socket) {
|
|||||||
});
|
});
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
socket.on('getactivitybyid', function(id) {
|
socket.on('getactivitybyid', function(id) {
|
||||||
console.log('getactivitybyid');
|
// console.log('getactivitybyid');
|
||||||
|
|
||||||
testcollection.findById(id, function(err, result) {
|
testcollection.findById(id, function(err, result) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
socket.emit('populateactivitybyid', result);
|
//console.log('Activity result = ' + JSON.stringify(result));
|
||||||
|
//var unpackedresult = JSON.parse(result);
|
||||||
|
eresult= result;
|
||||||
|
// var i;
|
||||||
|
for(i in result.Activities.Activity.Lap) {
|
||||||
|
//console.log('Activity parse result = ' + JSON.stringify(item.val1));
|
||||||
|
console.log('above_i = ' + i);
|
||||||
|
///////////////
|
||||||
|
getdoc(result.Activities.Activity.Lap[i].selection, i, function(docdata, iteration) {
|
||||||
|
console.log(docdata);
|
||||||
|
eresult.Activities.Activity.Lap[iteration].execisename = docdata.exercise.name
|
||||||
|
eresult.Activities.Activity.Lap[iteration].execiseclass = docdata.exercise.class
|
||||||
|
eresult.Activities.Activity.Lap[iteration].execisemuscledata = docdata.exercise.muscledata
|
||||||
|
|
||||||
|
if (iteration == result.Activities.Activity.Lap.length-1)
|
||||||
|
{
|
||||||
|
// console.log('fnal round' + iteration);
|
||||||
|
socket.emit('populateactivitybyid', result);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
////////////////////
|
||||||
|
console.log('below_i = ' + i);
|
||||||
|
//console.log('DATA = ' + JSON.stringify(callback));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getdoc(docid, iteration, callback) {
|
||||||
|
exercisecollection.findById(docid, function(err, exresult) {
|
||||||
|
if (err) throw err;
|
||||||
|
|
||||||
|
console.log('docid = ' + docid);
|
||||||
|
console.log('inside_i = ' + iteration);
|
||||||
|
callback(exresult, iteration);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
socket.on('addactivity', function(data, docid) {
|
socket.on('addactivity', function(data, docid) {
|
||||||
console.log('addactivity' + docid);
|
// console.log('addactivity' + docid);
|
||||||
console.log('add_activity_data' + JSON.stringify(data));
|
// console.log('add_activity_data' + JSON.stringify(data));
|
||||||
if (docid === null) {
|
if (docid === null) {
|
||||||
var document_id = new BSON.ObjectID();
|
var document_id = new BSON.ObjectID();
|
||||||
}
|
}
|
||||||
@@ -159,7 +172,7 @@ io.sockets.on('connection', function(socket) {
|
|||||||
var document_id = new BSON.ObjectID(docid);
|
var document_id = new BSON.ObjectID(docid);
|
||||||
}
|
}
|
||||||
//var document_id = new BSON.ObjectID(docid);
|
//var document_id = new BSON.ObjectID(docid);
|
||||||
console.log('inserted BSONID' + document_id);
|
// console.log('inserted BSONID' + document_id);
|
||||||
testcollection.update({_id:document_id}, data,{upsert:true} , function(err, result) {
|
testcollection.update({_id:document_id}, data,{upsert:true} , function(err, result) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
exercisecollection.find().toArray(function(err, result) {
|
exercisecollection.find().toArray(function(err, result) {
|
||||||
@@ -183,16 +196,17 @@ io.sockets.on('connection', function(socket) {
|
|||||||
});
|
});
|
||||||
///////////////////
|
///////////////////
|
||||||
socket.on('getexercises', function(data) {
|
socket.on('getexercises', function(data) {
|
||||||
console.log('emit exercises');
|
// console.log('emit exercises');
|
||||||
exercisecollection.find().toArray(function(err, result) {
|
exercisecollection.find().toArray(function(err, result) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
socket.emit('populateexercises', result);
|
socket.emit('populateexercises', result);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
/////////////////////
|
||||||
socket.on('updateexercises', function(data, docid) {
|
socket.on('updateexercises', function(data, docid) {
|
||||||
console.log('updateexecises' + JSON.stringify(data));
|
// console.log('updateexecises' + JSON.stringify(data));
|
||||||
if (docid == 'undefined') {
|
if (docid == 'undefined') {
|
||||||
console.log('edited updateexecises' + JSON.stringify(data));
|
//console.log('edited updateexecises' + JSON.stringify(data));
|
||||||
exercisecollection.insert(data, function(err, result) {
|
exercisecollection.insert(data, function(err, result) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
exercisecollection.find().toArray(function(err, result) {
|
exercisecollection.find().toArray(function(err, result) {
|
||||||
@@ -207,17 +221,44 @@ io.sockets.on('connection', function(socket) {
|
|||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
exercisecollection.find().toArray(function(err, result) {
|
exercisecollection.find().toArray(function(err, result) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
console.log('populateexercises');
|
//console.log('populateexercises');
|
||||||
socket.emit('populateexercises', result);
|
socket.emit('populateexercises', result);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
////////////////////
|
||||||
|
socket.on('getexercisebyid', function(id) {
|
||||||
|
// console.log('getexercisebyid');
|
||||||
|
exercisecollection.findById(id, function(err, result) {
|
||||||
|
if (err) throw err;
|
||||||
|
socket.emit('populateexercisebyid', result);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
|
socket.on('delexercise', function(id) {
|
||||||
|
exercisecollection.removeById(id,function(err, reply){
|
||||||
|
if (err) throw err;
|
||||||
|
exercisecollection.find().toArray(function(err, result) {
|
||||||
|
if (err) throw err;
|
||||||
|
socket.emit('populateexercises', result);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
//////////////////
|
||||||
|
///////////////////
|
||||||
|
socket.on('getexerciselist', function(data) {
|
||||||
|
// console.log('emit exercises = ' + data);
|
||||||
|
exercisecollection.find({'exercise.class': data }).toArray(function(err, result) {
|
||||||
|
if (err) throw err;
|
||||||
|
//console.log('emited exercises = ' + JSON.stringify(result));
|
||||||
|
socket.emit('populateexerciselist', data , result);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
/////////////////////
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
46
index.html
46
index.html
@@ -16,18 +16,15 @@
|
|||||||
<link rel="stylesheet" href="/static/stylesheets/jui_style.css"/>
|
<link rel="stylesheet" href="/static/stylesheets/jui_style.css"/>
|
||||||
<link rel="stylesheet" href="/static/stylesheets/style.css"/>
|
<link rel="stylesheet" href="/static/stylesheets/style.css"/>
|
||||||
<script id="movieTemplate1" type="text/x-jsrender">
|
<script id="movieTemplate1" type="text/x-jsrender">
|
||||||
<h3>{{:Activities.Activity.date}} - {{:Activities.Activity.name}}</h3>
|
<h3>{{:Activities.Activity.date}}</h3>
|
||||||
<div class="workoutdata">
|
<div class="workoutdata">
|
||||||
<a href=# class="activitydelete" title="{{:_id}}" >Delete</a>
|
<a href=# class="activitydelete" title="{{:_id}}" >Delete</a>
|
||||||
<a href=# class="activityedit" title="{{:_id}}" >Edit</a>
|
<a href=# class="activityedit" title="{{:_id}}" >Edit</a>
|
||||||
{{if Activities.Activity.Lap}}
|
{{if Activities.Activity.Lap}}
|
||||||
{{for Activities.Activity.Lap}}
|
{{for Activities.Activity.Lap}}
|
||||||
<p>LAP {{:#index+1}} -
|
<p>Workout step {{:#index+1}} -
|
||||||
{{if run}} Run - {{:run.name}} - {{:run.distance}}KM in {{:run.time}}{{/if}}
|
{{if class == 'Cardio' }} Cardio - {{:exercisename}} - {{:distance}} x {{:time}} -- {{:exercisemuscledata}} {{/if}}
|
||||||
{{if bike}} Bike - {{:bike.name}} - {{:bike.distance}} x {{:bike.time}}{{/if}}
|
{{if class == 'Exercise' }} Exercise - {{:exercisename}} - {{:sets}} x {{:reps}} with {{:weight}} Kg -- {{:exercisemuscledata}}{{/if}}
|
||||||
{{if cardio}} Cardio - {{:cardio.name}} - {{:cardio.distance}} x {{:cardio.time}}{{/if}}
|
|
||||||
{{if exercise}} Exercise - {{:exercise.name}} - {{:exercise.sets}} x {{:exercise.reps}} with {{:exercise.weight}} Kg{{/if}}
|
|
||||||
{{if rest}} Recovery Step {{/if}}
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{{/for}}
|
{{/for}}
|
||||||
@@ -36,7 +33,7 @@
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script id="DataTemplate1" type="text/x-jsrender">
|
<script id="DataTemplate1" type="text/x-jsrender">
|
||||||
<h3>{{:Activities.Activity.date}} - {{:Activities.Activity.name}}</h3>
|
<h3>{{:Activities.Activity.date}}</h3>
|
||||||
<div class="workoutdata">
|
<div class="workoutdata">
|
||||||
// <h4>{{:Activities.Activity.date}} - {{:Activities.Activity.name}}</h4>
|
// <h4>{{:Activities.Activity.date}} - {{:Activities.Activity.name}}</h4>
|
||||||
<a href=# class="activitydelete" title="{{:_id}}" >Delete</a>
|
<a href=# class="activitydelete" title="{{:_id}}" >Delete</a>
|
||||||
@@ -56,7 +53,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li style="display: none" class="new-lap ui-state-default removable">
|
<li style="display: none" class="new-lap ui-state-default removable">
|
||||||
<label class="uiindex"></label>
|
<label class="uiindex"></label>
|
||||||
<select class="laptype">
|
<select class="laptype" name="Activities.Activity.Lap[0].class">
|
||||||
<option value="">Select...</option>
|
<option value="">Select...</option>
|
||||||
<option value="Cardio">Cardio</option>
|
<option value="Cardio">Cardio</option>
|
||||||
<option value="Exercise">Weights</option>
|
<option value="Exercise">Weights</option>
|
||||||
@@ -64,16 +61,6 @@
|
|||||||
<span><a href=# class=delete>delete</a></span>
|
<span><a href=# class=delete>delete</a></span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<!--
|
|
||||||
<div id="tabs">
|
|
||||||
<ul>
|
|
||||||
<li><a id="Activities_tab" href="#Activities">Workout History</a></li>
|
|
||||||
<li><a href="#Activity">Add Workout</a></li>
|
|
||||||
<li><a href="#ExerciseEditor">Edit Exercises</a></li>
|
|
||||||
<li><a href="#ExpressoEditor">Edit Expresso Tracks</a></li>
|
|
||||||
<li><a href="#GarminDataUpload">Upload Garmin Data</a></li>
|
|
||||||
</ul>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<div id="Activities">
|
<div id="Activities">
|
||||||
<ul id="ActivityList"></ul>
|
<ul id="ActivityList"></ul>
|
||||||
@@ -82,32 +69,17 @@
|
|||||||
<div id="RightColumn">
|
<div id="RightColumn">
|
||||||
<div id="Activity">
|
<div id="Activity">
|
||||||
<span class="ActivityID">
|
<span class="ActivityID">
|
||||||
<button class="Add" value="lap">Add Exercise</button>
|
|
||||||
<form id="myForm">
|
<form id="myForm">
|
||||||
<ul id="sortable" class="Activities">
|
<ul id="sortable" class="Activities">
|
||||||
<li class="ui-state-default"><label>Activity Name</label><input type="text" name="Activities.Activity.name" placeholder="Location"><label>Date</label><input type="text" class="datepicker" name="Activities.Activity.date"></li>
|
<li class="ui-state-default"><label>Date</label><input type="text" class="datepicker" name="Activities.Activity.date"></li>
|
||||||
</ul>
|
</ul>
|
||||||
<button type="submit" id="save" value="Save">Save</button>
|
<button type="submit" id="save" value="Save">Save</button>
|
||||||
<!-- <button style="display: none" type="submit" id="savecopy" value="Savecopy">Save Copy</button> -->
|
<button type="button" id="cancelform" value="Cancel"/>Reset</button>
|
||||||
<button type="button" id="cancelform" value="Cancel"/>Cancel</button>
|
|
||||||
</form>
|
</form>
|
||||||
|
<button class="Add" value="lap">Add Exercise</button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="ExerciseEditor" >
|
|
||||||
<span class="ExerciseID">
|
|
||||||
<button class="AddExercise">Add Exercise</button>
|
|
||||||
<button type="button" class="cancel" value="Cancel"/>Cancel</button>
|
|
||||||
<form id="ExerciseForm">
|
|
||||||
<ul id="sortableexercises">
|
|
||||||
</ul>
|
|
||||||
<button type="submit" id="saveexercises" value="Save">Save</button>
|
|
||||||
<button type="button" id="cancelexerciseform" value="Cancel"/>Cancel</button>
|
|
||||||
</form>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
10
node_modules/xml2js/node_modules/sax/AUTHORS
generated
vendored
10
node_modules/xml2js/node_modules/sax/AUTHORS
generated
vendored
@@ -1,10 +0,0 @@
|
|||||||
# contributors sorted by whether or not they're me.
|
|
||||||
Isaac Z. Schlueter <i@izs.me>
|
|
||||||
Stein Martin Hustad <stein@hustad.com>
|
|
||||||
Mikeal Rogers <mikeal.rogers@gmail.com>
|
|
||||||
Laurie Harper <laurie@holoweb.net>
|
|
||||||
Jann Horn <jann@Jann-PC.fritz.box>
|
|
||||||
Elijah Insua <tmpvar@gmail.com>
|
|
||||||
Henry Rawas <henryr@schakra.com>
|
|
||||||
Justin Makeig <jmpublic@makeig.com>
|
|
||||||
Mike Schilling <mike@emotive.com>
|
|
||||||
23
node_modules/xml2js/node_modules/sax/LICENSE
generated
vendored
23
node_modules/xml2js/node_modules/sax/LICENSE
generated
vendored
@@ -1,23 +0,0 @@
|
|||||||
Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person
|
|
||||||
obtaining a copy of this software and associated documentation
|
|
||||||
files (the "Software"), to deal in the Software without
|
|
||||||
restriction, including without limitation the rights to use,
|
|
||||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the
|
|
||||||
Software is furnished to do so, subject to the following
|
|
||||||
conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be
|
|
||||||
included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
||||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
||||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
216
node_modules/xml2js/node_modules/sax/README.md
generated
vendored
216
node_modules/xml2js/node_modules/sax/README.md
generated
vendored
@@ -1,216 +0,0 @@
|
|||||||
# sax js
|
|
||||||
|
|
||||||
A sax-style parser for XML and HTML.
|
|
||||||
|
|
||||||
Designed with [node](http://nodejs.org/) in mind, but should work fine in
|
|
||||||
the browser or other CommonJS implementations.
|
|
||||||
|
|
||||||
## What This Is
|
|
||||||
|
|
||||||
* A very simple tool to parse through an XML string.
|
|
||||||
* A stepping stone to a streaming HTML parser.
|
|
||||||
* A handy way to deal with RSS and other mostly-ok-but-kinda-broken XML
|
|
||||||
docs.
|
|
||||||
|
|
||||||
## What This Is (probably) Not
|
|
||||||
|
|
||||||
* An HTML Parser - That's a fine goal, but this isn't it. It's just
|
|
||||||
XML.
|
|
||||||
* A DOM Builder - You can use it to build an object model out of XML,
|
|
||||||
but it doesn't do that out of the box.
|
|
||||||
* XSLT - No DOM = no querying.
|
|
||||||
* 100% Compliant with (some other SAX implementation) - Most SAX
|
|
||||||
implementations are in Java and do a lot more than this does.
|
|
||||||
* An XML Validator - It does a little validation when in strict mode, but
|
|
||||||
not much.
|
|
||||||
* A Schema-Aware XSD Thing - Schemas are an exercise in fetishistic
|
|
||||||
masochism.
|
|
||||||
* A DTD-aware Thing - Fetching DTDs is a much bigger job.
|
|
||||||
|
|
||||||
## Regarding `<!DOCTYPE`s and `<!ENTITY`s
|
|
||||||
|
|
||||||
The parser will handle the basic XML entities in text nodes and attribute
|
|
||||||
values: `& < > ' "`. It's possible to define additional
|
|
||||||
entities in XML by putting them in the DTD. This parser doesn't do anything
|
|
||||||
with that. If you want to listen to the `ondoctype` event, and then fetch
|
|
||||||
the doctypes, and read the entities and add them to `parser.ENTITIES`, then
|
|
||||||
be my guest.
|
|
||||||
|
|
||||||
Unknown entities will fail in strict mode, and in loose mode, will pass
|
|
||||||
through unmolested.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
var sax = require("./lib/sax"),
|
|
||||||
strict = true, // set to false for html-mode
|
|
||||||
parser = sax.parser(strict);
|
|
||||||
|
|
||||||
parser.onerror = function (e) {
|
|
||||||
// an error happened.
|
|
||||||
};
|
|
||||||
parser.ontext = function (t) {
|
|
||||||
// got some text. t is the string of text.
|
|
||||||
};
|
|
||||||
parser.onopentag = function (node) {
|
|
||||||
// opened a tag. node has "name" and "attributes"
|
|
||||||
};
|
|
||||||
parser.onattribute = function (attr) {
|
|
||||||
// an attribute. attr has "name" and "value"
|
|
||||||
};
|
|
||||||
parser.onend = function () {
|
|
||||||
// parser stream is done, and ready to have more stuff written to it.
|
|
||||||
};
|
|
||||||
|
|
||||||
parser.write('<xml>Hello, <who name="world">world</who>!</xml>').close();
|
|
||||||
|
|
||||||
// stream usage
|
|
||||||
// takes the same options as the parser
|
|
||||||
var saxStream = require("sax").createStream(strict, options)
|
|
||||||
saxStream.on("error", function (e) {
|
|
||||||
// unhandled errors will throw, since this is a proper node
|
|
||||||
// event emitter.
|
|
||||||
console.error("error!", e)
|
|
||||||
// clear the error
|
|
||||||
this._parser.error = null
|
|
||||||
this._parser.resume()
|
|
||||||
})
|
|
||||||
saxStream.on("opentag", function (node) {
|
|
||||||
// same object as above
|
|
||||||
})
|
|
||||||
// pipe is supported, and it's readable/writable
|
|
||||||
// same chunks coming in also go out.
|
|
||||||
fs.createReadStream("file.xml")
|
|
||||||
.pipe(saxStream)
|
|
||||||
.pipe(fs.createReadStream("file-copy.xml"))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Arguments
|
|
||||||
|
|
||||||
Pass the following arguments to the parser function. All are optional.
|
|
||||||
|
|
||||||
`strict` - Boolean. Whether or not to be a jerk. Default: `false`.
|
|
||||||
|
|
||||||
`opt` - Object bag of settings regarding string formatting. All default to `false`.
|
|
||||||
|
|
||||||
Settings supported:
|
|
||||||
|
|
||||||
* `trim` - Boolean. Whether or not to trim text and comment nodes.
|
|
||||||
* `normalize` - Boolean. If true, then turn any whitespace into a single
|
|
||||||
space.
|
|
||||||
* `lowercase` - Boolean. If true, then lowercase tag names and attribute names
|
|
||||||
in loose mode, rather than uppercasing them.
|
|
||||||
* `xmlns` - Boolean. If true, then namespaces are supported.
|
|
||||||
* `position` - Boolean. If false, then don't track line/col/position.
|
|
||||||
|
|
||||||
## Methods
|
|
||||||
|
|
||||||
`write` - Write bytes onto the stream. You don't have to do this all at
|
|
||||||
once. You can keep writing as much as you want.
|
|
||||||
|
|
||||||
`close` - Close the stream. Once closed, no more data may be written until
|
|
||||||
it is done processing the buffer, which is signaled by the `end` event.
|
|
||||||
|
|
||||||
`resume` - To gracefully handle errors, assign a listener to the `error`
|
|
||||||
event. Then, when the error is taken care of, you can call `resume` to
|
|
||||||
continue parsing. Otherwise, the parser will not continue while in an error
|
|
||||||
state.
|
|
||||||
|
|
||||||
## Members
|
|
||||||
|
|
||||||
At all times, the parser object will have the following members:
|
|
||||||
|
|
||||||
`line`, `column`, `position` - Indications of the position in the XML
|
|
||||||
document where the parser currently is looking.
|
|
||||||
|
|
||||||
`startTagPosition` - Indicates the position where the current tag starts.
|
|
||||||
|
|
||||||
`closed` - Boolean indicating whether or not the parser can be written to.
|
|
||||||
If it's `true`, then wait for the `ready` event to write again.
|
|
||||||
|
|
||||||
`strict` - Boolean indicating whether or not the parser is a jerk.
|
|
||||||
|
|
||||||
`opt` - Any options passed into the constructor.
|
|
||||||
|
|
||||||
`tag` - The current tag being dealt with.
|
|
||||||
|
|
||||||
And a bunch of other stuff that you probably shouldn't touch.
|
|
||||||
|
|
||||||
## Events
|
|
||||||
|
|
||||||
All events emit with a single argument. To listen to an event, assign a
|
|
||||||
function to `on<eventname>`. Functions get executed in the this-context of
|
|
||||||
the parser object. The list of supported events are also in the exported
|
|
||||||
`EVENTS` array.
|
|
||||||
|
|
||||||
When using the stream interface, assign handlers using the EventEmitter
|
|
||||||
`on` function in the normal fashion.
|
|
||||||
|
|
||||||
`error` - Indication that something bad happened. The error will be hanging
|
|
||||||
out on `parser.error`, and must be deleted before parsing can continue. By
|
|
||||||
listening to this event, you can keep an eye on that kind of stuff. Note:
|
|
||||||
this happens *much* more in strict mode. Argument: instance of `Error`.
|
|
||||||
|
|
||||||
`text` - Text node. Argument: string of text.
|
|
||||||
|
|
||||||
`doctype` - The `<!DOCTYPE` declaration. Argument: doctype string.
|
|
||||||
|
|
||||||
`processinginstruction` - Stuff like `<?xml foo="blerg" ?>`. Argument:
|
|
||||||
object with `name` and `body` members. Attributes are not parsed, as
|
|
||||||
processing instructions have implementation dependent semantics.
|
|
||||||
|
|
||||||
`sgmldeclaration` - Random SGML declarations. Stuff like `<!ENTITY p>`
|
|
||||||
would trigger this kind of event. This is a weird thing to support, so it
|
|
||||||
might go away at some point. SAX isn't intended to be used to parse SGML,
|
|
||||||
after all.
|
|
||||||
|
|
||||||
`opentag` - An opening tag. Argument: object with `name` and `attributes`.
|
|
||||||
In non-strict mode, tag names are uppercased, unless the `lowercase`
|
|
||||||
option is set. If the `xmlns` option is set, then it will contain
|
|
||||||
namespace binding information on the `ns` member, and will have a
|
|
||||||
`local`, `prefix`, and `uri` member.
|
|
||||||
|
|
||||||
`closetag` - A closing tag. In loose mode, tags are auto-closed if their
|
|
||||||
parent closes. In strict mode, well-formedness is enforced. Note that
|
|
||||||
self-closing tags will have `closeTag` emitted immediately after `openTag`.
|
|
||||||
Argument: tag name.
|
|
||||||
|
|
||||||
`attribute` - An attribute node. Argument: object with `name` and `value`.
|
|
||||||
In non-strict mode, attribute names are uppercased, unless the `lowercase`
|
|
||||||
option is set. If the `xmlns` option is set, it will also contains namespace
|
|
||||||
information.
|
|
||||||
|
|
||||||
`comment` - A comment node. Argument: the string of the comment.
|
|
||||||
|
|
||||||
`opencdata` - The opening tag of a `<![CDATA[` block.
|
|
||||||
|
|
||||||
`cdata` - The text of a `<![CDATA[` block. Since `<![CDATA[` blocks can get
|
|
||||||
quite large, this event may fire multiple times for a single block, if it
|
|
||||||
is broken up into multiple `write()`s. Argument: the string of random
|
|
||||||
character data.
|
|
||||||
|
|
||||||
`closecdata` - The closing tag (`]]>`) of a `<![CDATA[` block.
|
|
||||||
|
|
||||||
`opennamespace` - If the `xmlns` option is set, then this event will
|
|
||||||
signal the start of a new namespace binding.
|
|
||||||
|
|
||||||
`closenamespace` - If the `xmlns` option is set, then this event will
|
|
||||||
signal the end of a namespace binding.
|
|
||||||
|
|
||||||
`end` - Indication that the closed stream has ended.
|
|
||||||
|
|
||||||
`ready` - Indication that the stream has reset, and is ready to be written
|
|
||||||
to.
|
|
||||||
|
|
||||||
`noscript` - In non-strict mode, `<script>` tags trigger a `"script"`
|
|
||||||
event, and their contents are not checked for special xml characters.
|
|
||||||
If you pass `noscript: true`, then this behavior is suppressed.
|
|
||||||
|
|
||||||
## Reporting Problems
|
|
||||||
|
|
||||||
It's best to write a failing test if you find an issue. I will always
|
|
||||||
accept pull requests with failing tests if they demonstrate intended
|
|
||||||
behavior, but it is very hard to figure out what issue you're describing
|
|
||||||
without a test. Writing a test is also the best way for you yourself
|
|
||||||
to figure out if you really understand the issue you think you have with
|
|
||||||
sax-js.
|
|
||||||
8002
node_modules/xml2js/node_modules/sax/examples/big-not-pretty.xml
generated
vendored
8002
node_modules/xml2js/node_modules/sax/examples/big-not-pretty.xml
generated
vendored
File diff suppressed because it is too large
Load Diff
41
node_modules/xml2js/node_modules/sax/examples/example.js
generated
vendored
41
node_modules/xml2js/node_modules/sax/examples/example.js
generated
vendored
@@ -1,41 +0,0 @@
|
|||||||
|
|
||||||
var fs = require("fs"),
|
|
||||||
util = require('util'),
|
|
||||||
path = require("path"),
|
|
||||||
xml = fs.cat(path.join(__dirname, "test.xml")),
|
|
||||||
sax = require("../lib/sax"),
|
|
||||||
strict = sax.parser(true),
|
|
||||||
loose = sax.parser(false, {trim:true}),
|
|
||||||
inspector = function (ev) { return function (data) {
|
|
||||||
// util.error("");
|
|
||||||
// util.error(ev+": "+util.inspect(data));
|
|
||||||
// for (var i in data) util.error(i+ " "+util.inspect(data[i]));
|
|
||||||
// util.error(this.line+":"+this.column);
|
|
||||||
}};
|
|
||||||
|
|
||||||
xml.addCallback(function (xml) {
|
|
||||||
// strict.write(xml);
|
|
||||||
|
|
||||||
sax.EVENTS.forEach(function (ev) {
|
|
||||||
loose["on"+ev] = inspector(ev);
|
|
||||||
});
|
|
||||||
loose.onend = function () {
|
|
||||||
// util.error("end");
|
|
||||||
// util.error(util.inspect(loose));
|
|
||||||
};
|
|
||||||
|
|
||||||
// do this one char at a time to verify that it works.
|
|
||||||
// (function () {
|
|
||||||
// if (xml) {
|
|
||||||
// loose.write(xml.substr(0,1000));
|
|
||||||
// xml = xml.substr(1000);
|
|
||||||
// process.nextTick(arguments.callee);
|
|
||||||
// } else loose.close();
|
|
||||||
// })();
|
|
||||||
|
|
||||||
for (var i = 0; i < 1000; i ++) {
|
|
||||||
loose.write(xml);
|
|
||||||
loose.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
58
node_modules/xml2js/node_modules/sax/examples/get-products.js
generated
vendored
58
node_modules/xml2js/node_modules/sax/examples/get-products.js
generated
vendored
@@ -1,58 +0,0 @@
|
|||||||
// pull out /GeneralSearchResponse/categories/category/items/product tags
|
|
||||||
// the rest we don't care about.
|
|
||||||
|
|
||||||
var sax = require("../lib/sax.js")
|
|
||||||
var fs = require("fs")
|
|
||||||
var path = require("path")
|
|
||||||
var xmlFile = path.resolve(__dirname, "shopping.xml")
|
|
||||||
var util = require("util")
|
|
||||||
var http = require("http")
|
|
||||||
|
|
||||||
fs.readFile(xmlFile, function (er, d) {
|
|
||||||
http.createServer(function (req, res) {
|
|
||||||
if (er) throw er
|
|
||||||
var xmlstr = d.toString("utf8")
|
|
||||||
|
|
||||||
var parser = sax.parser(true)
|
|
||||||
var products = []
|
|
||||||
var product = null
|
|
||||||
var currentTag = null
|
|
||||||
|
|
||||||
parser.onclosetag = function (tagName) {
|
|
||||||
if (tagName === "product") {
|
|
||||||
products.push(product)
|
|
||||||
currentTag = product = null
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (currentTag && currentTag.parent) {
|
|
||||||
var p = currentTag.parent
|
|
||||||
delete currentTag.parent
|
|
||||||
currentTag = p
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
parser.onopentag = function (tag) {
|
|
||||||
if (tag.name !== "product" && !product) return
|
|
||||||
if (tag.name === "product") {
|
|
||||||
product = tag
|
|
||||||
}
|
|
||||||
tag.parent = currentTag
|
|
||||||
tag.children = []
|
|
||||||
tag.parent && tag.parent.children.push(tag)
|
|
||||||
currentTag = tag
|
|
||||||
}
|
|
||||||
|
|
||||||
parser.ontext = function (text) {
|
|
||||||
if (currentTag) currentTag.children.push(text)
|
|
||||||
}
|
|
||||||
|
|
||||||
parser.onend = function () {
|
|
||||||
var out = util.inspect(products, false, 3, true)
|
|
||||||
res.writeHead(200, {"content-type":"application/json"})
|
|
||||||
res.end("{\"ok\":true}")
|
|
||||||
// res.end(JSON.stringify(products))
|
|
||||||
}
|
|
||||||
|
|
||||||
parser.write(xmlstr).end()
|
|
||||||
}).listen(1337)
|
|
||||||
})
|
|
||||||
4
node_modules/xml2js/node_modules/sax/examples/hello-world.js
generated
vendored
4
node_modules/xml2js/node_modules/sax/examples/hello-world.js
generated
vendored
@@ -1,4 +0,0 @@
|
|||||||
require("http").createServer(function (req, res) {
|
|
||||||
res.writeHead(200, {"content-type":"application/json"})
|
|
||||||
res.end(JSON.stringify({ok: true}))
|
|
||||||
}).listen(1337)
|
|
||||||
8
node_modules/xml2js/node_modules/sax/examples/not-pretty.xml
generated
vendored
8
node_modules/xml2js/node_modules/sax/examples/not-pretty.xml
generated
vendored
@@ -1,8 +0,0 @@
|
|||||||
<root>
|
|
||||||
something<else> blerm <slurm
|
|
||||||
|
|
||||||
|
|
||||||
attrib =
|
|
||||||
"blorg" ></else><!-- COMMENT!
|
|
||||||
|
|
||||||
--><![CDATA[processing...]]> <selfclosing tag="blr>""/> a bit down here</root>
|
|
||||||
74
node_modules/xml2js/node_modules/sax/examples/pretty-print.js
generated
vendored
74
node_modules/xml2js/node_modules/sax/examples/pretty-print.js
generated
vendored
@@ -1,74 +0,0 @@
|
|||||||
var sax = require("../lib/sax")
|
|
||||||
, printer = sax.createStream(false, {lowercasetags:true, trim:true})
|
|
||||||
, fs = require("fs")
|
|
||||||
|
|
||||||
function entity (str) {
|
|
||||||
return str.replace('"', '"')
|
|
||||||
}
|
|
||||||
|
|
||||||
printer.tabstop = 2
|
|
||||||
printer.level = 0
|
|
||||||
printer.indent = function () {
|
|
||||||
print("\n")
|
|
||||||
for (var i = this.level; i > 0; i --) {
|
|
||||||
for (var j = this.tabstop; j > 0; j --) {
|
|
||||||
print(" ")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printer.on("opentag", function (tag) {
|
|
||||||
this.indent()
|
|
||||||
this.level ++
|
|
||||||
print("<"+tag.name)
|
|
||||||
for (var i in tag.attributes) {
|
|
||||||
print(" "+i+"=\""+entity(tag.attributes[i])+"\"")
|
|
||||||
}
|
|
||||||
print(">")
|
|
||||||
})
|
|
||||||
|
|
||||||
printer.on("text", ontext)
|
|
||||||
printer.on("doctype", ontext)
|
|
||||||
function ontext (text) {
|
|
||||||
this.indent()
|
|
||||||
print(text)
|
|
||||||
}
|
|
||||||
|
|
||||||
printer.on("closetag", function (tag) {
|
|
||||||
this.level --
|
|
||||||
this.indent()
|
|
||||||
print("</"+tag+">")
|
|
||||||
})
|
|
||||||
|
|
||||||
printer.on("cdata", function (data) {
|
|
||||||
this.indent()
|
|
||||||
print("<![CDATA["+data+"]]>")
|
|
||||||
})
|
|
||||||
|
|
||||||
printer.on("comment", function (comment) {
|
|
||||||
this.indent()
|
|
||||||
print("<!--"+comment+"-->")
|
|
||||||
})
|
|
||||||
|
|
||||||
printer.on("error", function (error) {
|
|
||||||
console.error(error)
|
|
||||||
throw error
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!process.argv[2]) {
|
|
||||||
throw new Error("Please provide an xml file to prettify\n"+
|
|
||||||
"TODO: read from stdin or take a file")
|
|
||||||
}
|
|
||||||
var xmlfile = require("path").join(process.cwd(), process.argv[2])
|
|
||||||
var fstr = fs.createReadStream(xmlfile, { encoding: "utf8" })
|
|
||||||
|
|
||||||
function print (c) {
|
|
||||||
if (!process.stdout.write(c)) {
|
|
||||||
fstr.pause()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
process.stdout.on("drain", function () {
|
|
||||||
fstr.resume()
|
|
||||||
})
|
|
||||||
|
|
||||||
fstr.pipe(printer)
|
|
||||||
2
node_modules/xml2js/node_modules/sax/examples/shopping.xml
generated
vendored
2
node_modules/xml2js/node_modules/sax/examples/shopping.xml
generated
vendored
File diff suppressed because one or more lines are too long
870
node_modules/xml2js/node_modules/sax/examples/strict.dtd
generated
vendored
870
node_modules/xml2js/node_modules/sax/examples/strict.dtd
generated
vendored
@@ -1,870 +0,0 @@
|
|||||||
<!--
|
|
||||||
This is HTML 4.01 Strict DTD, which excludes the presentation
|
|
||||||
attributes and elements that W3C expects to phase out as
|
|
||||||
support for style sheets matures. Authors should use the Strict
|
|
||||||
DTD when possible, but may use the Transitional DTD when support
|
|
||||||
for presentation attribute and elements is required.
|
|
||||||
|
|
||||||
HTML 4 includes mechanisms for style sheets, scripting,
|
|
||||||
embedding objects, improved support for right to left and mixed
|
|
||||||
direction text, and enhancements to forms for improved
|
|
||||||
accessibility for people with disabilities.
|
|
||||||
|
|
||||||
Draft: $Date: 1999/12/24 23:37:48 $
|
|
||||||
|
|
||||||
Authors:
|
|
||||||
Dave Raggett <dsr@w3.org>
|
|
||||||
Arnaud Le Hors <lehors@w3.org>
|
|
||||||
Ian Jacobs <ij@w3.org>
|
|
||||||
|
|
||||||
Further information about HTML 4.01 is available at:
|
|
||||||
|
|
||||||
http://www.w3.org/TR/1999/REC-html401-19991224
|
|
||||||
|
|
||||||
|
|
||||||
The HTML 4.01 specification includes additional
|
|
||||||
syntactic constraints that cannot be expressed within
|
|
||||||
the DTDs.
|
|
||||||
|
|
||||||
-->
|
|
||||||
<!--
|
|
||||||
Typical usage:
|
|
||||||
|
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
|
||||||
"http://www.w3.org/TR/html4/strict.dtd">
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
...
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
...
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
The URI used as a system identifier with the public identifier allows
|
|
||||||
the user agent to download the DTD and entity sets as needed.
|
|
||||||
|
|
||||||
The FPI for the Transitional HTML 4.01 DTD is:
|
|
||||||
|
|
||||||
"-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
||||||
|
|
||||||
This version of the transitional DTD is:
|
|
||||||
|
|
||||||
http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd
|
|
||||||
|
|
||||||
If you are writing a document that includes frames, use
|
|
||||||
the following FPI:
|
|
||||||
|
|
||||||
"-//W3C//DTD HTML 4.01 Frameset//EN"
|
|
||||||
|
|
||||||
This version of the frameset DTD is:
|
|
||||||
|
|
||||||
http://www.w3.org/TR/1999/REC-html401-19991224/frameset.dtd
|
|
||||||
|
|
||||||
Use the following (relative) URIs to refer to
|
|
||||||
the DTDs and entity definitions of this specification:
|
|
||||||
|
|
||||||
"strict.dtd"
|
|
||||||
"loose.dtd"
|
|
||||||
"frameset.dtd"
|
|
||||||
"HTMLlat1.ent"
|
|
||||||
"HTMLsymbol.ent"
|
|
||||||
"HTMLspecial.ent"
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!--================== Imported Names ====================================-->
|
|
||||||
<!-- Feature Switch for frameset documents -->
|
|
||||||
<!ENTITY % HTML.Frameset "IGNORE">
|
|
||||||
|
|
||||||
<!ENTITY % ContentType "CDATA"
|
|
||||||
-- media type, as per [RFC2045]
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!ENTITY % ContentTypes "CDATA"
|
|
||||||
-- comma-separated list of media types, as per [RFC2045]
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!ENTITY % Charset "CDATA"
|
|
||||||
-- a character encoding, as per [RFC2045]
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!ENTITY % Charsets "CDATA"
|
|
||||||
-- a space-separated list of character encodings, as per [RFC2045]
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!ENTITY % LanguageCode "NAME"
|
|
||||||
-- a language code, as per [RFC1766]
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!ENTITY % Character "CDATA"
|
|
||||||
-- a single character from [ISO10646]
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!ENTITY % LinkTypes "CDATA"
|
|
||||||
-- space-separated list of link types
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!ENTITY % MediaDesc "CDATA"
|
|
||||||
-- single or comma-separated list of media descriptors
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!ENTITY % URI "CDATA"
|
|
||||||
-- a Uniform Resource Identifier,
|
|
||||||
see [URI]
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!ENTITY % Datetime "CDATA" -- date and time information. ISO date format -->
|
|
||||||
|
|
||||||
|
|
||||||
<!ENTITY % Script "CDATA" -- script expression -->
|
|
||||||
|
|
||||||
<!ENTITY % StyleSheet "CDATA" -- style sheet data -->
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!ENTITY % Text "CDATA">
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Parameter Entities -->
|
|
||||||
|
|
||||||
<!ENTITY % head.misc "SCRIPT|STYLE|META|LINK|OBJECT" -- repeatable head elements -->
|
|
||||||
|
|
||||||
<!ENTITY % heading "H1|H2|H3|H4|H5|H6">
|
|
||||||
|
|
||||||
<!ENTITY % list "UL | OL">
|
|
||||||
|
|
||||||
<!ENTITY % preformatted "PRE">
|
|
||||||
|
|
||||||
|
|
||||||
<!--================ Character mnemonic entities =========================-->
|
|
||||||
|
|
||||||
<!ENTITY % HTMLlat1 PUBLIC
|
|
||||||
"-//W3C//ENTITIES Latin1//EN//HTML"
|
|
||||||
"HTMLlat1.ent">
|
|
||||||
%HTMLlat1;
|
|
||||||
|
|
||||||
<!ENTITY % HTMLsymbol PUBLIC
|
|
||||||
"-//W3C//ENTITIES Symbols//EN//HTML"
|
|
||||||
"HTMLsymbol.ent">
|
|
||||||
%HTMLsymbol;
|
|
||||||
|
|
||||||
<!ENTITY % HTMLspecial PUBLIC
|
|
||||||
"-//W3C//ENTITIES Special//EN//HTML"
|
|
||||||
"HTMLspecial.ent">
|
|
||||||
%HTMLspecial;
|
|
||||||
<!--=================== Generic Attributes ===============================-->
|
|
||||||
|
|
||||||
<!ENTITY % coreattrs
|
|
||||||
"id ID #IMPLIED -- document-wide unique id --
|
|
||||||
class CDATA #IMPLIED -- space-separated list of classes --
|
|
||||||
style %StyleSheet; #IMPLIED -- associated style info --
|
|
||||||
title %Text; #IMPLIED -- advisory title --"
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ENTITY % i18n
|
|
||||||
"lang %LanguageCode; #IMPLIED -- language code --
|
|
||||||
dir (ltr|rtl) #IMPLIED -- direction for weak/neutral text --"
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ENTITY % events
|
|
||||||
"onclick %Script; #IMPLIED -- a pointer button was clicked --
|
|
||||||
ondblclick %Script; #IMPLIED -- a pointer button was double clicked--
|
|
||||||
onmousedown %Script; #IMPLIED -- a pointer button was pressed down --
|
|
||||||
onmouseup %Script; #IMPLIED -- a pointer button was released --
|
|
||||||
onmouseover %Script; #IMPLIED -- a pointer was moved onto --
|
|
||||||
onmousemove %Script; #IMPLIED -- a pointer was moved within --
|
|
||||||
onmouseout %Script; #IMPLIED -- a pointer was moved away --
|
|
||||||
onkeypress %Script; #IMPLIED -- a key was pressed and released --
|
|
||||||
onkeydown %Script; #IMPLIED -- a key was pressed down --
|
|
||||||
onkeyup %Script; #IMPLIED -- a key was released --"
|
|
||||||
>
|
|
||||||
|
|
||||||
<!-- Reserved Feature Switch -->
|
|
||||||
<!ENTITY % HTML.Reserved "IGNORE">
|
|
||||||
|
|
||||||
<!-- The following attributes are reserved for possible future use -->
|
|
||||||
<![ %HTML.Reserved; [
|
|
||||||
<!ENTITY % reserved
|
|
||||||
"datasrc %URI; #IMPLIED -- a single or tabular Data Source --
|
|
||||||
datafld CDATA #IMPLIED -- the property or column name --
|
|
||||||
dataformatas (plaintext|html) plaintext -- text or html --"
|
|
||||||
>
|
|
||||||
]]>
|
|
||||||
|
|
||||||
<!ENTITY % reserved "">
|
|
||||||
|
|
||||||
<!ENTITY % attrs "%coreattrs; %i18n; %events;">
|
|
||||||
|
|
||||||
|
|
||||||
<!--=================== Text Markup ======================================-->
|
|
||||||
|
|
||||||
<!ENTITY % fontstyle
|
|
||||||
"TT | I | B | BIG | SMALL">
|
|
||||||
|
|
||||||
<!ENTITY % phrase "EM | STRONG | DFN | CODE |
|
|
||||||
SAMP | KBD | VAR | CITE | ABBR | ACRONYM" >
|
|
||||||
|
|
||||||
<!ENTITY % special
|
|
||||||
"A | IMG | OBJECT | BR | SCRIPT | MAP | Q | SUB | SUP | SPAN | BDO">
|
|
||||||
|
|
||||||
<!ENTITY % formctrl "INPUT | SELECT | TEXTAREA | LABEL | BUTTON">
|
|
||||||
|
|
||||||
<!-- %inline; covers inline or "text-level" elements -->
|
|
||||||
<!ENTITY % inline "#PCDATA | %fontstyle; | %phrase; | %special; | %formctrl;">
|
|
||||||
|
|
||||||
<!ELEMENT (%fontstyle;|%phrase;) - - (%inline;)*>
|
|
||||||
<!ATTLIST (%fontstyle;|%phrase;)
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT (SUB|SUP) - - (%inline;)* -- subscript, superscript -->
|
|
||||||
<!ATTLIST (SUB|SUP)
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT SPAN - - (%inline;)* -- generic language/style container -->
|
|
||||||
<!ATTLIST SPAN
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
%reserved; -- reserved for possible future use --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT BDO - - (%inline;)* -- I18N BiDi over-ride -->
|
|
||||||
<!ATTLIST BDO
|
|
||||||
%coreattrs; -- id, class, style, title --
|
|
||||||
lang %LanguageCode; #IMPLIED -- language code --
|
|
||||||
dir (ltr|rtl) #REQUIRED -- directionality --
|
|
||||||
>
|
|
||||||
|
|
||||||
|
|
||||||
<!ELEMENT BR - O EMPTY -- forced line break -->
|
|
||||||
<!ATTLIST BR
|
|
||||||
%coreattrs; -- id, class, style, title --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--================== HTML content models ===============================-->
|
|
||||||
|
|
||||||
<!--
|
|
||||||
HTML has two basic content models:
|
|
||||||
|
|
||||||
%inline; character level elements and text strings
|
|
||||||
%block; block-like elements e.g. paragraphs and lists
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!ENTITY % block
|
|
||||||
"P | %heading; | %list; | %preformatted; | DL | DIV | NOSCRIPT |
|
|
||||||
BLOCKQUOTE | FORM | HR | TABLE | FIELDSET | ADDRESS">
|
|
||||||
|
|
||||||
<!ENTITY % flow "%block; | %inline;">
|
|
||||||
|
|
||||||
<!--=================== Document Body ====================================-->
|
|
||||||
|
|
||||||
<!ELEMENT BODY O O (%block;|SCRIPT)+ +(INS|DEL) -- document body -->
|
|
||||||
<!ATTLIST BODY
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
onload %Script; #IMPLIED -- the document has been loaded --
|
|
||||||
onunload %Script; #IMPLIED -- the document has been removed --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT ADDRESS - - (%inline;)* -- information on author -->
|
|
||||||
<!ATTLIST ADDRESS
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT DIV - - (%flow;)* -- generic language/style container -->
|
|
||||||
<!ATTLIST DIV
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
%reserved; -- reserved for possible future use --
|
|
||||||
>
|
|
||||||
|
|
||||||
|
|
||||||
<!--================== The Anchor Element ================================-->
|
|
||||||
|
|
||||||
<!ENTITY % Shape "(rect|circle|poly|default)">
|
|
||||||
<!ENTITY % Coords "CDATA" -- comma-separated list of lengths -->
|
|
||||||
|
|
||||||
<!ELEMENT A - - (%inline;)* -(A) -- anchor -->
|
|
||||||
<!ATTLIST A
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
charset %Charset; #IMPLIED -- char encoding of linked resource --
|
|
||||||
type %ContentType; #IMPLIED -- advisory content type --
|
|
||||||
name CDATA #IMPLIED -- named link end --
|
|
||||||
href %URI; #IMPLIED -- URI for linked resource --
|
|
||||||
hreflang %LanguageCode; #IMPLIED -- language code --
|
|
||||||
rel %LinkTypes; #IMPLIED -- forward link types --
|
|
||||||
rev %LinkTypes; #IMPLIED -- reverse link types --
|
|
||||||
accesskey %Character; #IMPLIED -- accessibility key character --
|
|
||||||
shape %Shape; rect -- for use with client-side image maps --
|
|
||||||
coords %Coords; #IMPLIED -- for use with client-side image maps --
|
|
||||||
tabindex NUMBER #IMPLIED -- position in tabbing order --
|
|
||||||
onfocus %Script; #IMPLIED -- the element got the focus --
|
|
||||||
onblur %Script; #IMPLIED -- the element lost the focus --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--================== Client-side image maps ============================-->
|
|
||||||
|
|
||||||
<!-- These can be placed in the same document or grouped in a
|
|
||||||
separate document although this isn't yet widely supported -->
|
|
||||||
|
|
||||||
<!ELEMENT MAP - - ((%block;) | AREA)+ -- client-side image map -->
|
|
||||||
<!ATTLIST MAP
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
name CDATA #REQUIRED -- for reference by usemap --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT AREA - O EMPTY -- client-side image map area -->
|
|
||||||
<!ATTLIST AREA
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
shape %Shape; rect -- controls interpretation of coords --
|
|
||||||
coords %Coords; #IMPLIED -- comma-separated list of lengths --
|
|
||||||
href %URI; #IMPLIED -- URI for linked resource --
|
|
||||||
nohref (nohref) #IMPLIED -- this region has no action --
|
|
||||||
alt %Text; #REQUIRED -- short description --
|
|
||||||
tabindex NUMBER #IMPLIED -- position in tabbing order --
|
|
||||||
accesskey %Character; #IMPLIED -- accessibility key character --
|
|
||||||
onfocus %Script; #IMPLIED -- the element got the focus --
|
|
||||||
onblur %Script; #IMPLIED -- the element lost the focus --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--================== The LINK Element ==================================-->
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Relationship values can be used in principle:
|
|
||||||
|
|
||||||
a) for document specific toolbars/menus when used
|
|
||||||
with the LINK element in document head e.g.
|
|
||||||
start, contents, previous, next, index, end, help
|
|
||||||
b) to link to a separate style sheet (rel=stylesheet)
|
|
||||||
c) to make a link to a script (rel=script)
|
|
||||||
d) by stylesheets to control how collections of
|
|
||||||
html nodes are rendered into printed documents
|
|
||||||
e) to make a link to a printable version of this document
|
|
||||||
e.g. a postscript or pdf version (rel=alternate media=print)
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!ELEMENT LINK - O EMPTY -- a media-independent link -->
|
|
||||||
<!ATTLIST LINK
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
charset %Charset; #IMPLIED -- char encoding of linked resource --
|
|
||||||
href %URI; #IMPLIED -- URI for linked resource --
|
|
||||||
hreflang %LanguageCode; #IMPLIED -- language code --
|
|
||||||
type %ContentType; #IMPLIED -- advisory content type --
|
|
||||||
rel %LinkTypes; #IMPLIED -- forward link types --
|
|
||||||
rev %LinkTypes; #IMPLIED -- reverse link types --
|
|
||||||
media %MediaDesc; #IMPLIED -- for rendering on these media --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--=================== Images ===========================================-->
|
|
||||||
|
|
||||||
<!-- Length defined in strict DTD for cellpadding/cellspacing -->
|
|
||||||
<!ENTITY % Length "CDATA" -- nn for pixels or nn% for percentage length -->
|
|
||||||
<!ENTITY % MultiLength "CDATA" -- pixel, percentage, or relative -->
|
|
||||||
|
|
||||||
<![ %HTML.Frameset; [
|
|
||||||
<!ENTITY % MultiLengths "CDATA" -- comma-separated list of MultiLength -->
|
|
||||||
]]>
|
|
||||||
|
|
||||||
<!ENTITY % Pixels "CDATA" -- integer representing length in pixels -->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- To avoid problems with text-only UAs as well as
|
|
||||||
to make image content understandable and navigable
|
|
||||||
to users of non-visual UAs, you need to provide
|
|
||||||
a description with ALT, and avoid server-side image maps -->
|
|
||||||
<!ELEMENT IMG - O EMPTY -- Embedded image -->
|
|
||||||
<!ATTLIST IMG
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
src %URI; #REQUIRED -- URI of image to embed --
|
|
||||||
alt %Text; #REQUIRED -- short description --
|
|
||||||
longdesc %URI; #IMPLIED -- link to long description
|
|
||||||
(complements alt) --
|
|
||||||
name CDATA #IMPLIED -- name of image for scripting --
|
|
||||||
height %Length; #IMPLIED -- override height --
|
|
||||||
width %Length; #IMPLIED -- override width --
|
|
||||||
usemap %URI; #IMPLIED -- use client-side image map --
|
|
||||||
ismap (ismap) #IMPLIED -- use server-side image map --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!-- USEMAP points to a MAP element which may be in this document
|
|
||||||
or an external document, although the latter is not widely supported -->
|
|
||||||
|
|
||||||
<!--==================== OBJECT ======================================-->
|
|
||||||
<!--
|
|
||||||
OBJECT is used to embed objects as part of HTML pages
|
|
||||||
PARAM elements should precede other content. SGML mixed content
|
|
||||||
model technicality precludes specifying this formally ...
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!ELEMENT OBJECT - - (PARAM | %flow;)*
|
|
||||||
-- generic embedded object -->
|
|
||||||
<!ATTLIST OBJECT
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
declare (declare) #IMPLIED -- declare but don't instantiate flag --
|
|
||||||
classid %URI; #IMPLIED -- identifies an implementation --
|
|
||||||
codebase %URI; #IMPLIED -- base URI for classid, data, archive--
|
|
||||||
data %URI; #IMPLIED -- reference to object's data --
|
|
||||||
type %ContentType; #IMPLIED -- content type for data --
|
|
||||||
codetype %ContentType; #IMPLIED -- content type for code --
|
|
||||||
archive CDATA #IMPLIED -- space-separated list of URIs --
|
|
||||||
standby %Text; #IMPLIED -- message to show while loading --
|
|
||||||
height %Length; #IMPLIED -- override height --
|
|
||||||
width %Length; #IMPLIED -- override width --
|
|
||||||
usemap %URI; #IMPLIED -- use client-side image map --
|
|
||||||
name CDATA #IMPLIED -- submit as part of form --
|
|
||||||
tabindex NUMBER #IMPLIED -- position in tabbing order --
|
|
||||||
%reserved; -- reserved for possible future use --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT PARAM - O EMPTY -- named property value -->
|
|
||||||
<!ATTLIST PARAM
|
|
||||||
id ID #IMPLIED -- document-wide unique id --
|
|
||||||
name CDATA #REQUIRED -- property name --
|
|
||||||
value CDATA #IMPLIED -- property value --
|
|
||||||
valuetype (DATA|REF|OBJECT) DATA -- How to interpret value --
|
|
||||||
type %ContentType; #IMPLIED -- content type for value
|
|
||||||
when valuetype=ref --
|
|
||||||
>
|
|
||||||
|
|
||||||
|
|
||||||
<!--=================== Horizontal Rule ==================================-->
|
|
||||||
|
|
||||||
<!ELEMENT HR - O EMPTY -- horizontal rule -->
|
|
||||||
<!ATTLIST HR
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--=================== Paragraphs =======================================-->
|
|
||||||
|
|
||||||
<!ELEMENT P - O (%inline;)* -- paragraph -->
|
|
||||||
<!ATTLIST P
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--=================== Headings =========================================-->
|
|
||||||
|
|
||||||
<!--
|
|
||||||
There are six levels of headings from H1 (the most important)
|
|
||||||
to H6 (the least important).
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!ELEMENT (%heading;) - - (%inline;)* -- heading -->
|
|
||||||
<!ATTLIST (%heading;)
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--=================== Preformatted Text ================================-->
|
|
||||||
|
|
||||||
<!-- excludes markup for images and changes in font size -->
|
|
||||||
<!ENTITY % pre.exclusion "IMG|OBJECT|BIG|SMALL|SUB|SUP">
|
|
||||||
|
|
||||||
<!ELEMENT PRE - - (%inline;)* -(%pre.exclusion;) -- preformatted text -->
|
|
||||||
<!ATTLIST PRE
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--===================== Inline Quotes ==================================-->
|
|
||||||
|
|
||||||
<!ELEMENT Q - - (%inline;)* -- short inline quotation -->
|
|
||||||
<!ATTLIST Q
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
cite %URI; #IMPLIED -- URI for source document or msg --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--=================== Block-like Quotes ================================-->
|
|
||||||
|
|
||||||
<!ELEMENT BLOCKQUOTE - - (%block;|SCRIPT)+ -- long quotation -->
|
|
||||||
<!ATTLIST BLOCKQUOTE
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
cite %URI; #IMPLIED -- URI for source document or msg --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--=================== Inserted/Deleted Text ============================-->
|
|
||||||
|
|
||||||
|
|
||||||
<!-- INS/DEL are handled by inclusion on BODY -->
|
|
||||||
<!ELEMENT (INS|DEL) - - (%flow;)* -- inserted text, deleted text -->
|
|
||||||
<!ATTLIST (INS|DEL)
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
cite %URI; #IMPLIED -- info on reason for change --
|
|
||||||
datetime %Datetime; #IMPLIED -- date and time of change --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--=================== Lists ============================================-->
|
|
||||||
|
|
||||||
<!-- definition lists - DT for term, DD for its definition -->
|
|
||||||
|
|
||||||
<!ELEMENT DL - - (DT|DD)+ -- definition list -->
|
|
||||||
<!ATTLIST DL
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT DT - O (%inline;)* -- definition term -->
|
|
||||||
<!ELEMENT DD - O (%flow;)* -- definition description -->
|
|
||||||
<!ATTLIST (DT|DD)
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
>
|
|
||||||
|
|
||||||
|
|
||||||
<!ELEMENT OL - - (LI)+ -- ordered list -->
|
|
||||||
<!ATTLIST OL
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!-- Unordered Lists (UL) bullet styles -->
|
|
||||||
<!ELEMENT UL - - (LI)+ -- unordered list -->
|
|
||||||
<!ATTLIST UL
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!ELEMENT LI - O (%flow;)* -- list item -->
|
|
||||||
<!ATTLIST LI
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--================ Forms ===============================================-->
|
|
||||||
<!ELEMENT FORM - - (%block;|SCRIPT)+ -(FORM) -- interactive form -->
|
|
||||||
<!ATTLIST FORM
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
action %URI; #REQUIRED -- server-side form handler --
|
|
||||||
method (GET|POST) GET -- HTTP method used to submit the form--
|
|
||||||
enctype %ContentType; "application/x-www-form-urlencoded"
|
|
||||||
accept %ContentTypes; #IMPLIED -- list of MIME types for file upload --
|
|
||||||
name CDATA #IMPLIED -- name of form for scripting --
|
|
||||||
onsubmit %Script; #IMPLIED -- the form was submitted --
|
|
||||||
onreset %Script; #IMPLIED -- the form was reset --
|
|
||||||
accept-charset %Charsets; #IMPLIED -- list of supported charsets --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!-- Each label must not contain more than ONE field -->
|
|
||||||
<!ELEMENT LABEL - - (%inline;)* -(LABEL) -- form field label text -->
|
|
||||||
<!ATTLIST LABEL
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
for IDREF #IMPLIED -- matches field ID value --
|
|
||||||
accesskey %Character; #IMPLIED -- accessibility key character --
|
|
||||||
onfocus %Script; #IMPLIED -- the element got the focus --
|
|
||||||
onblur %Script; #IMPLIED -- the element lost the focus --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ENTITY % InputType
|
|
||||||
"(TEXT | PASSWORD | CHECKBOX |
|
|
||||||
RADIO | SUBMIT | RESET |
|
|
||||||
FILE | HIDDEN | IMAGE | BUTTON)"
|
|
||||||
>
|
|
||||||
|
|
||||||
<!-- attribute name required for all but submit and reset -->
|
|
||||||
<!ELEMENT INPUT - O EMPTY -- form control -->
|
|
||||||
<!ATTLIST INPUT
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
type %InputType; TEXT -- what kind of widget is needed --
|
|
||||||
name CDATA #IMPLIED -- submit as part of form --
|
|
||||||
value CDATA #IMPLIED -- Specify for radio buttons and checkboxes --
|
|
||||||
checked (checked) #IMPLIED -- for radio buttons and check boxes --
|
|
||||||
disabled (disabled) #IMPLIED -- unavailable in this context --
|
|
||||||
readonly (readonly) #IMPLIED -- for text and passwd --
|
|
||||||
size CDATA #IMPLIED -- specific to each type of field --
|
|
||||||
maxlength NUMBER #IMPLIED -- max chars for text fields --
|
|
||||||
src %URI; #IMPLIED -- for fields with images --
|
|
||||||
alt CDATA #IMPLIED -- short description --
|
|
||||||
usemap %URI; #IMPLIED -- use client-side image map --
|
|
||||||
ismap (ismap) #IMPLIED -- use server-side image map --
|
|
||||||
tabindex NUMBER #IMPLIED -- position in tabbing order --
|
|
||||||
accesskey %Character; #IMPLIED -- accessibility key character --
|
|
||||||
onfocus %Script; #IMPLIED -- the element got the focus --
|
|
||||||
onblur %Script; #IMPLIED -- the element lost the focus --
|
|
||||||
onselect %Script; #IMPLIED -- some text was selected --
|
|
||||||
onchange %Script; #IMPLIED -- the element value was changed --
|
|
||||||
accept %ContentTypes; #IMPLIED -- list of MIME types for file upload --
|
|
||||||
%reserved; -- reserved for possible future use --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT SELECT - - (OPTGROUP|OPTION)+ -- option selector -->
|
|
||||||
<!ATTLIST SELECT
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
name CDATA #IMPLIED -- field name --
|
|
||||||
size NUMBER #IMPLIED -- rows visible --
|
|
||||||
multiple (multiple) #IMPLIED -- default is single selection --
|
|
||||||
disabled (disabled) #IMPLIED -- unavailable in this context --
|
|
||||||
tabindex NUMBER #IMPLIED -- position in tabbing order --
|
|
||||||
onfocus %Script; #IMPLIED -- the element got the focus --
|
|
||||||
onblur %Script; #IMPLIED -- the element lost the focus --
|
|
||||||
onchange %Script; #IMPLIED -- the element value was changed --
|
|
||||||
%reserved; -- reserved for possible future use --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT OPTGROUP - - (OPTION)+ -- option group -->
|
|
||||||
<!ATTLIST OPTGROUP
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
disabled (disabled) #IMPLIED -- unavailable in this context --
|
|
||||||
label %Text; #REQUIRED -- for use in hierarchical menus --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT OPTION - O (#PCDATA) -- selectable choice -->
|
|
||||||
<!ATTLIST OPTION
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
selected (selected) #IMPLIED
|
|
||||||
disabled (disabled) #IMPLIED -- unavailable in this context --
|
|
||||||
label %Text; #IMPLIED -- for use in hierarchical menus --
|
|
||||||
value CDATA #IMPLIED -- defaults to element content --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT TEXTAREA - - (#PCDATA) -- multi-line text field -->
|
|
||||||
<!ATTLIST TEXTAREA
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
name CDATA #IMPLIED
|
|
||||||
rows NUMBER #REQUIRED
|
|
||||||
cols NUMBER #REQUIRED
|
|
||||||
disabled (disabled) #IMPLIED -- unavailable in this context --
|
|
||||||
readonly (readonly) #IMPLIED
|
|
||||||
tabindex NUMBER #IMPLIED -- position in tabbing order --
|
|
||||||
accesskey %Character; #IMPLIED -- accessibility key character --
|
|
||||||
onfocus %Script; #IMPLIED -- the element got the focus --
|
|
||||||
onblur %Script; #IMPLIED -- the element lost the focus --
|
|
||||||
onselect %Script; #IMPLIED -- some text was selected --
|
|
||||||
onchange %Script; #IMPLIED -- the element value was changed --
|
|
||||||
%reserved; -- reserved for possible future use --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
#PCDATA is to solve the mixed content problem,
|
|
||||||
per specification only whitespace is allowed there!
|
|
||||||
-->
|
|
||||||
<!ELEMENT FIELDSET - - (#PCDATA,LEGEND,(%flow;)*) -- form control group -->
|
|
||||||
<!ATTLIST FIELDSET
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT LEGEND - - (%inline;)* -- fieldset legend -->
|
|
||||||
|
|
||||||
<!ATTLIST LEGEND
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
accesskey %Character; #IMPLIED -- accessibility key character --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT BUTTON - -
|
|
||||||
(%flow;)* -(A|%formctrl;|FORM|FIELDSET)
|
|
||||||
-- push button -->
|
|
||||||
<!ATTLIST BUTTON
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
name CDATA #IMPLIED
|
|
||||||
value CDATA #IMPLIED -- sent to server when submitted --
|
|
||||||
type (button|submit|reset) submit -- for use as form button --
|
|
||||||
disabled (disabled) #IMPLIED -- unavailable in this context --
|
|
||||||
tabindex NUMBER #IMPLIED -- position in tabbing order --
|
|
||||||
accesskey %Character; #IMPLIED -- accessibility key character --
|
|
||||||
onfocus %Script; #IMPLIED -- the element got the focus --
|
|
||||||
onblur %Script; #IMPLIED -- the element lost the focus --
|
|
||||||
%reserved; -- reserved for possible future use --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--======================= Tables =======================================-->
|
|
||||||
|
|
||||||
<!-- IETF HTML table standard, see [RFC1942] -->
|
|
||||||
|
|
||||||
<!--
|
|
||||||
The BORDER attribute sets the thickness of the frame around the
|
|
||||||
table. The default units are screen pixels.
|
|
||||||
|
|
||||||
The FRAME attribute specifies which parts of the frame around
|
|
||||||
the table should be rendered. The values are not the same as
|
|
||||||
CALS to avoid a name clash with the VALIGN attribute.
|
|
||||||
|
|
||||||
The value "border" is included for backwards compatibility with
|
|
||||||
<TABLE BORDER> which yields frame=border and border=implied
|
|
||||||
For <TABLE BORDER=1> you get border=1 and frame=implied. In this
|
|
||||||
case, it is appropriate to treat this as frame=border for backwards
|
|
||||||
compatibility with deployed browsers.
|
|
||||||
-->
|
|
||||||
<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
The RULES attribute defines which rules to draw between cells:
|
|
||||||
|
|
||||||
If RULES is absent then assume:
|
|
||||||
"none" if BORDER is absent or BORDER=0 otherwise "all"
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!ENTITY % TRules "(none | groups | rows | cols | all)">
|
|
||||||
|
|
||||||
<!-- horizontal placement of table relative to document -->
|
|
||||||
<!ENTITY % TAlign "(left|center|right)">
|
|
||||||
|
|
||||||
<!-- horizontal alignment attributes for cell contents -->
|
|
||||||
<!ENTITY % cellhalign
|
|
||||||
"align (left|center|right|justify|char) #IMPLIED
|
|
||||||
char %Character; #IMPLIED -- alignment char, e.g. char=':' --
|
|
||||||
charoff %Length; #IMPLIED -- offset for alignment char --"
|
|
||||||
>
|
|
||||||
|
|
||||||
<!-- vertical alignment attributes for cell contents -->
|
|
||||||
<!ENTITY % cellvalign
|
|
||||||
"valign (top|middle|bottom|baseline) #IMPLIED"
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT TABLE - -
|
|
||||||
(CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)>
|
|
||||||
<!ELEMENT CAPTION - - (%inline;)* -- table caption -->
|
|
||||||
<!ELEMENT THEAD - O (TR)+ -- table header -->
|
|
||||||
<!ELEMENT TFOOT - O (TR)+ -- table footer -->
|
|
||||||
<!ELEMENT TBODY O O (TR)+ -- table body -->
|
|
||||||
<!ELEMENT COLGROUP - O (COL)* -- table column group -->
|
|
||||||
<!ELEMENT COL - O EMPTY -- table column -->
|
|
||||||
<!ELEMENT TR - O (TH|TD)+ -- table row -->
|
|
||||||
<!ELEMENT (TH|TD) - O (%flow;)* -- table header cell, table data cell-->
|
|
||||||
|
|
||||||
<!ATTLIST TABLE -- table element --
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
summary %Text; #IMPLIED -- purpose/structure for speech output--
|
|
||||||
width %Length; #IMPLIED -- table width --
|
|
||||||
border %Pixels; #IMPLIED -- controls frame width around table --
|
|
||||||
frame %TFrame; #IMPLIED -- which parts of frame to render --
|
|
||||||
rules %TRules; #IMPLIED -- rulings between rows and cols --
|
|
||||||
cellspacing %Length; #IMPLIED -- spacing between cells --
|
|
||||||
cellpadding %Length; #IMPLIED -- spacing within cells --
|
|
||||||
%reserved; -- reserved for possible future use --
|
|
||||||
datapagesize CDATA #IMPLIED -- reserved for possible future use --
|
|
||||||
>
|
|
||||||
|
|
||||||
|
|
||||||
<!ATTLIST CAPTION
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
COLGROUP groups a set of COL elements. It allows you to group
|
|
||||||
several semantically related columns together.
|
|
||||||
-->
|
|
||||||
<!ATTLIST COLGROUP
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
span NUMBER 1 -- default number of columns in group --
|
|
||||||
width %MultiLength; #IMPLIED -- default width for enclosed COLs --
|
|
||||||
%cellhalign; -- horizontal alignment in cells --
|
|
||||||
%cellvalign; -- vertical alignment in cells --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
COL elements define the alignment properties for cells in
|
|
||||||
one or more columns.
|
|
||||||
|
|
||||||
The WIDTH attribute specifies the width of the columns, e.g.
|
|
||||||
|
|
||||||
width=64 width in screen pixels
|
|
||||||
width=0.5* relative width of 0.5
|
|
||||||
|
|
||||||
The SPAN attribute causes the attributes of one
|
|
||||||
COL element to apply to more than one column.
|
|
||||||
-->
|
|
||||||
<!ATTLIST COL -- column groups and properties --
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
span NUMBER 1 -- COL attributes affect N columns --
|
|
||||||
width %MultiLength; #IMPLIED -- column width specification --
|
|
||||||
%cellhalign; -- horizontal alignment in cells --
|
|
||||||
%cellvalign; -- vertical alignment in cells --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Use THEAD to duplicate headers when breaking table
|
|
||||||
across page boundaries, or for static headers when
|
|
||||||
TBODY sections are rendered in scrolling panel.
|
|
||||||
|
|
||||||
Use TFOOT to duplicate footers when breaking table
|
|
||||||
across page boundaries, or for static footers when
|
|
||||||
TBODY sections are rendered in scrolling panel.
|
|
||||||
|
|
||||||
Use multiple TBODY sections when rules are needed
|
|
||||||
between groups of table rows.
|
|
||||||
-->
|
|
||||||
<!ATTLIST (THEAD|TBODY|TFOOT) -- table section --
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
%cellhalign; -- horizontal alignment in cells --
|
|
||||||
%cellvalign; -- vertical alignment in cells --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ATTLIST TR -- table row --
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
%cellhalign; -- horizontal alignment in cells --
|
|
||||||
%cellvalign; -- vertical alignment in cells --
|
|
||||||
>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Scope is simpler than headers attribute for common tables -->
|
|
||||||
<!ENTITY % Scope "(row|col|rowgroup|colgroup)">
|
|
||||||
|
|
||||||
<!-- TH is for headers, TD for data, but for cells acting as both use TD -->
|
|
||||||
<!ATTLIST (TH|TD) -- header or data cell --
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
abbr %Text; #IMPLIED -- abbreviation for header cell --
|
|
||||||
axis CDATA #IMPLIED -- comma-separated list of related headers--
|
|
||||||
headers IDREFS #IMPLIED -- list of id's for header cells --
|
|
||||||
scope %Scope; #IMPLIED -- scope covered by header cells --
|
|
||||||
rowspan NUMBER 1 -- number of rows spanned by cell --
|
|
||||||
colspan NUMBER 1 -- number of cols spanned by cell --
|
|
||||||
%cellhalign; -- horizontal alignment in cells --
|
|
||||||
%cellvalign; -- vertical alignment in cells --
|
|
||||||
>
|
|
||||||
|
|
||||||
|
|
||||||
<!--================ Document Head =======================================-->
|
|
||||||
<!-- %head.misc; defined earlier on as "SCRIPT|STYLE|META|LINK|OBJECT" -->
|
|
||||||
<!ENTITY % head.content "TITLE & BASE?">
|
|
||||||
|
|
||||||
<!ELEMENT HEAD O O (%head.content;) +(%head.misc;) -- document head -->
|
|
||||||
<!ATTLIST HEAD
|
|
||||||
%i18n; -- lang, dir --
|
|
||||||
profile %URI; #IMPLIED -- named dictionary of meta info --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!-- The TITLE element is not considered part of the flow of text.
|
|
||||||
It should be displayed, for example as the page header or
|
|
||||||
window title. Exactly one title is required per document.
|
|
||||||
-->
|
|
||||||
<!ELEMENT TITLE - - (#PCDATA) -(%head.misc;) -- document title -->
|
|
||||||
<!ATTLIST TITLE %i18n>
|
|
||||||
|
|
||||||
|
|
||||||
<!ELEMENT BASE - O EMPTY -- document base URI -->
|
|
||||||
<!ATTLIST BASE
|
|
||||||
href %URI; #REQUIRED -- URI that acts as base URI --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT META - O EMPTY -- generic metainformation -->
|
|
||||||
<!ATTLIST META
|
|
||||||
%i18n; -- lang, dir, for use with content --
|
|
||||||
http-equiv NAME #IMPLIED -- HTTP response header name --
|
|
||||||
name NAME #IMPLIED -- metainformation name --
|
|
||||||
content CDATA #REQUIRED -- associated information --
|
|
||||||
scheme CDATA #IMPLIED -- select form of content --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT STYLE - - %StyleSheet -- style info -->
|
|
||||||
<!ATTLIST STYLE
|
|
||||||
%i18n; -- lang, dir, for use with title --
|
|
||||||
type %ContentType; #REQUIRED -- content type of style language --
|
|
||||||
media %MediaDesc; #IMPLIED -- designed for use with these media --
|
|
||||||
title %Text; #IMPLIED -- advisory title --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT SCRIPT - - %Script; -- script statements -->
|
|
||||||
<!ATTLIST SCRIPT
|
|
||||||
charset %Charset; #IMPLIED -- char encoding of linked resource --
|
|
||||||
type %ContentType; #REQUIRED -- content type of script language --
|
|
||||||
src %URI; #IMPLIED -- URI for an external script --
|
|
||||||
defer (defer) #IMPLIED -- UA may defer execution of script --
|
|
||||||
event CDATA #IMPLIED -- reserved for possible future use --
|
|
||||||
for %URI; #IMPLIED -- reserved for possible future use --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!ELEMENT NOSCRIPT - - (%block;)+
|
|
||||||
-- alternate content container for non script-based rendering -->
|
|
||||||
<!ATTLIST NOSCRIPT
|
|
||||||
%attrs; -- %coreattrs, %i18n, %events --
|
|
||||||
>
|
|
||||||
|
|
||||||
<!--================ Document Structure ==================================-->
|
|
||||||
<!ENTITY % html.content "HEAD, BODY">
|
|
||||||
|
|
||||||
<!ELEMENT HTML O O (%html.content;) -- document root element -->
|
|
||||||
<!ATTLIST HTML
|
|
||||||
%i18n; -- lang, dir --
|
|
||||||
>
|
|
||||||
45
node_modules/xml2js/node_modules/sax/examples/switch-bench.js
generated
vendored
45
node_modules/xml2js/node_modules/sax/examples/switch-bench.js
generated
vendored
@@ -1,45 +0,0 @@
|
|||||||
#!/usr/local/bin/node-bench
|
|
||||||
|
|
||||||
var Promise = require("events").Promise;
|
|
||||||
|
|
||||||
var xml = require("posix").cat("test.xml").wait(),
|
|
||||||
path = require("path"),
|
|
||||||
sax = require("../lib/sax"),
|
|
||||||
saxT = require("../lib/sax-trampoline"),
|
|
||||||
|
|
||||||
parser = sax.parser(false, {trim:true}),
|
|
||||||
parserT = saxT.parser(false, {trim:true}),
|
|
||||||
|
|
||||||
sys = require("sys");
|
|
||||||
|
|
||||||
|
|
||||||
var count = exports.stepsPerLap = 500,
|
|
||||||
l = xml.length,
|
|
||||||
runs = 0;
|
|
||||||
exports.countPerLap = 1000;
|
|
||||||
exports.compare = {
|
|
||||||
"switch" : function () {
|
|
||||||
// sys.debug("switch runs: "+runs++);
|
|
||||||
// for (var x = 0; x < l; x += 1000) {
|
|
||||||
// parser.write(xml.substr(x, 1000))
|
|
||||||
// }
|
|
||||||
// for (var i = 0; i < count; i ++) {
|
|
||||||
parser.write(xml);
|
|
||||||
parser.close();
|
|
||||||
// }
|
|
||||||
// done();
|
|
||||||
},
|
|
||||||
trampoline : function () {
|
|
||||||
// sys.debug("trampoline runs: "+runs++);
|
|
||||||
// for (var x = 0; x < l; x += 1000) {
|
|
||||||
// parserT.write(xml.substr(x, 1000))
|
|
||||||
// }
|
|
||||||
// for (var i = 0; i < count; i ++) {
|
|
||||||
parserT.write(xml);
|
|
||||||
parserT.close();
|
|
||||||
// }
|
|
||||||
// done();
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
sys.debug("rock and roll...");
|
|
||||||
15
node_modules/xml2js/node_modules/sax/examples/test.html
generated
vendored
15
node_modules/xml2js/node_modules/sax/examples/test.html
generated
vendored
@@ -1,15 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<title>testing the parser</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<p>hello
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
1254
node_modules/xml2js/node_modules/sax/examples/test.xml
generated
vendored
1254
node_modules/xml2js/node_modules/sax/examples/test.xml
generated
vendored
File diff suppressed because it is too large
Load Diff
1016
node_modules/xml2js/node_modules/sax/lib/sax.js
generated
vendored
1016
node_modules/xml2js/node_modules/sax/lib/sax.js
generated
vendored
File diff suppressed because it is too large
Load Diff
67
node_modules/xml2js/node_modules/sax/package.json
generated
vendored
67
node_modules/xml2js/node_modules/sax/package.json
generated
vendored
File diff suppressed because one or more lines are too long
25
node_modules/xml2js/node_modules/sax/test/buffer-overrun.js
generated
vendored
25
node_modules/xml2js/node_modules/sax/test/buffer-overrun.js
generated
vendored
@@ -1,25 +0,0 @@
|
|||||||
// set this really low so that I don't have to put 64 MB of xml in here.
|
|
||||||
var sax = require("../lib/sax")
|
|
||||||
var bl = sax.MAX_BUFFER_LENGTH
|
|
||||||
sax.MAX_BUFFER_LENGTH = 5;
|
|
||||||
|
|
||||||
require(__dirname).test({
|
|
||||||
expect : [
|
|
||||||
["error", "Max buffer length exceeded: tagName\nLine: 0\nColumn: 15\nChar: "],
|
|
||||||
["error", "Max buffer length exceeded: tagName\nLine: 0\nColumn: 30\nChar: "],
|
|
||||||
["error", "Max buffer length exceeded: tagName\nLine: 0\nColumn: 45\nChar: "],
|
|
||||||
["opentag", {
|
|
||||||
"name": "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
|
||||||
"attributes": {}
|
|
||||||
}],
|
|
||||||
["text", "yo"],
|
|
||||||
["closetag", "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"]
|
|
||||||
]
|
|
||||||
}).write("<abcdefghijklmn")
|
|
||||||
.write("opqrstuvwxyzABC")
|
|
||||||
.write("DEFGHIJKLMNOPQR")
|
|
||||||
.write("STUVWXYZ>")
|
|
||||||
.write("yo")
|
|
||||||
.write("</abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ>")
|
|
||||||
.close();
|
|
||||||
sax.MAX_BUFFER_LENGTH = bl
|
|
||||||
47
node_modules/xml2js/node_modules/sax/test/case.js
generated
vendored
47
node_modules/xml2js/node_modules/sax/test/case.js
generated
vendored
@@ -1,47 +0,0 @@
|
|||||||
// default to uppercase
|
|
||||||
require(__dirname).test
|
|
||||||
( { xml :
|
|
||||||
"<span class=\"test\" hello=\"world\"></span>"
|
|
||||||
, expect :
|
|
||||||
[ [ "attribute", { name: "CLASS", value: "test" } ]
|
|
||||||
, [ "attribute", { name: "HELLO", value: "world" } ]
|
|
||||||
, [ "opentag", { name: "SPAN",
|
|
||||||
attributes: { CLASS: "test", HELLO: "world" } } ]
|
|
||||||
, [ "closetag", "SPAN" ]
|
|
||||||
]
|
|
||||||
, strict : false
|
|
||||||
, opt : {}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// lowercase option : lowercase tag/attribute names
|
|
||||||
require(__dirname).test
|
|
||||||
( { xml :
|
|
||||||
"<span class=\"test\" hello=\"world\"></span>"
|
|
||||||
, expect :
|
|
||||||
[ [ "attribute", { name: "class", value: "test" } ]
|
|
||||||
, [ "attribute", { name: "hello", value: "world" } ]
|
|
||||||
, [ "opentag", { name: "span",
|
|
||||||
attributes: { class: "test", hello: "world" } } ]
|
|
||||||
, [ "closetag", "span" ]
|
|
||||||
]
|
|
||||||
, strict : false
|
|
||||||
, opt : {lowercase:true}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// backward compatibility with old lowercasetags opt
|
|
||||||
require(__dirname).test
|
|
||||||
( { xml :
|
|
||||||
"<span class=\"test\" hello=\"world\"></span>"
|
|
||||||
, expect :
|
|
||||||
[ [ "attribute", { name: "class", value: "test" } ]
|
|
||||||
, [ "attribute", { name: "hello", value: "world" } ]
|
|
||||||
, [ "opentag", { name: "span",
|
|
||||||
attributes: { class: "test", hello: "world" } } ]
|
|
||||||
, [ "closetag", "span" ]
|
|
||||||
]
|
|
||||||
, strict : false
|
|
||||||
, opt : {lowercasetags:true}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
11
node_modules/xml2js/node_modules/sax/test/cdata-chunked.js
generated
vendored
11
node_modules/xml2js/node_modules/sax/test/cdata-chunked.js
generated
vendored
@@ -1,11 +0,0 @@
|
|||||||
|
|
||||||
require(__dirname).test({
|
|
||||||
expect : [
|
|
||||||
["opentag", {"name": "R","attributes": {}}],
|
|
||||||
["opencdata", undefined],
|
|
||||||
["cdata", " this is character data "],
|
|
||||||
["closecdata", undefined],
|
|
||||||
["closetag", "R"]
|
|
||||||
]
|
|
||||||
}).write("<r><![CDATA[ this is ").write("character data ").write("]]></r>").close();
|
|
||||||
|
|
||||||
15
node_modules/xml2js/node_modules/sax/test/cdata-end-split.js
generated
vendored
15
node_modules/xml2js/node_modules/sax/test/cdata-end-split.js
generated
vendored
@@ -1,15 +0,0 @@
|
|||||||
|
|
||||||
require(__dirname).test({
|
|
||||||
expect : [
|
|
||||||
["opentag", {"name": "R","attributes": {}}],
|
|
||||||
["opencdata", undefined],
|
|
||||||
["cdata", " this is "],
|
|
||||||
["closecdata", undefined],
|
|
||||||
["closetag", "R"]
|
|
||||||
]
|
|
||||||
})
|
|
||||||
.write("<r><![CDATA[ this is ]")
|
|
||||||
.write("]>")
|
|
||||||
.write("</r>")
|
|
||||||
.close();
|
|
||||||
|
|
||||||
28
node_modules/xml2js/node_modules/sax/test/cdata-fake-end.js
generated
vendored
28
node_modules/xml2js/node_modules/sax/test/cdata-fake-end.js
generated
vendored
@@ -1,28 +0,0 @@
|
|||||||
|
|
||||||
var p = require(__dirname).test({
|
|
||||||
expect : [
|
|
||||||
["opentag", {"name": "R","attributes": {}}],
|
|
||||||
["opencdata", undefined],
|
|
||||||
["cdata", "[[[[[[[[]]]]]]]]"],
|
|
||||||
["closecdata", undefined],
|
|
||||||
["closetag", "R"]
|
|
||||||
]
|
|
||||||
})
|
|
||||||
var x = "<r><![CDATA[[[[[[[[[]]]]]]]]]]></r>"
|
|
||||||
for (var i = 0; i < x.length ; i ++) {
|
|
||||||
p.write(x.charAt(i))
|
|
||||||
}
|
|
||||||
p.close();
|
|
||||||
|
|
||||||
|
|
||||||
var p2 = require(__dirname).test({
|
|
||||||
expect : [
|
|
||||||
["opentag", {"name": "R","attributes": {}}],
|
|
||||||
["opencdata", undefined],
|
|
||||||
["cdata", "[[[[[[[[]]]]]]]]"],
|
|
||||||
["closecdata", undefined],
|
|
||||||
["closetag", "R"]
|
|
||||||
]
|
|
||||||
})
|
|
||||||
var x = "<r><![CDATA[[[[[[[[[]]]]]]]]]]></r>"
|
|
||||||
p2.write(x).close();
|
|
||||||
15
node_modules/xml2js/node_modules/sax/test/cdata-multiple.js
generated
vendored
15
node_modules/xml2js/node_modules/sax/test/cdata-multiple.js
generated
vendored
@@ -1,15 +0,0 @@
|
|||||||
|
|
||||||
require(__dirname).test({
|
|
||||||
expect : [
|
|
||||||
["opentag", {"name": "R","attributes": {}}],
|
|
||||||
["opencdata", undefined],
|
|
||||||
["cdata", " this is "],
|
|
||||||
["closecdata", undefined],
|
|
||||||
["opencdata", undefined],
|
|
||||||
["cdata", "character data "],
|
|
||||||
["closecdata", undefined],
|
|
||||||
["closetag", "R"]
|
|
||||||
]
|
|
||||||
}).write("<r><![CDATA[ this is ]]>").write("<![CDA").write("T").write("A[")
|
|
||||||
.write("character data ").write("]]></r>").close();
|
|
||||||
|
|
||||||
10
node_modules/xml2js/node_modules/sax/test/cdata.js
generated
vendored
10
node_modules/xml2js/node_modules/sax/test/cdata.js
generated
vendored
@@ -1,10 +0,0 @@
|
|||||||
require(__dirname).test({
|
|
||||||
xml : "<r><![CDATA[ this is character data ]]></r>",
|
|
||||||
expect : [
|
|
||||||
["opentag", {"name": "R","attributes": {}}],
|
|
||||||
["opencdata", undefined],
|
|
||||||
["cdata", " this is character data "],
|
|
||||||
["closecdata", undefined],
|
|
||||||
["closetag", "R"]
|
|
||||||
]
|
|
||||||
});
|
|
||||||
86
node_modules/xml2js/node_modules/sax/test/index.js
generated
vendored
86
node_modules/xml2js/node_modules/sax/test/index.js
generated
vendored
@@ -1,86 +0,0 @@
|
|||||||
var globalsBefore = JSON.stringify(Object.keys(global))
|
|
||||||
, util = require("util")
|
|
||||||
, assert = require("assert")
|
|
||||||
, fs = require("fs")
|
|
||||||
, path = require("path")
|
|
||||||
, sax = require("../lib/sax")
|
|
||||||
|
|
||||||
exports.sax = sax
|
|
||||||
|
|
||||||
// handy way to do simple unit tests
|
|
||||||
// if the options contains an xml string, it'll be written and the parser closed.
|
|
||||||
// otherwise, it's assumed that the test will write and close.
|
|
||||||
exports.test = function test (options) {
|
|
||||||
var xml = options.xml
|
|
||||||
, parser = sax.parser(options.strict, options.opt)
|
|
||||||
, expect = options.expect
|
|
||||||
, e = 0
|
|
||||||
sax.EVENTS.forEach(function (ev) {
|
|
||||||
parser["on" + ev] = function (n) {
|
|
||||||
if (process.env.DEBUG) {
|
|
||||||
console.error({ expect: expect[e]
|
|
||||||
, actual: [ev, n] })
|
|
||||||
}
|
|
||||||
if (e >= expect.length && (ev === "end" || ev === "ready")) return
|
|
||||||
assert.ok( e < expect.length,
|
|
||||||
"expectation #"+e+" "+util.inspect(expect[e])+"\n"+
|
|
||||||
"Unexpected event: "+ev+" "+(n ? util.inspect(n) : ""))
|
|
||||||
var inspected = n instanceof Error ? "\n"+ n.message : util.inspect(n)
|
|
||||||
assert.equal(ev, expect[e][0],
|
|
||||||
"expectation #"+e+"\n"+
|
|
||||||
"Didn't get expected event\n"+
|
|
||||||
"expect: "+expect[e][0] + " " +util.inspect(expect[e][1])+"\n"+
|
|
||||||
"actual: "+ev+" "+inspected+"\n")
|
|
||||||
if (ev === "error") assert.equal(n.message, expect[e][1])
|
|
||||||
else assert.deepEqual(n, expect[e][1],
|
|
||||||
"expectation #"+e+"\n"+
|
|
||||||
"Didn't get expected argument\n"+
|
|
||||||
"expect: "+expect[e][0] + " " +util.inspect(expect[e][1])+"\n"+
|
|
||||||
"actual: "+ev+" "+inspected+"\n")
|
|
||||||
e++
|
|
||||||
if (ev === "error") parser.resume()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (xml) parser.write(xml).close()
|
|
||||||
return parser
|
|
||||||
}
|
|
||||||
|
|
||||||
if (module === require.main) {
|
|
||||||
var running = true
|
|
||||||
, failures = 0
|
|
||||||
|
|
||||||
function fail (file, er) {
|
|
||||||
util.error("Failed: "+file)
|
|
||||||
util.error(er.stack || er.message)
|
|
||||||
failures ++
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.readdir(__dirname, function (error, files) {
|
|
||||||
files = files.filter(function (file) {
|
|
||||||
return (/\.js$/.exec(file) && file !== 'index.js')
|
|
||||||
})
|
|
||||||
var n = files.length
|
|
||||||
, i = 0
|
|
||||||
console.log("0.." + n)
|
|
||||||
files.forEach(function (file) {
|
|
||||||
// run this test.
|
|
||||||
try {
|
|
||||||
require(path.resolve(__dirname, file))
|
|
||||||
var globalsAfter = JSON.stringify(Object.keys(global))
|
|
||||||
if (globalsAfter !== globalsBefore) {
|
|
||||||
var er = new Error("new globals introduced\n"+
|
|
||||||
"expected: "+globalsBefore+"\n"+
|
|
||||||
"actual: "+globalsAfter)
|
|
||||||
globalsBefore = globalsAfter
|
|
||||||
throw er
|
|
||||||
}
|
|
||||||
console.log("ok " + (++i) + " - " + file)
|
|
||||||
} catch (er) {
|
|
||||||
console.log("not ok "+ (++i) + " - " + file)
|
|
||||||
fail(file, er)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if (!failures) return console.log("#all pass")
|
|
||||||
else return console.error(failures + " failure" + (failures > 1 ? "s" : ""))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
43
node_modules/xml2js/node_modules/sax/test/issue-23.js
generated
vendored
43
node_modules/xml2js/node_modules/sax/test/issue-23.js
generated
vendored
@@ -1,43 +0,0 @@
|
|||||||
|
|
||||||
require(__dirname).test
|
|
||||||
( { xml :
|
|
||||||
"<compileClassesResponse>"+
|
|
||||||
"<result>"+
|
|
||||||
"<bodyCrc>653724009</bodyCrc>"+
|
|
||||||
"<column>-1</column>"+
|
|
||||||
"<id>01pG0000002KoSUIA0</id>"+
|
|
||||||
"<line>-1</line>"+
|
|
||||||
"<name>CalendarController</name>"+
|
|
||||||
"<success>true</success>"+
|
|
||||||
"</result>"+
|
|
||||||
"</compileClassesResponse>"
|
|
||||||
|
|
||||||
, expect :
|
|
||||||
[ [ "opentag", { name: "COMPILECLASSESRESPONSE", attributes: {} } ]
|
|
||||||
, [ "opentag", { name : "RESULT", attributes: {} } ]
|
|
||||||
, [ "opentag", { name: "BODYCRC", attributes: {} } ]
|
|
||||||
, [ "text", "653724009" ]
|
|
||||||
, [ "closetag", "BODYCRC" ]
|
|
||||||
, [ "opentag", { name: "COLUMN", attributes: {} } ]
|
|
||||||
, [ "text", "-1" ]
|
|
||||||
, [ "closetag", "COLUMN" ]
|
|
||||||
, [ "opentag", { name: "ID", attributes: {} } ]
|
|
||||||
, [ "text", "01pG0000002KoSUIA0" ]
|
|
||||||
, [ "closetag", "ID" ]
|
|
||||||
, [ "opentag", {name: "LINE", attributes: {} } ]
|
|
||||||
, [ "text", "-1" ]
|
|
||||||
, [ "closetag", "LINE" ]
|
|
||||||
, [ "opentag", {name: "NAME", attributes: {} } ]
|
|
||||||
, [ "text", "CalendarController" ]
|
|
||||||
, [ "closetag", "NAME" ]
|
|
||||||
, [ "opentag", {name: "SUCCESS", attributes: {} } ]
|
|
||||||
, [ "text", "true" ]
|
|
||||||
, [ "closetag", "SUCCESS" ]
|
|
||||||
, [ "closetag", "RESULT" ]
|
|
||||||
, [ "closetag", "COMPILECLASSESRESPONSE" ]
|
|
||||||
]
|
|
||||||
, strict : false
|
|
||||||
, opt : {}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
24
node_modules/xml2js/node_modules/sax/test/issue-30.js
generated
vendored
24
node_modules/xml2js/node_modules/sax/test/issue-30.js
generated
vendored
@@ -1,24 +0,0 @@
|
|||||||
// https://github.com/isaacs/sax-js/issues/33
|
|
||||||
require(__dirname).test
|
|
||||||
( { xml : "<xml>\n"+
|
|
||||||
"<!-- \n"+
|
|
||||||
" comment with a single dash- in it\n"+
|
|
||||||
"-->\n"+
|
|
||||||
"<data/>\n"+
|
|
||||||
"</xml>"
|
|
||||||
|
|
||||||
, expect :
|
|
||||||
[ [ "opentag", { name: "xml", attributes: {} } ]
|
|
||||||
, [ "text", "\n" ]
|
|
||||||
, [ "comment", " \n comment with a single dash- in it\n" ]
|
|
||||||
, [ "text", "\n" ]
|
|
||||||
, [ "opentag", { name: "data", attributes: {} } ]
|
|
||||||
, [ "closetag", "data" ]
|
|
||||||
, [ "text", "\n" ]
|
|
||||||
, [ "closetag", "xml" ]
|
|
||||||
]
|
|
||||||
, strict : true
|
|
||||||
, opt : {}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
15
node_modules/xml2js/node_modules/sax/test/issue-35.js
generated
vendored
15
node_modules/xml2js/node_modules/sax/test/issue-35.js
generated
vendored
@@ -1,15 +0,0 @@
|
|||||||
// https://github.com/isaacs/sax-js/issues/35
|
|
||||||
require(__dirname).test
|
|
||||||
( { xml : "<xml>

\n"+
|
|
||||||
"</xml>"
|
|
||||||
|
|
||||||
, expect :
|
|
||||||
[ [ "opentag", { name: "xml", attributes: {} } ]
|
|
||||||
, [ "text", "\r\r\n" ]
|
|
||||||
, [ "closetag", "xml" ]
|
|
||||||
]
|
|
||||||
, strict : true
|
|
||||||
, opt : {}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
13
node_modules/xml2js/node_modules/sax/test/issue-47.js
generated
vendored
13
node_modules/xml2js/node_modules/sax/test/issue-47.js
generated
vendored
@@ -1,13 +0,0 @@
|
|||||||
// https://github.com/isaacs/sax-js/issues/47
|
|
||||||
require(__dirname).test
|
|
||||||
( { xml : '<a href="query.svc?x=1&y=2&z=3"/>'
|
|
||||||
, expect : [
|
|
||||||
[ "attribute", { name:'href', value:"query.svc?x=1&y=2&z=3"} ],
|
|
||||||
[ "opentag", { name: "a", attributes: { href:"query.svc?x=1&y=2&z=3"} } ],
|
|
||||||
[ "closetag", "a" ]
|
|
||||||
]
|
|
||||||
, strict : true
|
|
||||||
, opt : {}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
31
node_modules/xml2js/node_modules/sax/test/issue-49.js
generated
vendored
31
node_modules/xml2js/node_modules/sax/test/issue-49.js
generated
vendored
@@ -1,31 +0,0 @@
|
|||||||
// https://github.com/isaacs/sax-js/issues/49
|
|
||||||
require(__dirname).test
|
|
||||||
( { xml : "<xml><script>hello world</script></xml>"
|
|
||||||
, expect :
|
|
||||||
[ [ "opentag", { name: "xml", attributes: {} } ]
|
|
||||||
, [ "opentag", { name: "script", attributes: {} } ]
|
|
||||||
, [ "text", "hello world" ]
|
|
||||||
, [ "closetag", "script" ]
|
|
||||||
, [ "closetag", "xml" ]
|
|
||||||
]
|
|
||||||
, strict : false
|
|
||||||
, opt : { lowercasetags: true, noscript: true }
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
require(__dirname).test
|
|
||||||
( { xml : "<xml><script><![CDATA[hello world]]></script></xml>"
|
|
||||||
, expect :
|
|
||||||
[ [ "opentag", { name: "xml", attributes: {} } ]
|
|
||||||
, [ "opentag", { name: "script", attributes: {} } ]
|
|
||||||
, [ "opencdata", undefined ]
|
|
||||||
, [ "cdata", "hello world" ]
|
|
||||||
, [ "closecdata", undefined ]
|
|
||||||
, [ "closetag", "script" ]
|
|
||||||
, [ "closetag", "xml" ]
|
|
||||||
]
|
|
||||||
, strict : false
|
|
||||||
, opt : { lowercasetags: true, noscript: true }
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
28
node_modules/xml2js/node_modules/sax/test/parser-position.js
generated
vendored
28
node_modules/xml2js/node_modules/sax/test/parser-position.js
generated
vendored
@@ -1,28 +0,0 @@
|
|||||||
var sax = require("../lib/sax"),
|
|
||||||
assert = require("assert")
|
|
||||||
|
|
||||||
function testPosition(chunks, expectedEvents) {
|
|
||||||
var parser = sax.parser();
|
|
||||||
expectedEvents.forEach(function(expectation) {
|
|
||||||
parser['on' + expectation[0]] = function() {
|
|
||||||
for (var prop in expectation[1]) {
|
|
||||||
assert.equal(parser[prop], expectation[1][prop]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
chunks.forEach(function(chunk) {
|
|
||||||
parser.write(chunk);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
testPosition(['<div>abcdefgh</div>'],
|
|
||||||
[ ['opentag', { position: 5, startTagPosition: 1 }]
|
|
||||||
, ['text', { position: 19, startTagPosition: 14 }]
|
|
||||||
, ['closetag', { position: 19, startTagPosition: 14 }]
|
|
||||||
]);
|
|
||||||
|
|
||||||
testPosition(['<div>abcde','fgh</div>'],
|
|
||||||
[ ['opentag', { position: 5, startTagPosition: 1 }]
|
|
||||||
, ['text', { position: 19, startTagPosition: 14 }]
|
|
||||||
, ['closetag', { position: 19, startTagPosition: 14 }]
|
|
||||||
]);
|
|
||||||
12
node_modules/xml2js/node_modules/sax/test/script.js
generated
vendored
12
node_modules/xml2js/node_modules/sax/test/script.js
generated
vendored
@@ -1,12 +0,0 @@
|
|||||||
require(__dirname).test({
|
|
||||||
xml : "<html><head><script>if (1 < 0) { console.log('elo there'); }</script></head></html>",
|
|
||||||
expect : [
|
|
||||||
["opentag", {"name": "HTML","attributes": {}}],
|
|
||||||
["opentag", {"name": "HEAD","attributes": {}}],
|
|
||||||
["opentag", {"name": "SCRIPT","attributes": {}}],
|
|
||||||
["script", "if (1 < 0) { console.log('elo there'); }"],
|
|
||||||
["closetag", "SCRIPT"],
|
|
||||||
["closetag", "HEAD"],
|
|
||||||
["closetag", "HTML"]
|
|
||||||
]
|
|
||||||
});
|
|
||||||
40
node_modules/xml2js/node_modules/sax/test/self-closing-child-strict.js
generated
vendored
40
node_modules/xml2js/node_modules/sax/test/self-closing-child-strict.js
generated
vendored
@@ -1,40 +0,0 @@
|
|||||||
|
|
||||||
require(__dirname).test({
|
|
||||||
xml :
|
|
||||||
"<root>"+
|
|
||||||
"<child>" +
|
|
||||||
"<haha />" +
|
|
||||||
"</child>" +
|
|
||||||
"<monkey>" +
|
|
||||||
"=(|)" +
|
|
||||||
"</monkey>" +
|
|
||||||
"</root>",
|
|
||||||
expect : [
|
|
||||||
["opentag", {
|
|
||||||
"name": "root",
|
|
||||||
"attributes": {}
|
|
||||||
}],
|
|
||||||
["opentag", {
|
|
||||||
"name": "child",
|
|
||||||
"attributes": {}
|
|
||||||
}],
|
|
||||||
["opentag", {
|
|
||||||
"name": "haha",
|
|
||||||
"attributes": {}
|
|
||||||
}],
|
|
||||||
["closetag", "haha"],
|
|
||||||
["closetag", "child"],
|
|
||||||
["opentag", {
|
|
||||||
"name": "monkey",
|
|
||||||
"attributes": {}
|
|
||||||
}],
|
|
||||||
["text", "=(|)"],
|
|
||||||
["closetag", "monkey"],
|
|
||||||
["closetag", "root"],
|
|
||||||
["end"],
|
|
||||||
["ready"]
|
|
||||||
],
|
|
||||||
strict : true,
|
|
||||||
opt : {}
|
|
||||||
});
|
|
||||||
|
|
||||||
40
node_modules/xml2js/node_modules/sax/test/self-closing-child.js
generated
vendored
40
node_modules/xml2js/node_modules/sax/test/self-closing-child.js
generated
vendored
@@ -1,40 +0,0 @@
|
|||||||
|
|
||||||
require(__dirname).test({
|
|
||||||
xml :
|
|
||||||
"<root>"+
|
|
||||||
"<child>" +
|
|
||||||
"<haha />" +
|
|
||||||
"</child>" +
|
|
||||||
"<monkey>" +
|
|
||||||
"=(|)" +
|
|
||||||
"</monkey>" +
|
|
||||||
"</root>",
|
|
||||||
expect : [
|
|
||||||
["opentag", {
|
|
||||||
"name": "ROOT",
|
|
||||||
"attributes": {}
|
|
||||||
}],
|
|
||||||
["opentag", {
|
|
||||||
"name": "CHILD",
|
|
||||||
"attributes": {}
|
|
||||||
}],
|
|
||||||
["opentag", {
|
|
||||||
"name": "HAHA",
|
|
||||||
"attributes": {}
|
|
||||||
}],
|
|
||||||
["closetag", "HAHA"],
|
|
||||||
["closetag", "CHILD"],
|
|
||||||
["opentag", {
|
|
||||||
"name": "MONKEY",
|
|
||||||
"attributes": {}
|
|
||||||
}],
|
|
||||||
["text", "=(|)"],
|
|
||||||
["closetag", "MONKEY"],
|
|
||||||
["closetag", "ROOT"],
|
|
||||||
["end"],
|
|
||||||
["ready"]
|
|
||||||
],
|
|
||||||
strict : false,
|
|
||||||
opt : {}
|
|
||||||
});
|
|
||||||
|
|
||||||
25
node_modules/xml2js/node_modules/sax/test/self-closing-tag.js
generated
vendored
25
node_modules/xml2js/node_modules/sax/test/self-closing-tag.js
generated
vendored
@@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
require(__dirname).test({
|
|
||||||
xml :
|
|
||||||
"<root> "+
|
|
||||||
"<haha /> "+
|
|
||||||
"<haha/> "+
|
|
||||||
"<monkey> "+
|
|
||||||
"=(|) "+
|
|
||||||
"</monkey>"+
|
|
||||||
"</root> ",
|
|
||||||
expect : [
|
|
||||||
["opentag", {name:"ROOT", attributes:{}}],
|
|
||||||
["opentag", {name:"HAHA", attributes:{}}],
|
|
||||||
["closetag", "HAHA"],
|
|
||||||
["opentag", {name:"HAHA", attributes:{}}],
|
|
||||||
["closetag", "HAHA"],
|
|
||||||
// ["opentag", {name:"HAHA", attributes:{}}],
|
|
||||||
// ["closetag", "HAHA"],
|
|
||||||
["opentag", {name:"MONKEY", attributes:{}}],
|
|
||||||
["text", "=(|)"],
|
|
||||||
["closetag", "MONKEY"],
|
|
||||||
["closetag", "ROOT"]
|
|
||||||
],
|
|
||||||
opt : { trim : true }
|
|
||||||
});
|
|
||||||
17
node_modules/xml2js/node_modules/sax/test/stray-ending.js
generated
vendored
17
node_modules/xml2js/node_modules/sax/test/stray-ending.js
generated
vendored
@@ -1,17 +0,0 @@
|
|||||||
// stray ending tags should just be ignored in non-strict mode.
|
|
||||||
// https://github.com/isaacs/sax-js/issues/32
|
|
||||||
require(__dirname).test
|
|
||||||
( { xml :
|
|
||||||
"<a><b></c></b></a>"
|
|
||||||
, expect :
|
|
||||||
[ [ "opentag", { name: "A", attributes: {} } ]
|
|
||||||
, [ "opentag", { name: "B", attributes: {} } ]
|
|
||||||
, [ "text", "</c>" ]
|
|
||||||
, [ "closetag", "B" ]
|
|
||||||
, [ "closetag", "A" ]
|
|
||||||
]
|
|
||||||
, strict : false
|
|
||||||
, opt : {}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
17
node_modules/xml2js/node_modules/sax/test/trailing-non-whitespace.js
generated
vendored
17
node_modules/xml2js/node_modules/sax/test/trailing-non-whitespace.js
generated
vendored
@@ -1,17 +0,0 @@
|
|||||||
|
|
||||||
require(__dirname).test({
|
|
||||||
xml : "<span>Welcome,</span> to monkey land",
|
|
||||||
expect : [
|
|
||||||
["opentag", {
|
|
||||||
"name": "SPAN",
|
|
||||||
"attributes": {}
|
|
||||||
}],
|
|
||||||
["text", "Welcome,"],
|
|
||||||
["closetag", "SPAN"],
|
|
||||||
["text", " to monkey land"],
|
|
||||||
["end"],
|
|
||||||
["ready"]
|
|
||||||
],
|
|
||||||
strict : false,
|
|
||||||
opt : {}
|
|
||||||
});
|
|
||||||
17
node_modules/xml2js/node_modules/sax/test/unquoted.js
generated
vendored
17
node_modules/xml2js/node_modules/sax/test/unquoted.js
generated
vendored
@@ -1,17 +0,0 @@
|
|||||||
// unquoted attributes should be ok in non-strict mode
|
|
||||||
// https://github.com/isaacs/sax-js/issues/31
|
|
||||||
require(__dirname).test
|
|
||||||
( { xml :
|
|
||||||
"<span class=test hello=world></span>"
|
|
||||||
, expect :
|
|
||||||
[ [ "attribute", { name: "CLASS", value: "test" } ]
|
|
||||||
, [ "attribute", { name: "HELLO", value: "world" } ]
|
|
||||||
, [ "opentag", { name: "SPAN",
|
|
||||||
attributes: { CLASS: "test", HELLO: "world" } } ]
|
|
||||||
, [ "closetag", "SPAN" ]
|
|
||||||
]
|
|
||||||
, strict : false
|
|
||||||
, opt : {}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
67
node_modules/xml2js/node_modules/sax/test/xmlns-issue-41.js
generated
vendored
67
node_modules/xml2js/node_modules/sax/test/xmlns-issue-41.js
generated
vendored
@@ -1,67 +0,0 @@
|
|||||||
var t = require(__dirname)
|
|
||||||
|
|
||||||
, xmls = // should be the same both ways.
|
|
||||||
[ "<parent xmlns:a='http://ATTRIBUTE' a:attr='value' />"
|
|
||||||
, "<parent a:attr='value' xmlns:a='http://ATTRIBUTE' />" ]
|
|
||||||
|
|
||||||
, ex1 =
|
|
||||||
[ [ "opennamespace"
|
|
||||||
, { prefix: "a"
|
|
||||||
, uri: "http://ATTRIBUTE"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
, [ "attribute"
|
|
||||||
, { name: "xmlns:a"
|
|
||||||
, value: "http://ATTRIBUTE"
|
|
||||||
, prefix: "xmlns"
|
|
||||||
, local: "a"
|
|
||||||
, uri: "http://www.w3.org/2000/xmlns/"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
, [ "attribute"
|
|
||||||
, { name: "a:attr"
|
|
||||||
, local: "attr"
|
|
||||||
, prefix: "a"
|
|
||||||
, uri: "http://ATTRIBUTE"
|
|
||||||
, value: "value"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
, [ "opentag"
|
|
||||||
, { name: "parent"
|
|
||||||
, uri: ""
|
|
||||||
, prefix: ""
|
|
||||||
, local: "parent"
|
|
||||||
, attributes:
|
|
||||||
{ "a:attr":
|
|
||||||
{ name: "a:attr"
|
|
||||||
, local: "attr"
|
|
||||||
, prefix: "a"
|
|
||||||
, uri: "http://ATTRIBUTE"
|
|
||||||
, value: "value"
|
|
||||||
}
|
|
||||||
, "xmlns:a":
|
|
||||||
{ name: "xmlns:a"
|
|
||||||
, local: "a"
|
|
||||||
, prefix: "xmlns"
|
|
||||||
, uri: "http://www.w3.org/2000/xmlns/"
|
|
||||||
, value: "http://ATTRIBUTE"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
, ns: {"a": "http://ATTRIBUTE"}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
, ["closetag", "parent"]
|
|
||||||
, ["closenamespace", { prefix: "a", uri: "http://ATTRIBUTE" }]
|
|
||||||
]
|
|
||||||
|
|
||||||
// swap the order of elements 2 and 1
|
|
||||||
, ex2 = [ex1[0], ex1[2], ex1[1]].concat(ex1.slice(3))
|
|
||||||
, expected = [ex1, ex2]
|
|
||||||
|
|
||||||
xmls.forEach(function (x, i) {
|
|
||||||
t.test({ xml: x
|
|
||||||
, expect: expected[i]
|
|
||||||
, strict: true
|
|
||||||
, opt: { xmlns: true }
|
|
||||||
})
|
|
||||||
})
|
|
||||||
59
node_modules/xml2js/node_modules/sax/test/xmlns-rebinding.js
generated
vendored
59
node_modules/xml2js/node_modules/sax/test/xmlns-rebinding.js
generated
vendored
@@ -1,59 +0,0 @@
|
|||||||
|
|
||||||
require(__dirname).test
|
|
||||||
( { xml :
|
|
||||||
"<root xmlns:x='x1' xmlns:y='y1' x:a='x1' y:a='y1'>"+
|
|
||||||
"<rebind xmlns:x='x2'>"+
|
|
||||||
"<check x:a='x2' y:a='y1'/>"+
|
|
||||||
"</rebind>"+
|
|
||||||
"<check x:a='x1' y:a='y1'/>"+
|
|
||||||
"</root>"
|
|
||||||
|
|
||||||
, expect :
|
|
||||||
[ [ "opennamespace", { prefix: "x", uri: "x1" } ]
|
|
||||||
, [ "opennamespace", { prefix: "y", uri: "y1" } ]
|
|
||||||
, [ "attribute", { name: "xmlns:x", value: "x1", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "x" } ]
|
|
||||||
, [ "attribute", { name: "xmlns:y", value: "y1", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "y" } ]
|
|
||||||
, [ "attribute", { name: "x:a", value: "x1", uri: "x1", prefix: "x", local: "a" } ]
|
|
||||||
, [ "attribute", { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } ]
|
|
||||||
, [ "opentag", { name: "root", uri: "", prefix: "", local: "root",
|
|
||||||
attributes: { "xmlns:x": { name: "xmlns:x", value: "x1", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "x" }
|
|
||||||
, "xmlns:y": { name: "xmlns:y", value: "y1", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "y" }
|
|
||||||
, "x:a": { name: "x:a", value: "x1", uri: "x1", prefix: "x", local: "a" }
|
|
||||||
, "y:a": { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } },
|
|
||||||
ns: { x: 'x1', y: 'y1' } } ]
|
|
||||||
|
|
||||||
, [ "opennamespace", { prefix: "x", uri: "x2" } ]
|
|
||||||
, [ "attribute", { name: "xmlns:x", value: "x2", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "x" } ]
|
|
||||||
, [ "opentag", { name: "rebind", uri: "", prefix: "", local: "rebind",
|
|
||||||
attributes: { "xmlns:x": { name: "xmlns:x", value: "x2", uri: "http://www.w3.org/2000/xmlns/", prefix: "xmlns", local: "x" } },
|
|
||||||
ns: { x: 'x2' } } ]
|
|
||||||
|
|
||||||
, [ "attribute", { name: "x:a", value: "x2", uri: "x2", prefix: "x", local: "a" } ]
|
|
||||||
, [ "attribute", { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } ]
|
|
||||||
, [ "opentag", { name: "check", uri: "", prefix: "", local: "check",
|
|
||||||
attributes: { "x:a": { name: "x:a", value: "x2", uri: "x2", prefix: "x", local: "a" }
|
|
||||||
, "y:a": { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } },
|
|
||||||
ns: { x: 'x2' } } ]
|
|
||||||
|
|
||||||
, [ "closetag", "check" ]
|
|
||||||
|
|
||||||
, [ "closetag", "rebind" ]
|
|
||||||
, [ "closenamespace", { prefix: "x", uri: "x2" } ]
|
|
||||||
|
|
||||||
, [ "attribute", { name: "x:a", value: "x1", uri: "x1", prefix: "x", local: "a" } ]
|
|
||||||
, [ "attribute", { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } ]
|
|
||||||
, [ "opentag", { name: "check", uri: "", prefix: "", local: "check",
|
|
||||||
attributes: { "x:a": { name: "x:a", value: "x1", uri: "x1", prefix: "x", local: "a" }
|
|
||||||
, "y:a": { name: "y:a", value: "y1", uri: "y1", prefix: "y", local: "a" } },
|
|
||||||
ns: { x: 'x1', y: 'y1' } } ]
|
|
||||||
, [ "closetag", "check" ]
|
|
||||||
|
|
||||||
, [ "closetag", "root" ]
|
|
||||||
, [ "closenamespace", { prefix: "x", uri: "x1" } ]
|
|
||||||
, [ "closenamespace", { prefix: "y", uri: "y1" } ]
|
|
||||||
]
|
|
||||||
, strict : true
|
|
||||||
, opt : { xmlns: true }
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
71
node_modules/xml2js/node_modules/sax/test/xmlns-strict.js
generated
vendored
71
node_modules/xml2js/node_modules/sax/test/xmlns-strict.js
generated
vendored
@@ -1,71 +0,0 @@
|
|||||||
|
|
||||||
require(__dirname).test
|
|
||||||
( { xml :
|
|
||||||
"<root>"+
|
|
||||||
"<plain attr='normal'/>"+
|
|
||||||
"<ns1 xmlns='uri:default'>"+
|
|
||||||
"<plain attr='normal'/>"+
|
|
||||||
"</ns1>"+
|
|
||||||
"<ns2 xmlns:a='uri:nsa'>"+
|
|
||||||
"<plain attr='normal'/>"+
|
|
||||||
"<a:ns a:attr='namespaced'/>"+
|
|
||||||
"</ns2>"+
|
|
||||||
"</root>"
|
|
||||||
|
|
||||||
, expect :
|
|
||||||
[ [ "opentag", { name: "root", prefix: "", local: "root", uri: "",
|
|
||||||
attributes: {}, ns: {} } ]
|
|
||||||
|
|
||||||
, [ "attribute", { name: "attr", value: "normal", prefix: "", local: "attr", uri: "" } ]
|
|
||||||
, [ "opentag", { name: "plain", prefix: "", local: "plain", uri: "",
|
|
||||||
attributes: { "attr": { name: "attr", value: "normal", uri: "", prefix: "", local: "attr", uri: "" } },
|
|
||||||
ns: {} } ]
|
|
||||||
, [ "closetag", "plain" ]
|
|
||||||
|
|
||||||
, [ "opennamespace", { prefix: "", uri: "uri:default" } ]
|
|
||||||
|
|
||||||
, [ "attribute", { name: "xmlns", value: "uri:default", prefix: "xmlns", local: "", uri: "http://www.w3.org/2000/xmlns/" } ]
|
|
||||||
, [ "opentag", { name: "ns1", prefix: "", local: "ns1", uri: "uri:default",
|
|
||||||
attributes: { "xmlns": { name: "xmlns", value: "uri:default", prefix: "xmlns", local: "", uri: "http://www.w3.org/2000/xmlns/" } },
|
|
||||||
ns: { "": "uri:default" } } ]
|
|
||||||
|
|
||||||
, [ "attribute", { name: "attr", value: "normal", prefix: "", local: "attr", uri: "" } ]
|
|
||||||
, [ "opentag", { name: "plain", prefix: "", local: "plain", uri: "uri:default", ns: { '': 'uri:default' },
|
|
||||||
attributes: { "attr": { name: "attr", value: "normal", prefix: "", local: "attr", uri: "" } } } ]
|
|
||||||
, [ "closetag", "plain" ]
|
|
||||||
|
|
||||||
, [ "closetag", "ns1" ]
|
|
||||||
|
|
||||||
, [ "closenamespace", { prefix: "", uri: "uri:default" } ]
|
|
||||||
|
|
||||||
, [ "opennamespace", { prefix: "a", uri: "uri:nsa" } ]
|
|
||||||
|
|
||||||
, [ "attribute", { name: "xmlns:a", value: "uri:nsa", prefix: "xmlns", local: "a", uri: "http://www.w3.org/2000/xmlns/" } ]
|
|
||||||
|
|
||||||
, [ "opentag", { name: "ns2", prefix: "", local: "ns2", uri: "",
|
|
||||||
attributes: { "xmlns:a": { name: "xmlns:a", value: "uri:nsa", prefix: "xmlns", local: "a", uri: "http://www.w3.org/2000/xmlns/" } },
|
|
||||||
ns: { a: "uri:nsa" } } ]
|
|
||||||
|
|
||||||
, [ "attribute", { name: "attr", value: "normal", prefix: "", local: "attr", uri: "" } ]
|
|
||||||
, [ "opentag", { name: "plain", prefix: "", local: "plain", uri: "",
|
|
||||||
attributes: { "attr": { name: "attr", value: "normal", prefix: "", local: "attr", uri: "" } },
|
|
||||||
ns: { a: 'uri:nsa' } } ]
|
|
||||||
, [ "closetag", "plain" ]
|
|
||||||
|
|
||||||
, [ "attribute", { name: "a:attr", value: "namespaced", prefix: "a", local: "attr", uri: "uri:nsa" } ]
|
|
||||||
, [ "opentag", { name: "a:ns", prefix: "a", local: "ns", uri: "uri:nsa",
|
|
||||||
attributes: { "a:attr": { name: "a:attr", value: "namespaced", prefix: "a", local: "attr", uri: "uri:nsa" } },
|
|
||||||
ns: { a: 'uri:nsa' } } ]
|
|
||||||
, [ "closetag", "a:ns" ]
|
|
||||||
|
|
||||||
, [ "closetag", "ns2" ]
|
|
||||||
|
|
||||||
, [ "closenamespace", { prefix: "a", uri: "uri:nsa" } ]
|
|
||||||
|
|
||||||
, [ "closetag", "root" ]
|
|
||||||
]
|
|
||||||
, strict : true
|
|
||||||
, opt : { xmlns: true }
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
15
node_modules/xml2js/node_modules/sax/test/xmlns-unbound.js
generated
vendored
15
node_modules/xml2js/node_modules/sax/test/xmlns-unbound.js
generated
vendored
@@ -1,15 +0,0 @@
|
|||||||
|
|
||||||
require(__dirname).test(
|
|
||||||
{ strict : true
|
|
||||||
, opt : { xmlns: true }
|
|
||||||
, expect :
|
|
||||||
[ ["error", "Unbound namespace prefix: \"unbound\"\nLine: 0\nColumn: 28\nChar: >"]
|
|
||||||
|
|
||||||
, [ "attribute", { name: "unbound:attr", value: "value", uri: "unbound", prefix: "unbound", local: "attr" } ]
|
|
||||||
, [ "opentag", { name: "root", uri: "", prefix: "", local: "root",
|
|
||||||
attributes: { "unbound:attr": { name: "unbound:attr", value: "value", uri: "unbound", prefix: "unbound", local: "attr" } },
|
|
||||||
ns: {} } ]
|
|
||||||
, [ "closetag", "root" ]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
).write("<root unbound:attr='value'/>")
|
|
||||||
30
node_modules/xml2js/node_modules/sax/test/xmlns-xml-default-ns.js
generated
vendored
30
node_modules/xml2js/node_modules/sax/test/xmlns-xml-default-ns.js
generated
vendored
@@ -1,30 +0,0 @@
|
|||||||
var xmlns_attr =
|
|
||||||
{
|
|
||||||
name: "xmlns", value: "http://foo", prefix: "xmlns",
|
|
||||||
local: "", uri : "http://www.w3.org/2000/xmlns/"
|
|
||||||
};
|
|
||||||
|
|
||||||
var attr_attr =
|
|
||||||
{
|
|
||||||
name: "attr", value: "bar", prefix: "",
|
|
||||||
local : "attr", uri : ""
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
require(__dirname).test
|
|
||||||
( { xml :
|
|
||||||
"<elm xmlns='http://foo' attr='bar'/>"
|
|
||||||
, expect :
|
|
||||||
[ [ "opennamespace", { prefix: "", uri: "http://foo" } ]
|
|
||||||
, [ "attribute", xmlns_attr ]
|
|
||||||
, [ "attribute", attr_attr ]
|
|
||||||
, [ "opentag", { name: "elm", prefix: "", local: "elm", uri : "http://foo",
|
|
||||||
ns : { "" : "http://foo" },
|
|
||||||
attributes: { xmlns: xmlns_attr, attr: attr_attr } } ]
|
|
||||||
, [ "closetag", "elm" ]
|
|
||||||
, [ "closenamespace", { prefix: "", uri: "http://foo"} ]
|
|
||||||
]
|
|
||||||
, strict : true
|
|
||||||
, opt : {xmlns: true}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
35
node_modules/xml2js/node_modules/sax/test/xmlns-xml-default-prefix-attribute.js
generated
vendored
35
node_modules/xml2js/node_modules/sax/test/xmlns-xml-default-prefix-attribute.js
generated
vendored
@@ -1,35 +0,0 @@
|
|||||||
require(__dirname).test(
|
|
||||||
{ xml : "<root xml:lang='en'/>"
|
|
||||||
, expect :
|
|
||||||
[ [ "attribute"
|
|
||||||
, { name: "xml:lang"
|
|
||||||
, local: "lang"
|
|
||||||
, prefix: "xml"
|
|
||||||
, uri: "http://www.w3.org/XML/1998/namespace"
|
|
||||||
, value: "en"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
, [ "opentag"
|
|
||||||
, { name: "root"
|
|
||||||
, uri: ""
|
|
||||||
, prefix: ""
|
|
||||||
, local: "root"
|
|
||||||
, attributes:
|
|
||||||
{ "xml:lang":
|
|
||||||
{ name: "xml:lang"
|
|
||||||
, local: "lang"
|
|
||||||
, prefix: "xml"
|
|
||||||
, uri: "http://www.w3.org/XML/1998/namespace"
|
|
||||||
, value: "en"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
, ns: {}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
, ["closetag", "root"]
|
|
||||||
]
|
|
||||||
, strict : true
|
|
||||||
, opt : { xmlns: true }
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
20
node_modules/xml2js/node_modules/sax/test/xmlns-xml-default-prefix.js
generated
vendored
20
node_modules/xml2js/node_modules/sax/test/xmlns-xml-default-prefix.js
generated
vendored
@@ -1,20 +0,0 @@
|
|||||||
require(__dirname).test(
|
|
||||||
{ xml : "<xml:root/>"
|
|
||||||
, expect :
|
|
||||||
[
|
|
||||||
[ "opentag"
|
|
||||||
, { name: "xml:root"
|
|
||||||
, uri: "http://www.w3.org/XML/1998/namespace"
|
|
||||||
, prefix: "xml"
|
|
||||||
, local: "root"
|
|
||||||
, attributes: {}
|
|
||||||
, ns: {}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
, ["closetag", "xml:root"]
|
|
||||||
]
|
|
||||||
, strict : true
|
|
||||||
, opt : { xmlns: true }
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
40
node_modules/xml2js/node_modules/sax/test/xmlns-xml-default-redefine.js
generated
vendored
40
node_modules/xml2js/node_modules/sax/test/xmlns-xml-default-redefine.js
generated
vendored
@@ -1,40 +0,0 @@
|
|||||||
require(__dirname).test(
|
|
||||||
{ xml : "<xml:root xmlns:xml='ERROR'/>"
|
|
||||||
, expect :
|
|
||||||
[ ["error"
|
|
||||||
, "xml: prefix must be bound to http://www.w3.org/XML/1998/namespace\n"
|
|
||||||
+ "Actual: ERROR\n"
|
|
||||||
+ "Line: 0\nColumn: 27\nChar: '"
|
|
||||||
]
|
|
||||||
, [ "attribute"
|
|
||||||
, { name: "xmlns:xml"
|
|
||||||
, local: "xml"
|
|
||||||
, prefix: "xmlns"
|
|
||||||
, uri: "http://www.w3.org/2000/xmlns/"
|
|
||||||
, value: "ERROR"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
, [ "opentag"
|
|
||||||
, { name: "xml:root"
|
|
||||||
, uri: "http://www.w3.org/XML/1998/namespace"
|
|
||||||
, prefix: "xml"
|
|
||||||
, local: "root"
|
|
||||||
, attributes:
|
|
||||||
{ "xmlns:xml":
|
|
||||||
{ name: "xmlns:xml"
|
|
||||||
, local: "xml"
|
|
||||||
, prefix: "xmlns"
|
|
||||||
, uri: "http://www.w3.org/2000/xmlns/"
|
|
||||||
, value: "ERROR"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
, ns: {}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
, ["closetag", "xml:root"]
|
|
||||||
]
|
|
||||||
, strict : true
|
|
||||||
, opt : { xmlns: true }
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
3
node_modules/xml2js/package.json
generated
vendored
3
node_modules/xml2js/package.json
generated
vendored
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@
|
|||||||
, "private": true
|
, "private": true
|
||||||
, "dependencies": {
|
, "dependencies": {
|
||||||
"formidable": ">= 0.0.1"
|
"formidable": ">= 0.0.1"
|
||||||
, "mongoskin": ">= 0.0.1"
|
, "mongodb": ">= 0.0.1"
|
||||||
, "socket.io": ">= 0.0.1"
|
, "socket.io": ">= 0.0.1"
|
||||||
, "dateformat": ">= 0.0.1"
|
, "dateformat": ">= 0.0.1"
|
||||||
, "request": "2.11.4"
|
, "request": "2.11.4"
|
||||||
|
|||||||
@@ -1,351 +1,249 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var socket = io.connect();
|
//makes buttons buttons
|
||||||
exercise_autocompletedata = "unset";
|
$("button").button();
|
||||||
bike_autocompletedata = "unset";
|
|
||||||
|
|
||||||
socket.emit('getactivites', 'please');
|
|
||||||
socket.emit('getexercises', 'please');
|
|
||||||
// socket.emit('getexpresso', 'please');
|
|
||||||
|
|
||||||
|
|
||||||
socket.on('populateactivities', function(json) {
|
// $("#ExerciseEditor").dialog({ autoOpen: false });
|
||||||
console.log('#poulate recieved');
|
// $( "#ExerciseEditor" ).dialog( "option", "minHeight", 330 );
|
||||||
var content = "";
|
// $( "#ExerciseEditor" ).dialog( "option", "minWidth", 630 );
|
||||||
$(".workoutdata").hide();
|
// $( "#ExerciseEditor" ).dialog({ buttons: [
|
||||||
$('#ActivityList').empty();
|
// {
|
||||||
$( "#ActivityList" ).html(
|
// text: "Close/Cancel",
|
||||||
$( "#movieTemplate1" ).render( json )
|
// click: function() { $(this).dialog("close"); }
|
||||||
);
|
// }
|
||||||
$(".ui-accordion-content").css("display", "block");
|
// ]
|
||||||
// $("#ActivityList").accordion('destroy').accordion({
|
// });
|
||||||
// header: 'h3',
|
|
||||||
// active: false,
|
|
||||||
// collapsible: true
|
|
||||||
// });
|
|
||||||
|
|
||||||
});
|
// $("button#openexercises").click(function() {
|
||||||
//poulate activity by id
|
// socket.emit('getexercises', 'please');
|
||||||
socket.on('populateactivitybyid', function(json) {
|
// $("#ExerciseEditor").dialog("open");
|
||||||
//set document id
|
// });
|
||||||
$('span.ActivityID').attr('docid',json._id);
|
|
||||||
//poulate name
|
|
||||||
$('input[name="Activities.Activity.name"]').attr('value', json.Activities.Activity.name)
|
|
||||||
//poulate date
|
|
||||||
$('input[name="Activities.Activity.date"]').attr('value', json.Activities.Activity.date)
|
|
||||||
// Activities.Activity.date
|
|
||||||
// for each lap
|
|
||||||
if ("Lap" in json.Activities.Activity) {
|
|
||||||
var array = json.Activities.Activity.Lap;
|
|
||||||
$.each(array, function(index, value) {
|
|
||||||
////if cardio
|
|
||||||
if ("cardio" in value) {
|
|
||||||
//get exercise muscledata
|
|
||||||
var lapmuscledata = exercise_autocompletedata[value.cardio.selection].muscledata.value;
|
|
||||||
AddPopulatedLap("Cardio", value.cardio.name, value.cardio.time, value.cardio.distance, "", "" , "", lapmuscledata)
|
|
||||||
|
|
||||||
};
|
// $("#Activity").dialog({ autoOpen: false });
|
||||||
////if exercise
|
// $( "#Activity" ).dialog( "option", "minHeight", 330 );
|
||||||
if ("exercise" in value) {
|
// $( "#Activity" ).dialog( "option", "minWidth", 730 );
|
||||||
//get exercise muscledata
|
// $( "#Activity" ).dialog({ buttons: [
|
||||||
console.log("selction = " + value.exercise.selection);
|
// {
|
||||||
var lapmuscledata = exercise_autocompletedata[value.exercise.selection].muscledata.value;
|
// text: "Close/Cancel",
|
||||||
AddPopulatedLap("Exercise", value.exercise.name, "", "", value.exercise.sets, value.exercise.reps , value.exercise.weight , lapmuscledata)
|
// click: function() { $(this).dialog("close"); }
|
||||||
};
|
// }
|
||||||
});
|
// ]
|
||||||
|
// });
|
||||||
|
|
||||||
};
|
// $("button#openactivities").click(function() {
|
||||||
$('#savecopy').attr('style', 'display: block');
|
// //
|
||||||
///refresh tabvle
|
// $("#Activity").dialog("open");
|
||||||
$('#sortable').trigger('sortupdate');
|
// });
|
||||||
|
|
||||||
//switch to tab
|
|
||||||
$( "#tabs" ).tabs( "select" , 1 )
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
function AddPopulatedLap(type, name, time, distance, sets, reps, weight, muscledata) {
|
//makes datepickers
|
||||||
console.log('type= ' + type);
|
$( "#datepicker" ).datepicker();
|
||||||
console.log('muscledata= ' + muscledata);
|
$('#Activity').find('input.datepicker').datepicker();
|
||||||
var newElem = $('.new-lap').clone(true).attr('style', 'display: block');
|
$('#Activity').find('input.datepicker').datepicker('setDate', new Date());
|
||||||
$(newElem).removeClass('new-lap');
|
|
||||||
$(newElem).appendTo('#sortable');
|
|
||||||
$(newElem).children('.laptype').val(type).trigger('change');
|
|
||||||
$(newElem).children('input').attr('disabled',false);
|
|
||||||
$(newElem).find('.lapname').attr('value', name);
|
|
||||||
$(newElem).find('.lapdistance').attr('value', distance);
|
|
||||||
$(newElem).find('.laptime').attr('value', time);
|
|
||||||
$(newElem).find('.sets').attr('value', sets);
|
|
||||||
$(newElem).find('.reps').attr('value', reps);
|
|
||||||
$(newElem).find('.weight').attr('value', weight);
|
|
||||||
$(newElem).find('.muscledata').attr('value', muscledata);
|
|
||||||
$(newElem).sortable( "refresh" );
|
|
||||||
};
|
|
||||||
|
|
||||||
//var addtype = $(this).attr('value');
|
var socket = io.connect();
|
||||||
//var newElem = $('.new-' + addtype).clone(true).attr('style', 'display: block');
|
exercise_autocompletedata = "unset";
|
||||||
//$(newElem).removeClass("new-" + addtype);
|
bike_autocompletedata = "unset";
|
||||||
//$(newElem).children('input').attr('disabled',false);
|
|
||||||
//$(newElem).appendTo('#sortable');
|
|
||||||
//$(newElem).sortable( "refresh" );
|
|
||||||
//$('#sortable').trigger('sortupdate');
|
|
||||||
|
|
||||||
////populate exercise sortable
|
//get intial data
|
||||||
socket.on('populateexercises', function(json) {
|
socket.emit('getactivites', 'please');
|
||||||
//console.log('#exercises recieved' + JSON.stringify(json, null, ' '));
|
socket.emit('getexercises', 'please');
|
||||||
var content = "";
|
socket.emit('getexerciselist', 'cardio');
|
||||||
$('ul#sortableexercises li').remove();
|
socket.emit('getexerciselist', 'weights');
|
||||||
$('span.ExerciseID').attr('docid',json[0]._id);
|
|
||||||
//$( "ul#sortableexercises" ).append('<li style="display: none"><input type="text" name="_id" value="'+ json[0]._id + '"></li>')
|
|
||||||
///// for loop
|
|
||||||
var array = json[0].exercise;
|
|
||||||
exercise_autocompletedata = array;
|
|
||||||
$('#sortable').trigger('sortupdate');
|
|
||||||
$.each(array, function(index, value) {
|
|
||||||
$( "ul#sortableexercises" ).append('<li class=ui-state-default><input type="text" name="exercise[].name" value="'+ value.name + '"><input type="text" name="exercise[].class" value="'+ value.class + '"><input type="text" name="exercise[].muscledata" value="'+ value.muscledata + '"><a href=# class=delete>delete</a></li>');
|
|
||||||
$('#sortableexercises').trigger('sortupdate');
|
|
||||||
});
|
|
||||||
|
|
||||||
////populate expresso sortable
|
socket.on('populateactivities', function(json) {
|
||||||
// socket.on('populateexpresso', function(json) {
|
console.log('#poulate recieved');
|
||||||
// //console.log('#tracks recieved' + JSON.stringify(json, null, ' '));
|
var content = "";
|
||||||
// var content = "";
|
$(".workoutdata").hide();
|
||||||
// $('ul#sortableexpresso li').remove();
|
$('#ActivityList').empty();
|
||||||
// $('span.ExpressoID').attr('docid',json[0]._id);
|
$( "#ActivityList" ).html(
|
||||||
// var barray = json[0].track.name;
|
$( "#movieTemplate1" ).render( json )
|
||||||
// bike_autocompletedata = barray;
|
);
|
||||||
// $('#sortable').trigger('sortupdate');
|
$(".ui-accordion-content").css("display", "block");
|
||||||
// $.each(barray, function(index, value) {
|
// $("#ActivityList").accordion('destroy').accordion({
|
||||||
// $( "ul#sortableexpresso" ).append('<li class=ui-state-default><input type="text" name="track.name[]" value="'+ value + '"></li>')
|
// header: 'h3',
|
||||||
// });
|
// active: false,
|
||||||
// });
|
// collapsible: true
|
||||||
|
// });
|
||||||
|
});
|
||||||
|
//poulate activity by id
|
||||||
|
socket.on('populateactivitybyid', function(json) {
|
||||||
|
// clear it first
|
||||||
|
$('ul#sortable li').remove('.removable');
|
||||||
|
$('span.ActivityID').removeAttr('docid');
|
||||||
|
$('#Activity').find('input').attr('value','');
|
||||||
|
$('#Activity').find('input.datepicker').datepicker();
|
||||||
|
$('#Activity').find('input.datepicker').datepicker('setDate', new Date());
|
||||||
|
|
||||||
|
//set document id
|
||||||
|
$('span.ActivityID').attr('docid',json._id);
|
||||||
|
//poulate name
|
||||||
|
// $('input[name="Activities.Activity.name"]').attr('value', json.Activities.Activity.name)
|
||||||
|
//poulate date
|
||||||
|
$('input[name="Activities.Activity.date"]').attr('value', json.Activities.Activity.date)
|
||||||
|
// Activities.Activity.date
|
||||||
|
// for each lap
|
||||||
|
if ("Lap" in json.Activities.Activity) {
|
||||||
|
var array = json.Activities.Activity.Lap;
|
||||||
|
$.each(array, function(index, value) {
|
||||||
|
////if cardio
|
||||||
|
if (value.class == "Cardio" ) {
|
||||||
|
//get exercise muscledata
|
||||||
|
var lapmuscledata = "123123";
|
||||||
|
AddPopulatedLap("Cardio", value.name, value.time, value.distance, "", "" , "", lapmuscledata)
|
||||||
|
};
|
||||||
|
////if exercise
|
||||||
|
if (value.class == "Exercise" ) {
|
||||||
|
//get exercise muscledata
|
||||||
|
console.log("selction = " + value.selection);
|
||||||
|
var lapmuscledata = "123123";
|
||||||
|
AddPopulatedLap("Exercise", value.name, "", "", value.sets, value.reps , value.weight , lapmuscledata)
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
///refresh table
|
||||||
|
$('#sortable').trigger('sortupdate');
|
||||||
|
|
||||||
// //THe TABs stuff
|
});
|
||||||
// $( "#tabs" ).tabs();
|
|
||||||
// $( "#tabs" ).tabs('select' , 0);
|
|
||||||
//sets buttons to be jquery buttons
|
|
||||||
$("button").button();
|
|
||||||
//sets datepickers
|
|
||||||
$( "#datepicker" ).datepicker();
|
|
||||||
|
|
||||||
|
|
||||||
$( "#tabs" ).bind( "tabsselect", function(event, ui) {
|
function AddPopulatedLap(type, name, time, distance, sets, reps, weight, muscledata) {
|
||||||
if (ui.index == 0) {
|
console.log('type= ' + type);
|
||||||
console.log('send stuff ' + ui.index );
|
console.log('muscledata= ' + muscledata);
|
||||||
socket.emit('getactivites', 'please');
|
var newElem = $('.new-lap').clone(true).attr('style', 'display: block');
|
||||||
};
|
$(newElem).removeClass('new-lap');
|
||||||
if (ui.index == 2) {
|
$(newElem).appendTo('#sortable');
|
||||||
console.log('send stuff ' + ui.index );
|
$(newElem).children('.laptype').val(type).trigger('change');
|
||||||
socket.emit('getexercises', 'please');
|
$(newElem).children('input').attr('disabled',false);
|
||||||
};
|
$(newElem).find('.lapname').attr('value', name);
|
||||||
});
|
$(newElem).find('.lapdistance').attr('value', distance);
|
||||||
|
$(newElem).find('.laptime').attr('value', time);
|
||||||
$('#ActivityList').delegate('a.activitydelete', 'click', function() {
|
$(newElem).find('.sets').attr('value', sets);
|
||||||
socket.emit('delactivity', $(this).attr('title'));
|
$(newElem).find('.reps').attr('value', reps);
|
||||||
return false;
|
$(newElem).find('.weight').attr('value', weight);
|
||||||
});
|
$(newElem).find('.muscledata').attr('value', muscledata);
|
||||||
|
$(newElem).sortable( "refresh" );
|
||||||
$('#ActivityList').delegate('a.activityedit', 'click', function() {
|
};
|
||||||
socket.emit('getactivitybyid', $(this).attr('title'));
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
//THe Sortable Stuff
|
|
||||||
$("#sortable").sortable({
|
|
||||||
placeholder: "ui-state-highlight",
|
|
||||||
revert: true,
|
|
||||||
stop: function(event, ui) {
|
|
||||||
$('#sortable').trigger('sortupdate')
|
|
||||||
},
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#sortable").bind('sortupdate', function(event, ui) {
|
|
||||||
|
|
||||||
|
|
||||||
$('#sortable li').each(function(){
|
|
||||||
var itemindex= $(this).index()
|
|
||||||
$(this).children('label.uiindex').html('Exercise '+ itemindex );
|
|
||||||
$(this).find('input').each(function(){
|
|
||||||
var newname = $(this).attr('name').replace(/\[[0-9]*\]/,'[' + itemindex + ']');
|
|
||||||
$(this).attr("name",newname);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$(this).find('input.exertags').autocomplete({source: exercise_autocompletedata});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#sortableexercises").sortable({
|
|
||||||
placeholder: "ui-state-highlight",
|
|
||||||
revert: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#sortableexercises").bind('sortupdate', function(event, ui) {
|
|
||||||
$('#sortableexercises li').each(function(){
|
|
||||||
var itemindex= $(this).index()
|
|
||||||
$(this).find('input, select').each(function(){
|
|
||||||
var newname = $(this).attr('name').replace(/\[[0-9]*\]/,'[' + itemindex + ']');
|
|
||||||
console.log('newname' + newname );
|
|
||||||
$(this).attr("name",newname);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$('ul').on('click', '.delete',function() {
|
|
||||||
$(this).closest('li').remove();
|
|
||||||
$('#sortable').trigger('sortupdate')
|
|
||||||
// $('#sortableexercises').trigger('sortupdate')
|
|
||||||
});
|
|
||||||
|
|
||||||
///All the Buttons
|
|
||||||
$("button").button();
|
|
||||||
|
|
||||||
//adds selectable element
|
|
||||||
$("button").click(function() {
|
|
||||||
var addtype = $(this).attr('value');
|
|
||||||
var newElem = $('.new-' + addtype).clone(true).attr('style', 'display: block');
|
|
||||||
$(newElem).removeClass("new-" + addtype);
|
|
||||||
$(newElem).children('input').attr('disabled',false);
|
|
||||||
$(newElem).appendTo('#sortable');
|
|
||||||
$(newElem).sortable( "refresh" );
|
|
||||||
|
|
||||||
|
|
||||||
$('#sortable').trigger('sortupdate');
|
|
||||||
//$('#sortableexercises').trigger('sortupdate');
|
|
||||||
});
|
|
||||||
|
|
||||||
$("button.AddExercise").click(function() {
|
|
||||||
$( "ul#sortableexercises" ).append('<li class=ui-state-default><input type="text" name="exercise[].name" hint="Name" placeholder="Exercise Name"><input type="text" name="exercise[].class" placeholder="cardio or weights"><input type="text" name="exercise[].muscledata" hint="Muscle Array" placeholder="Muscle Array"><a href=# class=delete>delete</a></li>')
|
|
||||||
$('#sortableexercises').trigger('sortupdate');
|
|
||||||
});
|
|
||||||
|
|
||||||
$("button.AddExpresso").click(function() {
|
|
||||||
$( "ul#sortableexpresso" ).append('<li class=ui-state-default><input type="text" name="track.name[]" hint="Name" placeholder="Track Name"><input type="text" name="track.distance[]" hint="Name" placeholder="Distance"><input type="text" name="track.peak[]" hint="Name" placeholder="Peak"></li>')
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#Activity').find('input.datepicker').datepicker();
|
|
||||||
$('#Activity').find('input.datepicker').datepicker('setDate', new Date());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#save').click(function() {
|
|
||||||
var docid =$(this).closest('span').attr('docid');
|
|
||||||
var selector= "#myForm"
|
|
||||||
var formDataAll = $(selector).toObject({mode: 'all'});
|
|
||||||
socket.emit('addactivity', formDataAll[0], docid);
|
|
||||||
//console.log('All ', JSON.stringify(formDataAll[0], null, ' '));
|
|
||||||
$('ul#sortable li').remove('.removable');
|
|
||||||
$('#Activity').find('input').attr('value','');
|
|
||||||
$('span.ActivityID').removeAttr('docid');
|
|
||||||
$('#savecopy').attr('style', 'display: none');
|
|
||||||
$( "#tabs" ).tabs( "select" , 0 )
|
|
||||||
$('#Activity').find('input.datepicker').datepicker();
|
|
||||||
$('#Activity').find('input.datepicker').datepicker('setDate', new Date());
|
|
||||||
socket.emit('getactivites', 'please');
|
|
||||||
socket.emit('getexercises', 'please');
|
|
||||||
return false;
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#savecopy').click(function() {
|
|
||||||
var selector= "#myForm"
|
|
||||||
var formDataAll = $(selector).toObject({mode: 'all'});
|
|
||||||
socket.emit('addactivity', formDataAll[0]);
|
|
||||||
//console.log('All ', JSON.stringify(formDataAll[0], null, ' '));
|
|
||||||
$('ul#sortable li').remove('.removable');
|
|
||||||
$('#Activity').find('input').attr('value','');
|
|
||||||
$('span.ActivityID').removeAttr('docid');
|
|
||||||
$('#savecopy').attr('style', 'display: none');
|
|
||||||
$( "#tabs" ).tabs( "select" , 0 )
|
|
||||||
$('#Activity').find('input.datepicker').datepicker();
|
|
||||||
$('#Activity').find('input.datepicker').datepicker('setDate', new Date());
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#saveexercises').click(function() {
|
|
||||||
var docid =$(this).closest('span').attr('docid');
|
|
||||||
var selector= "#ExerciseForm"
|
|
||||||
var formDataAll = $(selector).toObject({mode: 'all'});
|
|
||||||
socket.emit('updateexercises', formDataAll[0], docid);
|
|
||||||
|
|
||||||
//console.log('All ', JSON.stringify(formDataAll, null, ' '));
|
|
||||||
// to prevent the page from changing
|
|
||||||
$('ul#sortableexercises li').remove();
|
|
||||||
$( "#tabs" ).tabs( "select" , 0 )
|
|
||||||
socket.emit('getactivites', 'please');
|
|
||||||
socket.emit('getexercises', 'please');
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#saveexpresso').click(function() {
|
|
||||||
var docid =$(this).closest('span').attr('docid');
|
|
||||||
var selector= "#ExpressoForm"
|
|
||||||
var formDataAll = $(selector).toObject({mode: 'all'});
|
|
||||||
socket.emit('updateexpresso', formDataAll[0], docid);
|
|
||||||
|
|
||||||
console.log('All ', JSON.stringify(formDataAll, null, ' '));
|
|
||||||
// to prevent the page from changing
|
|
||||||
$('ul#sortableexpresso li').remove();
|
|
||||||
$( "#tabs" ).tabs( "select" , 0 )
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$('#cancelform').click(function() {
|
|
||||||
$('ul#sortable li').remove('.removable');
|
|
||||||
$('span.ActivityID').removeAttr('docid');
|
|
||||||
$('#Activity').find('input').attr('value','');
|
|
||||||
$('#Activity').find('input.datepicker').datepicker();
|
|
||||||
$('#Activity').find('input.datepicker').datepicker('setDate', new Date());
|
|
||||||
return false;
|
|
||||||
socket.emit('getactivites', 'please');
|
|
||||||
socket.emit('getexercises', 'please');
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#my-text-link').click(function() { // bind click event to link
|
|
||||||
$tabs.tabs('select', 2); // switch to third tab
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$('ul').on('change', '.laptype',function() {
|
|
||||||
console.log ('value= ' + $(this).val() );
|
|
||||||
var currentselect;
|
|
||||||
switch($(this).val()) {
|
|
||||||
case "Cardio":
|
|
||||||
$(this).siblings('span').html('<select class="ExerciseDropDownCardio" name="Activities.Activity.Lap[0].cardio.selection"></select><input type="text" class="lapdistance" name="Activities.Activity.Lap[0].cardio.distance" placeholder="Distance"><input type="text" class="laptime" name="Activities.Activity.Lap[0].cardio.time" placeholder="hh:mm:ss"><a href=# class=delete>delete</a>');
|
|
||||||
$(exercise_autocompletedata).each(function(index)
|
|
||||||
{
|
|
||||||
var option = $('<option />');
|
|
||||||
if (this.class == 'cardio') {
|
|
||||||
option.attr('value', index).text(this.name);
|
|
||||||
$('.ExerciseDropDownCardio').append(option);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "Exercise":
|
|
||||||
$(this).siblings('span').html('<select class="ExerciseDropDown" name="Activities.Activity.Lap[0].exercise.selection"></select> <input type="text" class="sets" name="Activities.Activity.Lap[0].exercise.sets" placeholder="Sets"><input type="text" class="reps" name="Activities.Activity.Lap[0].exercise.reps" placeholder="Reps"><input type="text" name="Activities.Activity.Lap[0].exercise.weight" class="weight" placeholder="Weight in KG"><a href=# class=delete>delete</a>');
|
|
||||||
$(exercise_autocompletedata).each(function(index)
|
|
||||||
{
|
|
||||||
//console.log(this.name);
|
|
||||||
//console.log(this.muscledata);
|
|
||||||
console.log("resetingdropdown")
|
|
||||||
var option = $('<option />');
|
|
||||||
if (this.class == 'weights') {
|
|
||||||
option.attr('value', index).text(this.name);
|
|
||||||
$('.ExerciseDropDown').append(option);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
$('#sortable').trigger('sortupdate')
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
socket.on('populateexerciselist', function(data, result) {
|
||||||
|
if ("cardio" == data) {
|
||||||
|
//create cardiodropdownlist
|
||||||
|
$( ".ExerciseDropDownCardio" ).remove('option');
|
||||||
|
$.each(result, function(index, array) {
|
||||||
|
$( ".ExerciseDropDownCardio" ).append('<option value="' + array._id +'" > '+ array.exercise.name +'</option>');
|
||||||
|
})
|
||||||
|
};
|
||||||
|
if ("weights" == data) {
|
||||||
|
$( ".ExerciseDropDownWeights" ).remove('option');
|
||||||
|
$.each(result, function(index, array) {
|
||||||
|
$( ".ExerciseDropDownWeights" ).append('<option value="' + array._id +'" > '+ array.exercise.name +'</option>');
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//THe Sortable Stuff
|
||||||
|
$("#sortable").sortable({
|
||||||
|
placeholder: "ui-state-highlight",
|
||||||
|
revert: true,
|
||||||
|
stop: function(event, ui) {
|
||||||
|
$('#sortable').trigger('sortupdate')
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#sortable").bind('sortupdate', function(event, ui) {
|
||||||
|
$('#sortable li').each(function(){
|
||||||
|
var itemindex= $(this).index()
|
||||||
|
$(this).children('label.uiindex').html('Exercise '+ itemindex );
|
||||||
|
$(this).find('input, select').each(function(){
|
||||||
|
var newname = $(this).attr('name').replace(/\[[0-9]*\]/,'[' + itemindex + ']');
|
||||||
|
$(this).attr("name",newname);
|
||||||
|
});
|
||||||
|
$(this).find('input.exertags').autocomplete({source: exercise_autocompletedata});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('#ActivityList').delegate('a.activitydelete', 'click', function() {
|
||||||
|
socket.emit('delactivity', $(this).attr('title'));
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#ActivityList').delegate('a.activityedit', 'click', function() {
|
||||||
|
socket.emit('getactivitybyid', $(this).attr('title'));
|
||||||
|
$("#Activity").dialog("open");
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// $('ul').on('click', '.delete',function() {
|
||||||
|
// $(this).closest('li').remove();
|
||||||
|
// $('#sortable').trigger('sortupdate')
|
||||||
|
// });
|
||||||
|
|
||||||
|
//adds selectable element
|
||||||
|
$("button").click(function() {
|
||||||
|
var addtype = $(this).attr('value');
|
||||||
|
var newElem = $('.new-' + addtype).clone(true).attr('style', 'display: block');
|
||||||
|
$(newElem).removeClass("new-" + addtype);
|
||||||
|
$(newElem).children('input').attr('disabled',false);
|
||||||
|
$(newElem).appendTo('#sortable');
|
||||||
|
$(newElem).sortable( "refresh" );
|
||||||
|
$('#sortable').trigger('sortupdate');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$('#save').click(function() {
|
||||||
|
var docid =$(this).closest('span').attr('docid');
|
||||||
|
var selector= "#myForm"
|
||||||
|
var formDataAll = $(selector).toObject({mode: 'all'});
|
||||||
|
socket.emit('addactivity', formDataAll[0], docid);
|
||||||
|
$('ul#sortable li').remove('.removable');
|
||||||
|
$('#Activity').find('input').attr('value','');
|
||||||
|
$('span.ActivityID').removeAttr('docid');
|
||||||
|
$('#Activity').find('input.datepicker').datepicker();
|
||||||
|
$('#Activity').find('input.datepicker').datepicker('setDate', new Date());
|
||||||
|
socket.emit('getactivites', 'please');
|
||||||
|
socket.emit('getexercises', 'please');
|
||||||
|
return false;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('#cancelform').click(function() {
|
||||||
|
$('ul#sortable li').remove('.removable');
|
||||||
|
$('span.ActivityID').removeAttr('docid');
|
||||||
|
$('#Activity').find('input').attr('value','');
|
||||||
|
$('#Activity').find('input.datepicker').datepicker();
|
||||||
|
$('#Activity').find('input.datepicker').datepicker('setDate', new Date());
|
||||||
|
return false;
|
||||||
|
socket.emit('getactivites', 'please');
|
||||||
|
socket.emit('getexercises', 'please');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('ul').on('change', '.laptype',function() {
|
||||||
|
console.log ('value= ' + $(this).val() );
|
||||||
|
var currentselect;
|
||||||
|
switch($(this).val()) {
|
||||||
|
case "Cardio":
|
||||||
|
$(this).siblings('span').html('<select class="ExerciseDropDownCardio" name="Activities.Activity.Lap[0].selection"></select><input type="text" class="lapdistance" name="Activities.Activity.Lap[0].distance" placeholder="Distance"><input type="text" class="laptime" name="Activities.Activity.Lap[0].time" placeholder="hh:mm:ss"><input style="display: none" type=text class="muscledata" name="Activities.Activity.Lap[0].muscledata"><a href=# class=delete>delete</a>');
|
||||||
|
|
||||||
|
socket.emit('getexerciselist', 'cardio');
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "Exercise":
|
||||||
|
$(this).siblings('span').html('<select class="ExerciseDropDownWeights" name="Activities.Activity.Lap[0].selection"></select> <input type="text" class="sets" name="Activities.Activity.Lap[0].sets" placeholder="Sets"><input type="text" class="reps" name="Activities.Activity.Lap[0].reps" placeholder="Reps"><input type="text" name="Activities.Activity.Lap[0].weight" class="weight" placeholder="Weight in KG"><input style="display: none" type=text class="muscledata" name="Activities.Activity.Lap[0].muscledata"><a href=# class=delete>delete</a>');
|
||||||
|
socket.emit('getexerciselist', 'weights');
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
$('#sortable').trigger('sortupdate')
|
||||||
|
});
|
||||||
|
|
||||||
|
//document closing
|
||||||
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -105,4 +105,4 @@ float: right;
|
|||||||
/*#ExerciseEditor {float:right;}
|
/*#ExerciseEditor {float:right;}
|
||||||
#Activity {float:right;}*/
|
#Activity {float:right;}*/
|
||||||
#RightColumn {float:right;}
|
#RightColumn {float:right;}
|
||||||
|
#Bottom {clear: both;}
|
||||||
|
|||||||
Reference in New Issue
Block a user