How to use the elementtree.XML function in elementtree

To help you get started, we’ve selected a few elementtree 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 apache / cordova-lib / test / blackberry-install.js View on Github external
exports.setUp = function(callback) {
    shell.mkdir('-p', test_dir);
    
    // copy the blackberry test project to a temp directory
    shell.cp('-r', path.join(__dirname, 'projects'), test_dir);

    // copy the blackberry test plugin to a temp directory
    shell.cp('-r', path.join(__dirname, 'plugins'), test_dir);

    // parse the plugin.xml into an elementtree object
    xml_text   = fs.readFileSync(xml_path, 'utf-8')
    plugin_et  = new et.ElementTree(et.XML(xml_text));

    callback();
}
github apache / cordova-lib / test / android-two-uninstall.js View on Github external
exports.setUp = function(callback) {
    shell.mkdir('-p', test_dir);
    
    // copy the ios test project to a temp directory
    shell.cp('-r', path.join(__dirname, 'projects'), test_dir);

    // copy the ios test plugin to a temp directory
    shell.cp('-r', path.join(__dirname, 'plugins'), test_dir);

    // parse the plugin.xml into an elementtree object
    xml_text   = fs.readFileSync(xml_path, 'utf-8')
    plugin_et  = new et.ElementTree(et.XML(xml_text));

    callback();
}
github apache / cordova-lib / test / ios-plist-install.js View on Github external
exports.setUp = function(callback) {
    shell.mkdir('-p', test_dir);
    
    // copy the ios test project to a temp directory
    shell.cp('-r', path.join(__dirname, 'projects'), test_dir);

    // copy the ios test plugin to a temp directory
    shell.cp('-r', path.join(__dirname, 'plugins'), test_dir);

    // parse the plugin.xml into an elementtree object
    xml_text   = fs.readFileSync(xml_path, 'utf-8')
    plugin_et  = new et.ElementTree(et.XML(xml_text));

    callback();
}
github apache / cordova-lib / test / ios-config-xml-install.js View on Github external
exports.setUp = function(callback) {
    shell.mkdir('-p', test_dir);
    
    // copy the ios test project to a temp directory
    shell.cp('-r', path.join(__dirname, 'projects'), test_dir);

    // copy the ios test plugin to a temp directory
    shell.cp('-r', path.join(__dirname, 'plugins'), test_dir);

    // parse the plugin.xml into an elementtree object
    xml_text   = fs.readFileSync(xml_path, 'utf-8')
    plugin_et  = new et.ElementTree(et.XML(xml_text));

    callback();
}
github apache / cordova-lib / test / android-two-install.js View on Github external
exports.setUp = function(callback) {
    shell.mkdir('-p', test_dir);
    
    // copy the ios test project to a temp directory
    shell.cp('-r', path.join(__dirname, 'projects'), test_dir);

    // copy the ios test plugin to a temp directory
    shell.cp('-r', path.join(__dirname, 'plugins'), test_dir);

    // parse the plugin.xml into an elementtree object
    xml_text   = fs.readFileSync(xml_path, 'utf-8')
    plugin_et  = new et.ElementTree(et.XML(xml_text));

    callback();
}
github apache / cordova-lib / cordova-lib / src / plugman / create.js View on Github external
// Create a plugin.xml file
    root = et.Element( 'plugin' );
    root.set( 'xmlns', 'http://apache.org/cordova/ns/plugins/1.0' );
    root.set( 'xmlns:android', 'http://schemas.android.com/apk/res/android' );
    root.set( 'id', id );
    root.set( 'version', version );

    // Add the name tag
    pluginName = et.XML( '' );
    pluginName.text = name;
    root.append( pluginName );

    // Loop through the options( variables ) for other tags
    for( var key in options ) {
        var temp = et.XML( '<' + key + '>');
        temp.text = options[ key ];
        root.append( temp );
    }

    // Setup the directory structure
    shell.mkdir( '-p', cwd + 'www' );
    shell.mkdir( '-p', cwd + 'src' );

    // Create a base plugin.js file
    baseJS = stripLicense.fromCode(fs.readFileSync(templatesDir + 'base.js', 'utf-8').replace(/%pluginName%/g, name));
    fs.writeFileSync( cwd + 'www/' + name + '.js', baseJS, 'utf-8' );
    // Add it to the xml as a js module
    jsMod = et.Element( 'js-module' );
    jsMod.set( 'src', 'www/' + name + '.js' );
    jsMod.set( 'name', name );
github apache / cordova-lib / src / plugman / create.js View on Github external
// Create a plugin.xml file
    root = et.Element('plugin');
    root.set('xmlns', 'http://apache.org/cordova/ns/plugins/1.0');
    root.set('xmlns:android', 'http://schemas.android.com/apk/res/android');
    root.set('id', id);
    root.set('version', version);

    // Add the name tag
    pluginName = et.XML('');
    pluginName.text = name;
    root.append(pluginName);

    // Loop through the options( variables ) for other tags
    for (var key in options) {
        var temp = et.XML('<' + key + '>');
        temp.text = options[key];
        root.append(temp);
    }

    // Setup the directory structure
    fs.ensureDirSync(cwd + 'www');
    fs.ensureDirSync(cwd + 'src');

    // Create a base plugin.js file
    baseJS = stripLicense.fromCode(fs.readFileSync(templatesDir + 'base.js', 'utf-8').replace(/%pluginName%/g, name));
    fs.writeFileSync(cwd + 'www/' + name + '.js', baseJS, 'utf-8');
    // Add it to the xml as a js module
    jsMod = et.Element('js-module');
    jsMod.set('src', 'www/' + name + '.js');
    jsMod.set('name', name);
github apache / cordova-lib / cordova-lib / spec-cordova / metadata / wp8_parser.spec.js View on Github external
spyOn(xmlHelpers, 'parseElementtreeSync').and.callFake(function(path) {
            if (/WMAppManifest.xml$/.exec(path)) {
                return manifestXml = new et.ElementTree(et.XML(MANIFEST_XML));
            } else if (/csproj$/.exec(path)) {
                return projXml = new et.ElementTree(et.XML(PROJ_XML));
            } else if (/MainPage.xaml$/.exec(path)) {
                return mainPageXamlXml = new et.ElementTree(et.XML(MAINPAGEXAML_XML));
            } else if (/xaml$/.exec(path)) {
                return new et.ElementTree(et.XML(XAML_XML));
            } else {
                throw new CordovaError('Unexpected parseElementtreeSync: ' + path);
            }
        });
    });
github katzer / cordova-plugin-badge / node_modules / cordova-windows / spec / unit / Prepare.Win10.spec.js View on Github external
spyOn(xml, 'parseElementtreeSync').and.callFake(function (path) {
        if (path === 'config.xml') return new et.ElementTree(et.XML(TEST_XML));
        return origParseElementtreeSync(path);
    });
github apache / cordova-windows / spec / unit / Prepare.Win10.spec.js View on Github external
spyOn(xml, 'parseElementtreeSync').and.callFake(function (path) {
        if (path === 'config.xml') return new et.ElementTree(et.XML(TEST_XML));
        return origParseElementtreeSync(path);
    });

elementtree

XML Serialization and Parsing module based on Python's ElementTree.

Apache-2.0
Latest version published 8 years ago

Package Health Score

56 / 100
Full package analysis