How to use the ltx.Parser function in ltx

To help you get started, we’ve selected a few ltx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / ltx / ltx-tests.ts View on Github external
import * as ltx from 'ltx';

ltx.parse('');

const p = new ltx.Parser();

p.on('tree', (ignored: any) => {});

p.on('error', (ignored: any) => {});

const el = new ltx.Element('root').c('children');
el.c('child', {age: 5}).t('Hello').up()
    .c('child', {age: 7}).t('Hello').up()
    .c('child', {age: 99}).t('Hello').up();

el.root().toString();
github DefinitelyTyped / DefinitelyTyped / types / ltx / ltx-tests.ts View on Github external
import * as ltx from 'ltx';

ltx.parse('');

const getChildTextElement = ltx.parse('body text') as ltx.Element;
if (getChildTextElement.getChildText('child') !== 'body text') {
    throw new Error("body does not match");
}

const p = new ltx.Parser();

p.on('tree', (ignored: any) => {});

p.on('error', (ignored: any) => {});

const el = new ltx.Element('root').c('children');
el.c('child', {age: 5}).t('Hello').up()
    .c('child', {age: 7}).t('Hello').up()
    .c('child', {age: 99}).t('Hello').up();

el.root().toString();
github xmppjs / radiowave / lib / net / bosh / BOSHHttp.js View on Github external
function parseBody(stream, cb) {
    var parser = new ltx.Parser()
    stream.on('data', function(data) {
        parser.write(data)
    })
    stream.on('end', function() {
        parser.end()
    })
    stream.on('error', function(e) {
        cb(e)
    })
    parser.on('tree', function(bodyEl) {
        cb(null, bodyEl)
    })
    parser.on('error', function(e) {
        cb(e)
    })
}
github xmppjs / xmpp.js / lib / node-xmpp-server / bosh_server.js View on Github external
function parseBody(stream, cb) {
    var parser = new ltx.Parser()
    stream.on('data', function(data) {
        parser.write(data)
    })
    stream.on('end', function() {
        parser.end()
    })
    stream.on('error', function(e) {
        cb(e)
    })
    parser.on('tree', function(bodyEl) {
        cb(null, bodyEl)
    })
    parser.on('error', function(e) {
        cb(e)
    })
}
github xmppjs / radiowave / net / bosh / BOSHHttp.js View on Github external
function parseBody(stream, cb) {
    var parser = new ltx.Parser()
    stream.on('data', function(data) {
        parser.write(data)
    })
    stream.on('end', function() {
        parser.end()
    })
    stream.on('error', function(e) {
        cb(e)
    })
    parser.on('tree', function(bodyEl) {
        cb(null, bodyEl)
    })
    parser.on('error', function(e) {
        cb(e)
    })
}