you can use the short method
import { parseStringPromise } from 'xml2js';
xmlresponse = `<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<QAInformation
xmlns="http://www.qas.com/OnDemand-2011-03">
<StateTransition>SearchResults</StateTransition>
<CreditsUsed>1</CreditsUsed>
</QAInformation>
</soap:Header>
<soap:Body>
<Address
xmlns="http://www.qas.com/OnDemand-2011-03">
<QAAddress DPVStatus="DPVNotConfigured">
<AddressLine LineContent="None">
<Label />
<Line>Commonwealth Bank Building</Line>
</AddressLine>
<AddressLine LineContent="None">
<Label />
<Line>L 10 71-89 Adelaide St</Line>
</AddressLine>
<AddressLine LineContent="None">
<Label />
<Line />
</AddressLine>
<AddressLine>
<Label>Locality</Label>
<Line>BRISBANE CITY</Line>
</AddressLine>
<AddressLine>
<Label>State code</Label>
<Line>QLD</Line>
</AddressLine>
<AddressLine>
<Label>Postcode</Label>
<Line>4000</Line>
</AddressLine>
<AddressLine>
<Label>Country</Label>
<Line>AUSTRALIA</Line>
</AddressLine>
<AddressLine LineContent="Ancillary">
<Label>DPID/DID</Label>
<Line>87902264</Line>
</AddressLine>
</QAAddress>
</Address>
</soap:Body>
</soap:Envelope>`
let convert = await parseStringPromise(xmlresponse);
convert = (JSON.parse(JSON.stringify(convert)));
console.log(convert['soap:Envelope']['soap:Body'][0]['Address'][0]['QAAddress'][0]['AddressLine']);
you will have something like this
[
{
'$': { LineContent: 'None' },
Label: [ '' ],
Line: [ 'Commonwealth Bank Building' ]
},
{
'$': { LineContent: 'None' },
Label: [ '' ],
Line: [ 'L 10 71-89 Adelaide St' ]
},
{ '$': { LineContent: 'None' }, Label: [ '' ], Line: [ '' ] },
{ Label: [ 'Locality' ], Line: [ 'BRISBANE CITY' ] },
{ Label: [ 'State code' ], Line: [ 'QLD' ] },
{ Label: [ 'Postcode' ], Line: [ '4000' ] },
{ Label: [ 'Country' ], Line: [ 'AUSTRALIA' ] },
{
'$': { LineContent: 'Ancillary' },
Label: [ 'DPID/DID' ],
Line: [ '87902264' ]
}
]