def parseURI(uri, html=0, htmlencoding=None, unfinished=0, impl=None): doc = libxml2dom.parseURI(uri, html=html, htmlencoding=htmlencoding, unfinished=unfinished, impl=(impl or default_impl)) initialiseEvents(doc) return doc
def parseURI(uri, html=0, htmlencoding=None, unfinished=0, impl=None): return libxml2dom.parseURI(uri, html=html, htmlencoding=htmlencoding, unfinished=unfinished, impl=(impl or default_impl))
} if __name__ == "__main__": from irdata.cmd import get_progname import sys, os progname = get_progname() if len(sys.argv) < 2: print >> sys.stderr, "Usage: %s <url>" % progname sys.exit(1) url = sys.argv[1] try: d = libxml2dom.parseURI(url, html=True) for line in sys.stdin.readlines(): name, filter_list, path = line.strip().split("\t") value = d.xpath(path) for filter in filter_list.split(","): filter = filters[filter] value = filter(value) print >> sys.stdout, "%s\t%s" % (name, value) except Exception, exc: print >> sys.stderr, "%s: Manifest retrieval failed with exception: %s" % ( progname, exc) sys.exit(1) # vim: tabstop=4 expandtab shiftwidth=4
} if __name__ == "__main__": from irdata.cmd import get_progname import sys, os progname = get_progname() if len(sys.argv) < 2: print >>sys.stderr, "Usage: %s <url>" % progname sys.exit(1) url = sys.argv[1] try: d = libxml2dom.parseURI(url, html=True) for line in sys.stdin.readlines(): name, filter_list, path = line.strip().split("\t") value = d.xpath(path) for filter in filter_list.split(","): filter = filters[filter] value = filter(value) print >>sys.stdout, "%s\t%s" % (name, value) except Exception, exc: print >>sys.stderr, "%s: Manifest retrieval failed with exception: %s" % (progname, exc) sys.exit(1) # vim: tabstop=4 expandtab shiftwidth=4