@Test public void resolveEntity_knownUrl() throws IOException, SAXException { final XmlDataHandler handler = new XmlDataHandler(new DataBuilder()); final InputSource input = handler.resolveEntity("publicId is irrelevant", XmlDataHandler.UASDATA_DEF_URL); assertThat(input).isNotNull(); }
@Override public InputSource resolveEntity(final String publicId, final String systemId) throws IOException, SAXException { if (UASDATA_DEF_URL.equals(systemId)) { final InputStream stream = this.getClass().getClassLoader().getResourceAsStream(UASDATA_DEF); return new InputSource(new InputStreamReader(stream, CHARSET)); } throw new SAXException("unable to resolve remote entity, systemId = " + systemId); }
XmlDataHandler extends DefaultHandler { @Override public InputSource resolveEntity(final String publicId, final String systemId) throws IOException, SAXException { if (UASDATA_DEF_URL.equals(systemId)) { final InputStream stream = this.getClass().getClassLoader().getResourceAsStream(UASDATA_DEF); return new InputSource(new InputStreamReader(stream, CHARSET)); } throw new SAXException("unable to resolve remote entity, systemId = " + systemId); } }
XmlDataHandler extends DefaultHandler { @Override public InputSource resolveEntity(final String publicId, final String systemId) throws IOException, SAXException { if (UASDATA_DEF_URL.equals(systemId)) { final InputStream stream = this.getClass().getClassLoader().getResourceAsStream(UASDATA_DEF); return new InputSource(new InputStreamReader(stream, CHARSET)); } throw new SAXException("unable to resolve remote entity, systemId = " + systemId); } XmlDataHandler(@Nonnull final DataBuilder builder); }
XmlDataHandler extends DefaultHandler { @Override public InputSource resolveEntity(final String publicId, final String systemId) throws IOException, SAXException { if (UASDATA_DEF_URL.equals(systemId)) { final InputStream stream = this.getClass().getClassLoader().getResourceAsStream(UASDATA_DEF); return new InputSource(new InputStreamReader(stream, CHARSET)); } throw new SAXException("unable to resolve remote entity, systemId = " + systemId); } XmlDataHandler(@Nonnull final DataBuilder builder); @Override void characters(final char ch[], final int start, final int length); @Override void endElement(final String uri, final String localName, final String tagName); @Override void error(final SAXParseException e); @Override void fatalError(final SAXParseException e); boolean hasError(); boolean hasWarning(); @Override InputSource resolveEntity(final String publicId, final String systemId); @Override void startElement(final String uri, final String localName, final String tagName, final Attributes attributes); @Override void warning(final SAXParseException e); }
XmlDataHandler extends DefaultHandler { @Override public InputSource resolveEntity(final String publicId, final String systemId) throws IOException, SAXException { if (UASDATA_DEF_URL.equals(systemId)) { final InputStream stream = this.getClass().getClassLoader().getResourceAsStream(UASDATA_DEF); return new InputSource(new InputStreamReader(stream, CHARSET)); } throw new SAXException("unable to resolve remote entity, systemId = " + systemId); } XmlDataHandler(@Nonnull final DataBuilder builder); @Override void characters(final char ch[], final int start, final int length); @Override void endElement(final String uri, final String localName, final String tagName); @Override void error(final SAXParseException e); @Override void fatalError(final SAXParseException e); boolean hasError(); boolean hasWarning(); @Override InputSource resolveEntity(final String publicId, final String systemId); @Override void startElement(final String uri, final String localName, final String tagName, final Attributes attributes); @Override void warning(final SAXParseException e);  }