{ return array(new JavaClass("org.xml.sax.EntityResolver"), new JavaClass("org.xml.sax.DTDHandler"), new JavaClass("org.xml.sax.DocumentHandler"), new JavaClass("org.xml.sax.ErrorHandler")); } // Create an instance of HandlerBase which implements the above // interfaces. function createHandler() { return java_closure(new HandlerBase(), null, getInterfaces()); } // Standard SAX handling $ParserFactory = new JavaClass("javax.xml.parsers.SAXParserFactory"); $parser = $ParserFactory->newInstance()->newSaxParser()->getParser(); $handler = createHandler(); $parser->setDocumentHandler($handler); $parser->setErrorHandler($handler); $parser->setFeature("http://apache.org/xml/features/validation/schema", false); $parser->setFeature("http://xml.org/sax/features/namespaces", false); $parser->setFeature("http://xml.org/sax/features/validation", false); $parser->setFeature("http://xml.org/sax/features/namespace-prefixes", false); $parser->setFeature("http://apache.org/xml/features/validation/schema-full-checking", false); // capture the HTML output of phpinfo .. // ob_start(); // phpinfo(); // $in = new java("java.io.ByteArrayInputStream", ob_get_contents()); // ob_end_clean(); $here = getcwd(); $in = new java("java.io.FileInputStream", "{$here}/phpinfo.xml"); // and filter it through the above callbacks $inputSource = new java("org.xml.sax.InputSource", "{$here}/DTD"); $inputSource->setByteStream($in); $parser->parse($inputSource);