Questions tagged [xml2js]

Simple XML to JavaScript object converter

Simple XML to JavaScript object converter. It supports bi-directional conversion. Uses sax-js and xmlbuilder-js.

More information on project page.

141 questions
1
vote
1 answer

xml2js - always return an array for certain nodes

The NPM package xml2js has the explicitArray option which only puts nodes into an array if there is more than one of them. Sometimes I have XML which only has one instance of a node but I need it in an array. Is there a way to specify a list of node…
strattonn
  • 1,790
  • 2
  • 22
  • 41
1
vote
1 answer

Cannot access xml attributes when looping over items of xml2js-parsed json

I'm trying to access the attributes of items within an xml rss feed after the xml has been parsed into json using xml2js. I can access individual attributes using items[0].el.$.attribute. However, if I loop over each item I can't go deeper than the…
ztrat4dkyle
  • 1,652
  • 2
  • 13
  • 13
1
vote
1 answer

throwing an error 'Maximum call stack Size exceeded' when trying to convert from json to xml

I have below xml ADMITADMITSUM and I have converted into json as let…
valli
  • 103
  • 2
  • 11
1
vote
1 answer

Node.js - Xml Parsing

I have used many xml parsers till now, but non of them helps me to achieve my objective. A list of parsers that I've used is xml-body-parser, xml2js, libxmljs and xamel. I want to do following things Parse XML and insert all elements one by one to…
1
vote
1 answer

using xml2js in protractor

I am using a protractor application with typescript where I am converting an XML file to JSON format; I have a few questions : Here is the code in the source.ts file: { var parseString = require('xml2js').parseString; var xml =…
user1400915
  • 1,933
  • 6
  • 29
  • 55
1
vote
1 answer

Adding missing XML closing tags in Javascript

I need to parse external files with the below structure using Node.js. EXACTECH…
Shantanu Paul
  • 706
  • 10
  • 26
1
vote
0 answers

How to pass Schema in Postman for XML Responses?

I have received Successful response for a SOAP Post Request in Postman which is well explained in this link. But I want to know how can I pass the Schema for XML responses by the Snippet: Use tiny validator for json data which is used often to…
1
vote
2 answers

Javascript how to put xml2js into a function

I am trying to export a function which will parse a xml to json object. export const parse = (body) => { const parser = new xml2js.Parser({explicitArray: false, trim: true}); parser.parseString(body, (err, result) => { if (err) return err; …
1
vote
1 answer

How to get access to xml2js result properties

Hi i have parsed the Xml to JSON using xml2js package in node js. The result is like as follows.. Now i need to get the properties of JSON object, like result.env:Envelope but it generates compile time error. How can i access the object. Any help…
Saad Zulfiqar
  • 410
  • 5
  • 16
1
vote
1 answer

fetching xml from web service in Angular 4

I am simply trying to retrieve xml data from some domain and read them onto my application. For now, I just want to read raw data. From my research, It comes to me that it is best to convert xml into json and load them onto the application. Here is…
K.Son
  • 29
  • 2
  • 10
1
vote
1 answer

Is xml2js guaranteed to be synchronous and does it throw errors?

I am using xml2js and I need to be robust since there is no guarantee that the source of the xml is well-formed. So, I need to ensure that all errors are able to be handled. If the code looks something like this: let parseString =…
Andrew Eisenberg
  • 28,387
  • 9
  • 92
  • 148
1
vote
1 answer

How to chain promise in redux action

How do i make an api call first in redux action and then dispatch GET_TODOs? // first the api call has to be made, export function getTodos() { return { type: 'GET_TODOS', promise: request.get(API_URL) } …
kobe
  • 15,671
  • 15
  • 64
  • 91
1
vote
1 answer

xml2js parsing - how to extract metadata attribute value?

I am trying to create a custom json by extracting data with xml2parsing. So far I have this: function createCustomJson(d{ let dataFromXml = ""; parseString(d, {trim: true}, function (err, result) { dataFromXml =…
akrelj
  • 151
  • 4
  • 18
1
vote
1 answer

Adding property to JSON object in Javascript

I am using xml2js to convert xml to js object and add new nodes to the content Ex1: 123 456 Ex2: 123 In the Ex1, the my-node property will be an array…
RaceBase
  • 18,428
  • 47
  • 141
  • 202
0
votes
0 answers

xml2js valueProcessors object

How do you flatten the value in xml2js ? I am trying to flatten the value of sf:LastModifiedBy (field modified to lastModifiedByName). I am modifying the field names with the tagNameProcessor function. The valueProcessors can be used to modify…
jani_r
  • 637
  • 1
  • 7
  • 18