當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。