How to use js2xmlparser - 10 common examples

To help you get started, we’ve selected a few js2xmlparser 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 mwinteringham / restful-booker / tests / spec.js View on Github external
it('responds with a 200 and an updated payload when requesting with an XML', function testUpdatingABookingWithXML(done){
    var xmlPayload = js2xmlparser.parse('booking', payload2)

    request(server)
      .post('/booking')
      .send(payload)
      .then(function(){
        return request(server)
          .post('/auth')
          .send({'username': 'admin', 'password': 'password123'})
      })
      .then(function(res){
        request(server)
          .put('/booking/1')
          .set('Cookie', 'token=' + res.body.token)
          .set('Content-type', 'text/xml')
          .set('Accept', 'application/json')
          .send(xmlPayload)
github rvspt / QlikSenseGovernance / 1 - NodeJS Tools / lib / app-sheets.js View on Github external
}

                                obj_full_props.qHyperCubeDef.qMeasures[index].parsedData = parsed_msr;
                              });
                            }
                            
                            var data = {
                              obj_full_props,
                              qsLoadTimeObject: sheet_object_loading_time
                            };

                            var options = {
                              useCDATA: true
                            };

                            var xml_sheet_object = js2xmlparser.parse("sheetObject", data, options);

                            //Storing XML with the object's data
                            fs.writeFile("AppStructures/"+config_app.appname+"_SheetObject_"+first_sheet+"_"+first_object+"_"+conn_data.user_directory + "_" + conn_data.user_name+".xml", xml_sheet_object, function(err) {
                              if (err) {
                                if(logging.log_mode || logging.log_mode_full) log.warning("Unable to store AppStructures/"+config_app.appname+"_SheetObject_"+first_sheet+"_"+first_object+"_"+conn_data.user_directory + "_" + conn_data.user_name+".xml: " + err, logging.log_file);
                                throw err;
                              }else{
                                if(logging.log_mode || logging.log_mode_full) log.info("Stored AppStructures/"+config_app.appname+"_SheetObject_"+first_sheet+"_"+first_object+"_"+conn_data.user_directory + "_" + conn_data.user_name+".xml", logging.log_file);

                                if(!logging.silent_mode) console.log(' │  '+config_app.appname+'_SheetObject_'+first_sheet+'_'+first_object+'_'+conn_data.user_directory + '_' + conn_data.user_name+'.xml file saved');
                                if(!logging.silent_mode) console.log(' │  ');
                                if(!logging.silent_mode) console.log(" │  Updating the remaining objects list for this sheet");
                                if(!logging.silent_mode) console.log(" │  This is the objects list length: "+objects_list.length);}
                              //Checking if all the objects were processed
                              if(objects_list.length>0){
                                if(logging.log_mode || logging.log_mode_full) log.info(objects_list.length + " remaining objects. Updating remaining list.", logging.log_file);
github bhushankumarl / eBay-node-client / examples / javaScript / trading / getSessionId.js View on Github external
var tradingRequest = async function () {
    var devId = utils.DEV_ID;
    var ruName = utils.RU_NAME;

    eBay.setDevName(devId);

    const obj = {
        '@': {
            'xmlns': 'urn:ebay:apis:eBLBaseComponents'
        },
        'ErrorLanguage': 'en_US',
        'WarningLevel': 'High',
        'RuName': ruName
    };

    var content = js2xmlparser.parse('GetSessionIDRequest', obj, {declaration: {encoding: 'UTF-8'}});

    try {
        var response = await eBay.trading.getSessionID({content: content});
        console.log('response', response);
    } catch (error) {
        console.log('error ', error);
        return;
    }
};
github rvspt / QlikSenseGovernance / 1 - NodeJS Tools / lib / app-connections.js View on Github external
loading_time=received_time-start_time;

            if(logging.log_mode || logging.log_mode_full) log.info("Received connections list", logging.log_file);
            if(logging.log_mode_full) log.debug("Preparing data for DocumentsConnections_* XML storage", logging.log_file);

            //Setting up data and options for XML file storage
            var data = {
              document_connections,
              qsLoadingTime: loading_time
            };

            var options = {
              useCDATA: true
            }

            var xml_doc_connections = js2xmlparser.parse("documentsConnections", data, options);

            //Storing XML with Connections List
            fs.writeFile('AppStructures/DocumentsConnections_'+conn_data.user_directory + '_' + conn_data.user_name+'.xml', xml_doc_connections, function(err) {
              if (err){ 
                if(logging.log_mode || logging.log_mode_full) log.warning("Unable to store AppStructures/DocumentsConnections_" + conn_data.user_directory + "_" + conn_data.user_name + ".xml: " + err, logging.log_file);
                throw err;
              }
              else{
                if(logging.log_mode || logging.log_mode_full) log.info("Stored AppStructures/DocumentsConnections_" + conn_data.user_directory + "_" + conn_data.user_name + ".xml", logging.log_file);
                if(!logging.silent_mode) console.log('DocumentsConnections.xml file saved');
                resolve("Checkpoint: Connections List is loaded");
              }
            });
          });
        })
