diff --git a/src/lib/xml2js.ts b/src/lib/xml2js.ts index e2eed33..aea3d17 100644 --- a/src/lib/xml2js.ts +++ b/src/lib/xml2js.ts @@ -81,7 +81,7 @@ export class Xml2js { valueNodes = this.helper.selectNodes(input, './value'); if (!valueNodes.length) return []; - return valueNodes.map(this.convert); + return valueNodes.map(this.convert, this); } /** @@ -114,7 +114,7 @@ export class Xml2js { /** * Convert an xmlrpc value (as an xml tree) to a javascript object. */ - convert(input:Node):Object|null { + convert(input:Node):Object|any[]|null { const elt = this.helper.selectSingleNode(input, './*') if (!elt) return null diff --git a/src/lib/xmlrpc.service.ts b/src/lib/xmlrpc.service.ts index 23d0cab..57e0299 100644 --- a/src/lib/xmlrpc.service.ts +++ b/src/lib/xmlrpc.service.ts @@ -77,10 +77,11 @@ export class XmlrpcService { * - undefined: for empty response * - null: for 'nil' value * - Object: the value as an Object + * - any[]: if the value was an Array * * @throws {@link Error} on fault response (or unexpected server error) */ - parseResponse(response:string):Object|null|undefined { + parseResponse(response:string):Object|any[]|null|undefined { const doc = this.helper.loadXml(response) const rootNode = doc.firstChild if (!rootNode)