obspy.core.util.xmlwrapper.XMLParser.xpath2obj

XMLParser.xpath2obj(xpath, xml_doc=None, convert_to=<type 'str'>, namespace=None)[source]

Converts XPath-like query into an object given by convert_to.

Only the first element will be converted if multiple elements are returned from the XPath query.

Parameters:
  • xpath (str) XPath string, e.g. */event.
  • xml_doc (Element or ElementTree, optional) XML document to query. Defaults to parsed XML document.
  • convert_to (any type) Type to convert to. Defaults to str.
  • namespace (str, optional) Namespace used by query. Defaults to document-wide namespace set at root.

This Page