0

Using xml2js, what is the way to parse XML and return a result without the XML attributes?

E.g., for the input

<foo type="attr">bar</completion_date>

I wish to get

"foo": "Bar"

Rather than

"foo": {
  "_": "bar",
  "$": {
    "type": "attr"
  }
}
Mr.
  • 9,429
  • 13
  • 58
  • 82

1 Answers1

2

Set option ignoreAttrs: true in your Parser object. The it will ignore all XML attributes. Look at the options section in the documantation for referance.

Bar
  • 1,334
  • 1
  • 8
  • 21