xpath

find(element, query)

Execute an XPath query on an xml2js object.

Arguments:
  • element (object) – An xml2js element.

  • query (string) – An XPath query.

Returns:

Array.<object> – An array of xml2js elements matching the query.

parseXPath(query)

Parse an XPath query.

This is a minimal parser only suitable for this package.

Arguments:
  • query (string) – An XPath query.

Returns:

object – The parsed search parameters.

Search for children of an element with a given name and attribute.

Arguments:
  • element (object) – An xml2js element.

  • elementName (string) – The element name.

  • attributeName (string) – The attribute name.

Returns:

Array.<object> – An array of xml2js elements with the given name and attribute.