How to use elementtree - 10 common examples

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 katzer / cordova-plugin-badge / platforms / windows / cordova / lib / prepare.js View on Github external
function applyUAPVersionToProject(projectFilePath, uapVersionInfo) {
    // No uapVersionInfo means that there is no UAP SDKs installed and there is nothing to do for us
    if (!uapVersionInfo) return;

    var fileContents = fs.readFileSync(projectFilePath).toString().trim();
    var xml = et.parse(fileContents);
    var tpv = xml.find('./PropertyGroup/TargetPlatformVersion');
    var tpmv = xml.find('./PropertyGroup/TargetPlatformMinVersion');

    tpv.text = uapVersionInfo.targetUAPVersion.toString();
    tpmv.text = uapVersionInfo.minUAPVersion.toString();

    fs.writeFileSync(projectFilePath, xml.write({ indent: 4 }), {});
}
github katzer / cordova-plugin-local-notifications / platforms / windows / cordova / lib / prepare.js View on Github external
function applyUAPVersionToProject(projectFilePath, uapVersionInfo) {
    // No uapVersionInfo means that there is no UAP SDKs installed and there is nothing to do for us
    if (!uapVersionInfo) return;

    var fileContents = fs.readFileSync(projectFilePath).toString().trim();
    var xml = et.parse(fileContents);
    var tpv = xml.find('./PropertyGroup/TargetPlatformVersion');
    var tpmv = xml.find('./PropertyGroup/TargetPlatformMinVersion');

    tpv.text = uapVersionInfo.targetUAPVersion.toString();
    tpmv.text = uapVersionInfo.minUAPVersion.toString();

    fs.writeFileSync(projectFilePath, xml.write({ indent: 4 }), {});
}
github apache / cordova-windows / template / cordova / lib / prepare.js View on Github external
function applyUAPVersionToProject(projectFilePath, uapVersionInfo) {
    // No uapVersionInfo means that there is no UAP SDKs installed and there is nothing to do for us
    if (!uapVersionInfo) return;

    var fileContents = fs.readFileSync(projectFilePath).toString().trim();
    var xml = et.parse(fileContents);
    var tpv = xml.find('./PropertyGroup/TargetPlatformVersion');
    var tpmv = xml.find('./PropertyGroup/TargetPlatformMinVersion');

    tpv.text = uapVersionInfo.targetUAPVersion.toString();
    tpmv.text = uapVersionInfo.minUAPVersion.toString();

    fs.writeFileSync(projectFilePath, xml.write({ indent: 4 }), {});
}

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