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
11
votes
2 answers

Parse XML from Axios response, pushing to Vue data array

In my Vue app, I get an XML file with Axios and use parseString to parse XML as JSON. I then need to pass the result to Vue data (this.events). My console.log shows the parsed XML as JSON, but I cannot push to Vue data inside this function. var…
Filip Blaauw
  • 731
  • 2
  • 16
  • 29
11
votes
1 answer

xml2js - xml tag values converted to array of jsons

I am using the following code to convert xml to json :- var parseString = require('xml2js').parseString; var xml = "Hello xml2js! "; parseString(xml, {trim:…
Aarushi Mishra
  • 672
  • 1
  • 7
  • 20
9
votes
2 answers

How to get xml2js results out of the parser in ES6?

I'm building a server in Node that will search a folder to see if an XML file exists (glob), and if it does, read the file in (fs) as a JSON object (xml2js) and eventually store it in a database somewhere. I'm want to get the results OUT of the…
Mike
  • 107
  • 1
  • 1
  • 5
9
votes
2 answers

Invalid character entity parsing xml

I am trying to parse a string of xml and I getting an error [Error: Invalid character entity Line: 0 Column: 837 Char: ] Does xml not like brackets? Do I need to replace all the brackets with something like \\]. Thanks
jrock2004
  • 3,229
  • 5
  • 40
  • 73
8
votes
1 answer

After updating from Angular 5 to 6 I keep getting the error: can't resolve timers in xml2js

Like the title say, I keep on getting this weird error. I also tried uninstalling it by using npm uninstall xml2js but nothing has worked until now.
BrianM
  • 951
  • 2
  • 12
  • 29
7
votes
3 answers

xml2js is vulnerable to prototype pollution

xml2js <=0.4.23 Severity: high xml2js is vulnerable to prototype pollution - https://github.com/advisories/GHSA-776f-qx25-q3cc No fix available node_modules/xml2js aws-sdk * Depends on vulnerable versions of xml2js node_modules/aws-sdk 2 high…
Keerthan Mjr
  • 81
  • 1
  • 4
7
votes
2 answers

Parsing XML with Typescript and xml2js

I am trying to work with Express and parse an XML body. I am using the bodyparser for text, but cannot get the xml2js to parse my XML into a usable format. import * as xml2js from 'xml2js'; try { const XML:string =…
Steven Scott
  • 10,234
  • 9
  • 69
  • 117
6
votes
2 answers

use xml2js parseString return value

xml = `
毕兴涛
  • 63
  • 1
  • 1
  • 4
5
votes
2 answers

How to import xml2js in an angular2 app using angular-cli with webpack

For an application using angular2 (from angular-cli with webpack), i need to consume some data in xml from a soap web service.The angular-cli that i use provide natively the library xml2js for parsing xml to json but when i try to use this library…
Sedo
  • 63
  • 1
  • 6
5
votes
1 answer

How do I escape characters using the Node xml2js module?

I have an xml document with an & in it, so I am getting an error [Error: Invalid character in entity name Line: 155 Column: 63 Char: ] I wrote a function to escape illegal xml characters: const escapeIllegalCharacters = (xml) => { …
Dan
  • 2,647
  • 2
  • 27
  • 37
3
votes
0 answers

xml2js Tags inside Tag value

I am trying to parse XML files in nestjs using xml2js an everything worked fine until now, but now i've got a problem: XML to parse: Hi there…
Raoul
  • 43
  • 4
3
votes
2 answers

Write JSON to mysql database with node.js

I'm trying to write a JSON object (or string, unsure) to my mysql database using node.js. I first retrieved the JSON via an xml url using xml2js. I am able to log the json string result in my console via JSON.stringify, but I am unsure how to…
cdwhiteiv
  • 87
  • 1
  • 7
3
votes
2 answers

Parsing XML to JSON UTF-8

I'm using xml2js, since I need to convert a XML feed to JSON. But when I receive the XML, it shows Æ, Ø & Å as expected. But after parsing it. I receive: Ø as \ufffd or �. I'm already setting the encoding as UTF-8, so I'm not sure what I'm doing…
Grumme
  • 794
  • 2
  • 9
  • 31
3
votes
4 answers

Parsing with xml2js

I am new to node.js and need to parse XML. In js, I just use a DOMParser and use getElementsByTagName to get the values I desire. I have just switched to node and am using xml2js (willing to consider alternatives). I have not been able to figure out…
rocketlobster
  • 690
  • 7
  • 18
3
votes
0 answers

xml2js parser ignores the empty string in an array resulting in array size change

xml below to be parsed: apple 4 85 add and response after parsing: { "ENVELOPE": { "ABC": { "DEF": "apple", "GHI":…
Ankur
  • 677
  • 1
  • 7
  • 21
1
2 3
9 10