github IoTKETI / Mobius / mobius / sgn.js View on Github external
}
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        noti_message['m2m:rqp']['@'] = {
            "xmlns:m2m": "http://www.onem2m.org/xml/protocols",
            "xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance"
        };

        var xmlString = js2xmlparser.parse("m2m:rqp", noti_message['m2m:rqp']);

        callback(xmlString);
    }
    catch (e) {
        console.log('[make_xml_noti_message] xml parsing error');
        callback(e.message);
        return "";
    }
}
github rvspt / QlikSenseGovernance / 1 - NodeJS Tools / lib / app-library-measures.js View on Github external
}).then(function(data){
                        //Setting up options for XML file storage
                        var options = {
                          useCDATA: true
                        };

                        //Storing XML with the measure's data
                        var xml_library_measures = js2xmlparser.parse("libraryMeasures", data, options);
                        fs.writeFile("AppStructures/"+config_app.appname+"_LibraryMeasures_"+first_measure+"_"+conn_data.user_directory + "_" + conn_data.user_name+".xml", xml_library_measures, function(err) {
                          if (err) {
                            if(logging.log_mode || logging.log_mode_full) log.warning("Unable to store AppStructures/"+config_app.appname+"_LibraryMeasures_"+first_measure+"_"+conn_data.user_directory + "_" + conn_data.user_name+".xml: " + err, logging.log_file);
                            throw err;
                          }else{
                            if(logging.log_mode || logging.log_mode_full) log.info("Stored AppStructures/"+config_app.appname+"_LibraryMeasures_"+first_measure+"_"+conn_data.user_directory + "_" + conn_data.user_name+".xml", logging.log_file);

                            if(!logging.silent_mode) console.log('   '+config_app.appname+'_LibraryMeasures_'+first_measure+'_'+conn_data.user_directory + '_' + conn_data.user_name+'.xml file saved');
                            if(!logging.silent_mode) console.log();
                            if(!logging.silent_mode) console.log("   Updating the remaining measures list");
                            if(!logging.silent_mode) console.log("   This is the measures list length: "+measures_list.length);
                          }
                          //Checking if all library measures were processed
                          if(measures_list.length>0){
                            if(logging.log_mode || logging.log_mode_full) log.info(measures_list.length + " remaining measures. Updating remaining list.", logging.log_file);
                            getMeasuresDetails(measures_list);
github priyank-purohit / PostGUI / src / components / Downloads.js View on Github external
downloadTableAsXML(dataFullStatus = false) {
        if (dataFullStatus === false && JSON.stringify(this.state.data) !== "[]") {
            try {
                let result = js2xmlparser.parse(this.state.table, this.state.data);
                let fileName = this.createFileName();

                this.downloadFile(result, fileName, "text/plain");
            } catch (err) {
                console.error(err);
            }
        } else if (dataFullStatus === true) {
            if (JSON.stringify(this.state.dataFull) !== "[]") {
                try {
                    let result = js2xmlparser.parse(
                        this.state.table,
                        this.state.dataFull
                    );
                    let fileName = this.createFileName(true);

                    this.downloadFile(result, fileName, "text/plain");
                } catch (err) {
                    console.error(err);
                }
            }
        }
    }
github node-ebics / node-ebics-client / lib / versions / H004 / serializers / PaymentSerializer.js View on Github external
orderSignature() {
		const xmlObj = {
			'@': {
				xmlns: 'http://www.ebics.org/S001',
				'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
				'xsi:schemaLocation': 'http://www.ebics.org/S001 http://www.ebics.org/S001/ebics_signature.xsd',
			},
			OrderSignatureData: {
				SignatureVersion: 'A006',
				SignatureValue: this.signatureValue(),
				PartnerID: this._partnerId,
				UserID: this._userId,
			},
		};

		return js2xmlparser.parse('UserSignatureData', xmlObj, this._xmlOptions);
	}
github wazuh / wazuh-kibana-app / public / utils / config-handler.js View on Github external
getXML($scope) {
    const config = {};
    Object.assign(config, $scope.currentConfig);
    $scope.JSONContent = false;
    if ($scope.XMLContent) {
      $scope.XMLContent = false;
    } else {
      try {
        const cleaned = objectWithoutProperties(config);
        $scope.XMLContent = XMLBeautifier(
          js2xmlparser.parse('configuration', cleaned)
        );
      } catch (error) {
        $scope.XMLContent = false;
      }
    }
    if (!$scope.$$phase) $scope.$digest();
  }
github node-ebics / node-ebics-client / lib / orders / H004 / serializers / upload.js View on Github external
const orderSignature = (ebicsAccount, document, key, xmlOptions) => {
	const xmlObj = {
		'@': {
			xmlns: 'http://www.ebics.org/S001',
			'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
			'xsi:schemaLocation': 'http://www.ebics.org/S001 http://www.ebics.org/S001/ebics_signature.xsd',
		},
		OrderSignatureData: {
			SignatureVersion: 'A006',
			SignatureValue: signatureValue(document, key),
			PartnerID: ebicsAccount.partnerId,
			UserID: ebicsAccount.userId,
		},
	};

	return js2xmlparser.parse('UserSignatureData', xmlObj, xmlOptions);
};
const encryptedOrderSignature = (ebicsAccount, document, transactionKey, key, xmlOptions) => {

js2xmlparser

Parses JavaScript objects into XML

Apache-2.0
Latest version published 2 years ago

Package Health Score

67 / 100
Full package analysis

Popular js2xmlparser functions