Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
result.post = true;
const xform = new CompositeXform({
tag: 'compy',
children: [
{
name: 'pre',
xform: new BooleanXform({ tag: 'pre', attr: 'val' }),
},
{ name: childXform.tag, xform: childXform },
{
name: 'post',
xform: new BooleanXform({ tag: 'post', attr: 'val' }),
},
],
});
const parser = new saxes.SaxesParser();
xform
.parse(parser)
.then(model => {
// console.log('parsed Model', JSON.stringify(model));
// console.log('expected Model', JSON.stringify(result));
// eliminate the undefined
const clone = _.cloneDeep(model, false);
// console.log('result', JSON.stringify(clone));
// console.log('expect', JSON.stringify(result));
expect(clone).to.deep.equal(result);
resolve();
})
.catch(reject);
function createParser(rootNode, globalObject, saxesOptions) {
const parser = new SaxesParser({
...saxesOptions,
// Browsers always have namespace support.
xmlns: true,
// We force the parser to treat all documents (even documents declaring themselves to be XML 1.1 documents) as XML
// 1.0 documents. See https://github.com/jsdom/jsdom/issues/2677 for a discussion of the stakes.
defaultXMLVersion: "1.0",
forceXMLVersion: true
});
const openStack = [rootNode];
function getOwnerDocument() {
const currentElement = openStack[openStack.length - 1];
return isHTMLTemplateElement(currentElement) ?
currentElement._templateContents._ownerDocument :
currentElement._ownerDocument;
this.encoding = encodingFromOpts(opts)
this.decoder = new StringDecoder(this.encoding)
this.eventMode = opts && opts.eventMode
this.state = new State(
null,
null,
false,
new Map(),
'',
new Set(['content:encoded', 'pubDate'])
)
const parser = new sax.SaxesParser(opts ? opts.parser : null)
parser.ontext = (text) => {
const t = text.trim()
if (t.length === 0) {
debug('discarding text: whitespace')
return
}
const state = this.state
const current = state.entry || state.feed
if (!current || !state.map) return
let key = state.key()