def trang(self, outfn=None, ext='.rng'):
        """use trang to convert the Schema to the given output filename or to the given extension
        SIDE EFFECT: creates a new file on the filesystem.
        """
        from . import JARS
        java = os.environ.get('java') or 'java'
        trang_jar = os.path.join(JARS, 'trang.jar')
        outfn = outfn or os.path.splitext(self.fn)[0] + ext
        stderr = tempfile.NamedTemporaryFile()
        try:
            result = subprocess.check_call(
                [java, "-jar", trang_jar, self.fn, outfn],
                universal_newlines=True,
                stderr=stderr)
        except subprocess.CalledProcessError as e:
            f = open(stderr.name, 'r+b')
            output = f.read(); f.close()
            raise RuntimeError(str(output, 'utf-8')).with_traceback(sys.exc_info()[2]) from None
        if result==0:
            return outfn