def create_java_parser(jdriver=None): try: if jdriver: return XMLReaderFactory.createXMLReader(jdriver) elif jaxp: return factory.newSAXParser().getXMLReader() else: return XMLReaderFactory.createXMLReader() except ParserConfigurationException, e: raise _exceptions.SAXReaderNotAvailable(e.getMessage())
""" # --- Initialization version = "0.10" revision = "$Revision: 1.5 $" import string from xml.sax import xmlreader, saxutils from xml.sax.handler import feature_namespaces, feature_namespace_prefixes from xml.sax import _exceptions # we only work in jython import sys if sys.platform[:4] != "java": raise _exceptions.SAXReaderNotAvailable( "drv_javasax not available in CPython", None) del sys # get the necessary Java SAX classes try: from org.python.core import FilelikeInputStream from org.xml.sax.helpers import XMLReaderFactory from org.xml import sax as javasax from org.xml.sax.ext import LexicalHandler except ImportError: raise _exceptions.SAXReaderNotAvailable("SAX is not on the classpath", None) # get some JAXP stuff try: from javax.xml.parsers import SAXParserFactory, ParserConfigurationException
""" # --- Initialization version = "0.10" revision = "$Revision: 1.5 $" import string from xml.sax import xmlreader, saxutils from xml.sax.handler import feature_namespaces from xml.sax import _exceptions # we only work in jython import sys if sys.platform[:4] != "java": raise _exceptions.SAXReaderNotAvailable( "drv_javasax not available in CPython", None) del sys # get the necessary Java SAX classes try: from java.lang import String from org.xml.sax import ContentHandler, SAXException from org.xml.sax.helpers import XMLReaderFactory except ImportError: raise SAXReaderNotAvailable("SAX is not on the classpath", None) # get some JAXP stuff try: from javax.xml.parsers import SAXParserFactory, ParserConfigurationException factory = SAXParserFactory.newInstance() jaxp = 1