How to use mergexml - 1 common examples

To help you get started, we’ve selected a few mergexml 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 enketo / enketo-core / src / js / form-model.js View on Github external
if ( that.evaluate( './*', 'nodes', path, 0, true ).length === 0 ) {
                    // Select all text nodes (excluding repeat COMMENT nodes!)
                    that.evaluate( './text()', 'nodes', path, 0, true ).forEach( node => {
                        node.textContent = '';
                    } );
                } else {
                    // If the node in the default instance is a group (empty in record, so appears to be a leaf node
                    // but isn't), empty all true leaf node descendants.
                    that.evaluate( './/*[not(*)]', 'nodes', path, 0, true ).forEach( node => {
                        node.textContent = '';
                    } );
                }
            }
        } );

    merger = new MergeXML( {
        join: false
    } );

    modelInstanceChildStr = ( new XMLSerializer() ).serializeToString( modelInstanceChildEl );
    recordStr = ( new XMLSerializer() ).serializeToString( record );

    // first the model, to preserve DOM order of that of the default instance
    merger.AddSource( modelInstanceChildStr );
    // then merge the record into the model
    merger.AddSource( recordStr );

    if ( merger.error.code ) {
        throw new Error( merger.error.text );
    }

    /**

mergexml

Merge multiple XML sources

ISC
Latest version published 8 months ago

Package Health Score

65 / 100
Full package analysis

Popular mergexml functions