当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript xpath.useNamespaces函数代码示例

本文整理汇总了TypeScript中xpath.useNamespaces函数的典型用法代码示例。如果您正苦于以下问题:TypeScript useNamespaces函数的具体用法?TypeScript useNamespaces怎么用?TypeScript useNamespaces使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了useNamespaces函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: require

import connect = require('lm-connect-js');
import fs = require('fs');

// non-definition module requires
var xpath: any = require('xpath'),
    dom: any = require('xmldom').DOMParser;

// globals
var scenarios = process.cwd() + '/scenarios',
    client: connect.SewebarConnectClient,
    miner: connect.Miner,
    dataDictionary: string = fs.readFileSync(scenarios + '/01/datadictionary.xml', 'utf8'),
    task: string = fs.readFileSync(scenarios + '/01/task.xml', 'utf8'),
    taskType: string = 'task',
    template: string = '4ftMiner.Task.Template.PMML',
    selector = xpath.useNamespaces({ "guha": "http://keg.vse.cz/ns/GUHA0.1rev1" }),
    tries: number = 0,
    database: connect.DbConnection = {
        type: 'Access',
        file: 'Barbora.mdb'
    },
    metabase: connect.DbConnection = {
        type: 'Access',
        file: 'LM Barbora.mdb'
    },
    config = {
        url: "http://connect-dev.lmcloud.vse.cz",
        app: "LinkedTV"
    };

// create client
开发者ID:lm-connect,项目名称:lm-connect-js-sample,代码行数:31,代码来源:index.ts

示例2: query

  console.error('must specify the path to \'--src\' & \'--pkg\'');
  process.exit();
}

// nuspec file
let nuspecFile: string = yargs.argv.pkg + '/src/ng-office-ui-fabric.nuspec';

// get library version & dependencies
let libraryVersion: string = ScriptUtils.getLibraryVersion(yargs.argv.src);
let deps: ILibraryDependencies = ScriptUtils.getDependencies(yargs.argv.src);

// load XML
let domParser: DOMParser = new xmldom.DOMParser();
let packageContents: string = fs.readFileSync(nuspecFile).toString();
let packageManifest: Document = domParser.parseFromString(packageContents, 'text/xml');
let query: xpath.SelectFn = xpath.useNamespaces({ nuget: 'http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd' });

// update nuspec
//  update package version
let versionNode: Node = query('/nuget:package/nuget:metadata/nuget:version', packageManifest, true);
versionNode.textContent = libraryVersion;
//  update anuglar version
let angularVersionNode: any = query('/nuget:package/nuget:metadata/nuget:dependencies/nuget:dependency[@id=\'AngularJS.Core\']',
                                    packageManifest,
                                    true);
angularVersionNode.setAttribute('version', deps.angularLib);
//  update fabric version
let fabricVersionNode: any = query('/nuget:package/nuget:metadata/nuget:dependencies/nuget:dependency[@id=\'OfficeUIFabric\']',
                                   packageManifest,
                                   true);
fabricVersionNode.setAttribute('version', deps.officeUiFabricLib);
开发者ID:QuinntyneBrown,项目名称:ng-officeuifabric,代码行数:31,代码来源:update-nuget-versions.ts

示例3: require

import * as xpath from 'xpath'
import * as fs from 'fs'
import * as ejs from 'ejs'
import * as path from 'path'

import { DOMParser } from 'xmldom'

import jsesc = require('jsesc')
import _ = require('lodash')

const _select = xpath.useNamespaces({ bcf: 'https://sourceforge.net/projects/biblatex' })
function select(selector, node) {
  return _select(selector, node) as Node[]
}

export = source => {
  const doc = (new DOMParser).parseFromString(source)

  const BCF = {
    // combinations fo allowed fields
    fieldSet: '',

    // per type, array of fieldset names that make up the allowed fields for this type
    allowed: {},

    // combinations of required fields and the types they apply to
    required: {},

    // content checks
    data: [],
  }
开发者ID:duncdrum,项目名称:zotero-better-bibtex,代码行数:31,代码来源:bcf.ts


注:本文中的xpath.useNamespaces函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。