def idref_timestamp_resolves(root, idref, timestamp, namespaces): """Determines if an `idref` and `timestamp` pair resolve to an XML component under `root`. """ root = utils.get_etree_root(root) timestamp = utils.parse_timestamp(timestamp) xpath = "//*[@id='{0}']".format(idref) nodes = root.xpath(xpath, namespaces=namespaces) return any(utils.is_equal_timestamp(timestamp, node) for node in nodes)
def idref_timestamp_resolves(root, idref, timestamp, namespaces): """Determines if an `idref` and `timestamp` pair resolve to an XML component under `root`. """ root = utils.get_etree_root(root) timestamp = utils.parse_timestamp(timestamp) xpath = "//*[@id='{0}']".format(idref) nodes = root.xpath(xpath, namespaces=namespaces) return any(utils.is_equal_timestamp(timestamp, node) for node in nodes)
def _equal_timestamps(nodeset): return [x for x in nodeset if utils.is_equal_timestamp(node, x)]
def _equal_timestamps(nodeset): return [x for x in nodeset if utils.is_equal_timestamp(node, x)]