diff --git a/types/libxmljs/libxmljs-tests.ts b/types/libxmljs/libxmljs-tests.ts index 367d74c69d..72c480614e 100644 --- a/types/libxmljs/libxmljs-tests.ts +++ b/types/libxmljs/libxmljs-tests.ts @@ -47,3 +47,18 @@ const doc = new libxmljs.Document(); .node('sibling', 'with content!'); const {name, externalId, systemId} = doc.getDtd(); + +const xmlWithNs = '' + + '' + + '' + + 'grandchild content' + + '' + + 'with content!' + + ''; + +const xmlDocWithNs = libxmljs.parseXml(xmlWithNs); + +// xpath queries +const gchildWithNs = xmlDocWithNs.get('//a:grandchild', {"a": "http://test.com/test"})!; + +console.log(gchildWithNs.text()); // prints "grandchild content" \ No newline at end of file