org.xml.sax.helpers.ParserAdapter Java Examples
The following examples show how to use
org.xml.sax.helpers.ParserAdapter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TOCConverter.java From ghidra with Apache License 2.0 | 5 votes |
/** * Read the source table of contents file and build up hash maps to maintain * TOC entry names to urls and map IDs. */ private void readSourceTOC() throws IOException, SAXException, ParserConfigurationException { SAXParserFactory factory = XmlUtilities.createSecureSAXParserFactory(false); XMLReader parser = new ParserAdapter(factory.newSAXParser().getParser()); File file = createTempTOCFile(); String fileURL = file.toURI().toURL().toString(); TOCHandler handler = new TOCHandler(); parser.setContentHandler(handler); parser.setErrorHandler(handler); parser.setFeature("http://xml.org/sax/features/namespaces", true); System.out.println(" Parsing input file " + sourceFilename); parser.parse(fileURL); file.deleteOnExit(); }
Example #2
Source File: ParserAdapterTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Initiate ParserAdapter. * @throws Exception If any errors occur. */ ParserAdapterTest() throws Exception { SAXParserFactory spf = SAXParserFactory.newInstance(); XMLReader xmlReader = spf.newSAXParser().getXMLReader(); XMLReaderAdapter xmlReaderAdapter = new XMLReaderAdapter(xmlReader); parserAdapter = new ParserAdapter(xmlReaderAdapter); }
Example #3
Source File: ParserAdapterTest.java From j2objc with Apache License 2.0 | 5 votes |
public void testParserAdapter() { System.setProperty("org.xml.sax.parser", "org.apache.harmony.tests.org.xml.sax.support.DoNothingParser"); try { new ParserAdapter(); } catch (SAXException e) { throw new RuntimeException("Unexpected exception", e); } }