How to use the xmlbuilder.begin function in xmlbuilder

To help you get started, we’ve selected a few xmlbuilder 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 socialtables / saml-protocol / lib / metadata.js View on Github external
function buildIDPMetadata(idp, signMetadata) {

	let metadata = xmlbuilder
		.begin({ separateArrayItems: true })
		.ele({
			"md:EntityDescriptor": [
				{
					"@ID": randomID(),
					"@entityID": idp.entityID,
					"@xmlns:md": namespaces.md,
					"@xmlns:ds": namespaces.ds
				},
				createIDPSSODescriptorJSON(idp)
			]
		})
		.end();

	// sign if necessary
	const signingCredential = credentials.getCredentialsFromEntity(idp, "signing")[0];
github natergj / excel4node / source / lib / worksheet / builder.js View on Github external
return new Promise((resolve, reject) => {

        let xmlProlog = '';
        let xmlString = '';
        let wsXML = xml.begin({
          'allowSurrogateChars': true,
        }, (chunk) => {
            xmlString += chunk;
        })

        .ele('worksheet')
        .att('mc:Ignorable', 'x14ac')
        .att('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main')
        .att('xmlns:mc', 'http://schemas.openxmlformats.org/markup-compatibility/2006')
        .att('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships')
        .att('xmlns:x14ac', 'http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac');

        // Excel complains if specific elements on not in the correct order in the XML doc as defined in §M.2.2
        let promiseObj = { xml: wsXML, ws: ws };

        _addSheetPr(promiseObj)
github socialtables / saml-protocol / lib / request-construction.js View on Github external
// choose which consumption endpoint and method the assertion should
	// come in on
	const spBindingChoice = protocolBindings.chooseBinding(sp, "assert");

	// choose an agreed-upon name ID format, or use 'unspecified'
	const nameIDFormat = chooseFirstSharedNameIDFormat([idp, sp]) || protocol.NAMEIDFORMAT.UNSPECIFIED;
	const authnContext = {
		"samlp:RequestedAuthnContext": {
			"@Comparison": idp.authContext || DEFAULT_AUTH_CONTEXT,
			"saml:AuthnContextClassRef": protocol.AUTHNCONTEXT.PASSWORDPROTECTEDTRANSPORT
		}
	};

	// build request payload
	const authnRequest = xmlbuilder
		.begin({
			separateArrayItems: true
		})
		.ele({
			// request child elements are ordered
			"samlp:AuthnRequest": [{
				"@xmlns:samlp": namespaces.samlp,
				"@xmlns:saml": namespaces.saml,
				"@Version": "2.0",
				"@ID": requestID,
				"@IssueInstant": new Date().toISOString(),
				"@Destination": destinationURL,
				"@AssertionConsumerServiceURL": spBindingChoice.url,
				"@ProtocolBinding": spBindingChoice.longformURI,
			}, {
				"saml:Issuer": sp.entityID
github socialtables / saml-protocol / lib / response-construction.js View on Github external
function createAuthnFailureResponse(sp, idp, inResponseTo, statusMessage, destinationURL) {

	const now = new Date();

	const xml = xmlbuilder.begin({
		separateArrayItems: true
	})
	.ele(
		{"samlp:Response": [
			{
				"@ID": randomID(),
				"@InResponseTo": inResponseTo,
				"@IssueInstant": now.toISOString(),
				"@Destination": destinationURL,
				"@Version": "2.0",
				"@xmlns:samlp": namespaces.samlp,
				"@xmlns:saml": namespaces.saml
			},
			{ "saml:Issuer": idp.entityID },
			{ "samlp:Status": {
				"samlp:StatusCode": {
github plivo / plivo-node / lib / plivoResponse.js View on Github external
function Response() {
  this.element = 'Response';
  this.nestables = ['Speak', 'Play', 'GetDigits', 'Record', 'Dial', 'Message',
    'Redirect', 'Wait', 'Hangup', 'PreAnswer', 'Conference', 'DTMF'];
  this.valid_attributes = [];
  this.elem = xmlBuilder.begin().ele(this.element);
}
github posm / OpenMapKitServer / api / odk / controllers / download-submission.js View on Github external
return fs.readdir(instancePath, (err, files) => {
      if (err) {
        return next(err);
      }

      res.contentType("application/xml");

      const xml = builder
        .begin(
          {
            writer: {
              pretty: true
            }
          },
          chunk => res.write(chunk)
        )
        .ele("submission")
        .att({
          xmlns: "http://opendatakit.org/submissions"
        });

      return fs.readFile(
        path.join(instancePath, "data.xml"),
        "utf-8",
github cellular / speech-builder / ssml.js View on Github external
constructor(opts /*: Opts */, el /*: any */) {
    const { features } = opts;
    this.opts = opts;
    this.features = features;
    this.el = el || xmlbuilder.begin().ele('speak');

    const { version, xmlns, base, lang } = features.speak;
    if (version) this.el.att('version', version);
    if (xmlns) this.el.att('xmlns', xmlns);
    if (opts.base && base) this.el.att('xml:base', opts.base);

    this.lang(opts.lang || lang);
    if (opts.lexicon) {
      const words = Object.keys(opts.lexicon)
        .map(escapeRe)
        .join('|');
      this.lexiconRe = new RegExp(`(${words})|(.+?)`, 'g');
    }
  }
github posm / OpenMapKitServer / api / odk / controllers / get-submission-list.js View on Github external
return fs.readdir(formPath, (err, files) => {
      if (err) {
        return next(err);
      }

      const offset = req.query.cursor | 0;
      const count = (req.query.numEntries || 100) | 0;

      res.contentType("application/xml");

      const xml = builder
        .begin(
          {
            writer: {
              pretty: true
            }
          },
          chunk => res.write(chunk)
        )
        .ele("idChunk")
        .att({
          xmlns: "http://opendatakit.org/submissions"
        })
        .ele("idList");

      files
        .slice(offset, offset + count)
github natergj / excel4node / source / lib / worksheet / builder.ts View on Github external
return new Promise((resolve, reject) => {
    const xmlProlog = '';
    let xmlString = '';
    const wsXML = xmlbuilder
      .begin((chunk) => {
        xmlString += chunk;
      })
      .ele('worksheet')
      .att('mc:Ignorable', 'x14ac')
      .att('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main')
      .att(
        'xmlns:mc',
        'http://schemas.openxmlformats.org/markup-compatibility/2006',
      )
      .att(
        'xmlns:r',
        'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
      )
      .att(
        'xmlns:x14ac',

xmlbuilder

An XML builder for node.js

MIT
Latest version published 5 years ago

Package Health Score

70 / 100
Full package analysis