- Configurable server URL (default: pedshub.com) - Android + iOS platforms initialized - Dark theme matching quiz app (#0f172a) - Status bar and navigation bar color matched - Auto-redirect on subsequent launches - App ID: com.pedshub.quiz, App Name: PedsHub Build: cd mobile && npx cap sync && npx cap open android Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
56 lines
1.3 KiB
JavaScript
56 lines
1.3 KiB
JavaScript
var util = require('util');
|
|
|
|
var sax = require('sax');
|
|
|
|
var TreeBuilder = require('./../treebuilder').TreeBuilder;
|
|
|
|
function XMLParser(target) {
|
|
this.parser = sax.parser(true);
|
|
|
|
this.target = (target) ? target : new TreeBuilder();
|
|
|
|
this.parser.onopentag = this._handleOpenTag.bind(this);
|
|
this.parser.ontext = this._handleText.bind(this);
|
|
this.parser.oncdata = this._handleCdata.bind(this);
|
|
this.parser.ondoctype = this._handleDoctype.bind(this);
|
|
this.parser.oncomment = this._handleComment.bind(this);
|
|
this.parser.onclosetag = this._handleCloseTag.bind(this);
|
|
this.parser.onerror = this._handleError.bind(this);
|
|
}
|
|
|
|
XMLParser.prototype._handleOpenTag = function(tag) {
|
|
this.target.start(tag.name, tag.attributes);
|
|
};
|
|
|
|
XMLParser.prototype._handleText = function(text) {
|
|
this.target.data(text);
|
|
};
|
|
|
|
XMLParser.prototype._handleCdata = function(text) {
|
|
this.target.data(text);
|
|
};
|
|
|
|
XMLParser.prototype._handleDoctype = function(text) {
|
|
};
|
|
|
|
XMLParser.prototype._handleComment = function(comment) {
|
|
};
|
|
|
|
XMLParser.prototype._handleCloseTag = function(tag) {
|
|
this.target.end(tag);
|
|
};
|
|
|
|
XMLParser.prototype._handleError = function(err) {
|
|
throw err;
|
|
};
|
|
|
|
XMLParser.prototype.feed = function(chunk) {
|
|
this.parser.write(chunk);
|
|
};
|
|
|
|
XMLParser.prototype.close = function() {
|
|
this.parser.close();
|
|
return this.target.close();
|
|
};
|
|
|
|
exports.XMLParser = XMLParser;
|