New mobile/ directory with Capacitor project: - Configurable server URL launcher (default: app.pedshub.com) - Android: foreground service + wake lock for background recording (AudioRecordingService preserved from existing TWA) - iOS: background audio mode + microphone permission - App ID: com.pedshub.scribe - Both platforms initialized and synced Existing android/ TWA project untouched — this is a separate project. Build: cd mobile && npx cap open android (or ios)
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;
|