How to use jstoxml - 10 common examples

To help you get started, we’ve selected a few jstoxml 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 oeuillot / upnpserver / lib / subdevice.js View on Github external
return this.toJXML("", request, function(error, xmlObject) {
        if (error) {
          return callback(error);
        }

        var xml = jstoxml.toXML(xmlObject, {
          header : true,
          indent : " ",
          filter : xmlFilters
        });

        if (debug.enabled) {
          debug("Descript Path request: returns: " + xml);
        }

        // logger.verbose("Request description path: " + xml);
        response.setHeader("Content-Type", "text/xml; charset=\"utf-8\"");

        response.end(xml, "UTF-8");
        return callback(null, true);
      });
github Graphite-Docs / graphite / src / components / journalism / SingleJournoDoc.js View on Github external
convertRSS() {
    this.setState({singleRSS: toXML(this.state.singlePublicPost)});
    setTimeout(this.postRSS, 300);
  }
github Sdedelbrock / node-expedia-api / lib / expedia.js View on Github external
customerSessionId : parameters.customerSessionId,
            customerIpAddress : parameters.customerIpAddress,
            customerUserAgent : parameters.customerUserAgent
        };
        delete(parameters.customerSessionId);
        delete(parameters.customerIpAddress);
        delete(parameters.customerUserAgent);

        customer = querystring.stringify(customer);

        var paramsAsString = customer +"&json&";
        if (sendAsREST){
            paramsAsString += querystring.stringify(parameters);
        }
        else {
            paramsAsString += querystring.stringify({"xml" : parser.toXML(parameters)});
        }
        return paramsAsString;
    }
github ruslang02 / atomos / apps / boombox / index.html View on Github external
function savePlaylist(url, title) {
		let trackList = [];
		$("#playlist").find("button").each(function () {
			trackList.push({
				track: {
					location: (!$(this).attr("location").startsWith("http") ? "file://" :
						"") + escape($(this).attr("location")),
					title: escape($(this).text()),
					creator: escape($(this).attr("creator"))
				}
			})
		});
		let playlist = js2xml.toXML({
			playlist: {
				_attrs: {
					xmlns: "http://xspf.org/ns/0/",
					version: "1"
				},
				title: title || "Playlist",
				trackList: trackList
			}
		}, {
			header: true,
			indent: "	"
		});
		fs.writeFile(url, playlist, 'utf-8')
			.then(function () {
				new Notification({
					title: "Playlist successfully saved",
github oeuillot / upnpserver / lib / service.js View on Github external
responseSoap(response, functionName, body, callback) {

		var jxml = {
			_name: "s:Envelope",
			_attrs: {
				xmlns: Xmlns.UPNP_SERVICE,
				"xmlns:s": Xmlns.SOAP_ENVELOPE,
				"s:encodingStyle": "http://schemas.xmlsoap.org/soap/encoding/"
			},
			_content: {
				"s:Body": body
			}
		};

		var xml = jstoxml.toXML(jxml, {
			header: true,
			indent: "",
			filter: xmlFilters
		});

		debug("responseSoap", "function=", functionName, "response=", xml);

		response.setHeader("Content-Type", "text/xml; charset=\"utf-8\"");

		response.end(xml, "utf8");

		callback(null);
	}
github noobaa / noobaa-core / attic / xml-template-builder.js View on Github external
function buildBucketNotFound(bucketName) {
    return jstoxml.toXML({
        Error: {
            Code: 'NoSuchBucket',
            Message: 'The resource you requested does not exist',
            Resource: bucketName,
            RequestId: 1
        }
    }, XML_OPTIONS);
}
github noobaa / noobaa-core / attic / xml-template-builder.js View on Github external
function buildFolderNotFound(key) {
    return jstoxml.toXML({
        Error: {
            Code: 'NoSuchKey',
            Message: 'The specified folder already exists',
            Resource: key,
            RequestId: 1
        }
    }, XML_OPTIONS);
}
github Andro999b / torrent-player / server / dlna / index.js View on Github external
function toDIDLXml(content) {
    const didl = toXML({
        _name: 'DIDL-Lite',
        _attrs: {
            'xmlns': 'urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/',
            'xmlns:dc': 'http://purl.org/dc/elements/1.1/',
            'xmlns:upnp': 'urn:schemas-upnp-org:metadata-1-0/upnp/',
            'xmlns:pv': 'http://www.pv.com/pvns/',
            'xmlns:sec': 'http://www.sec.co.kr/'
        },
        _content: content
    })
    debug(didl)
    return didl
}
github ruslang02 / atomos / apps / official / boombox / boombox.js View on Github external
let trackList = [];
	let file = await Shell.selectFile(Shell.ACTION_SAVE, {
		defaultPath: ofdDefaultPath,
		buttonLabel: "Export"
	});
	for (const track of playlist.childNodes) {
		trackList.push({
			track: {
				location: new URL((!file.location.startsWith("http") ? "file://" : "") +
					escape(file.location)).href,
				title: escape(track.innerText),
				creator: escape(track.creator)
			}
		});
	}
	let playlist = js2xml.toXML({
		playlist: {
			_attrs: {
				xmlns: "http://xspf.org/ns/0/",
				version: "1"
			},
			title: title || "Playlist",
			trackList: trackList
		}
	}, {
		header: true,
		indent: "	"
	});
	await fsp.writeFile(url, playlist, 'utf-8');
	new Notification("Playlist successfully saved", {
		actions: [{
			title: "Show in folder",
github ali-sdk / ali-oss / lib / rtmp.js View on Github external
proto.putChannel = async function putChannel(id, conf, options) {
  options = options || {};
  options.subres = 'live';

  const params = this._objectRequestParams('PUT', id, options);
  params.xmlResponse = true;
  params.content = jstoxml.toXML({
    LiveChannelConfiguration: conf
  });
  params.successStatuses = [200];

  const result = await this.request(params);

  let publishUrls = result.data.PublishUrls.Url;
  if (!Array.isArray(publishUrls)) {
    publishUrls = [publishUrls];
  }
  let playUrls = result.data.PlayUrls.Url;
  if (!Array.isArray(playUrls)) {
    playUrls = [playUrls];
  }

  return {

jstoxml

Converts JavaScript/JSON to XML (for RSS, Podcasts, AMP, etc.)

MIT
Latest version published 6 months ago

Package Health Score

63 / 100
Full package analysis

Popular jstoxml functions