/** * Parse the StAX XML reader passed at construction-time. * <p><b>NOTE:</b>: The given {@code InputSource} is not read, but ignored. * @param ignored is ignored * @throws SAXException a SAX exception, possibly wrapping a {@code XMLStreamException} */ @Override public final void parse(InputSource ignored) throws SAXException { parse(); }
/** * Parse the StAX XML reader passed at construction-time. * <p><b>NOTE:</b>: The given system identifier is not read, but ignored. * @param ignored is ignored * @throws SAXException a SAX exception, possibly wrapping a {@code XMLStreamException} */ @Override public final void parse(String ignored) throws SAXException { parse(); }
/** * Parse the StAX XML reader passed at construction-time. * <p><b>NOTE:</b>: The given {@code InputSource} is not read, but ignored. * @param ignored is ignored * @throws SAXException a SAX exception, possibly wrapping a {@code XMLStreamException} */ @Override public final void parse(InputSource ignored) throws SAXException { parse(); }
/** * Parse the StAX XML reader passed at construction-time. * <p><b>NOTE:</b>: The given system identifier is not read, but ignored. * @param ignored is ignored * @throws SAXException a SAX exception, possibly wrapping a {@code XMLStreamException} */ @Override public final void parse(String ignored) throws SAXException { parse(); }
@Test public void lexicalHandler() throws Exception { Resource testLexicalHandlerXml = new ClassPathResource("testLexicalHandler.xml", getClass()); LexicalHandler expectedLexicalHandler = mockLexicalHandler(); standardReader.setContentHandler(null); standardReader.setProperty("http://xml.org/sax/properties/lexical-handler", expectedLexicalHandler); standardReader.parse(new InputSource(testLexicalHandlerXml.getInputStream())); inputFactory.setProperty("javax.xml.stream.isCoalescing", Boolean.FALSE); inputFactory.setProperty("http://java.sun.com/xml/stream/properties/report-cdata-event", Boolean.TRUE); inputFactory.setProperty("javax.xml.stream.isReplacingEntityReferences", Boolean.FALSE); inputFactory.setProperty("javax.xml.stream.isSupportingExternalEntities", Boolean.FALSE); LexicalHandler actualLexicalHandler = mockLexicalHandler(); willAnswer(invocation -> invocation.getArguments()[0] = "element"). given(actualLexicalHandler).startDTD(anyString(), anyString(), anyString()); AbstractStaxXMLReader staxXmlReader = createStaxXmlReader(testLexicalHandlerXml.getInputStream()); staxXmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", actualLexicalHandler); staxXmlReader.parse(new InputSource()); // TODO: broken comparison since Mockito 2.2 upgrade // verifyIdenticalInvocations(expectedLexicalHandler, actualLexicalHandler); }
@Test public void contentHandlerNamespacesNoPrefixes() throws Exception { standardReader.setFeature("http://xml.org/sax/features/namespaces", true); standardReader.setFeature("http://xml.org/sax/features/namespace-prefixes", false); standardReader.parse(new InputSource(createTestInputStream())); AbstractStaxXMLReader staxXmlReader = createStaxXmlReader(createTestInputStream()); ContentHandler contentHandler = mockContentHandler(); staxXmlReader.setFeature("http://xml.org/sax/features/namespaces", true); staxXmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", false); staxXmlReader.setContentHandler(contentHandler); staxXmlReader.parse(new InputSource()); verifyIdenticalInvocations(standardContentHandler, contentHandler); }
@Test public void contentHandlerNamespacesPrefixes() throws Exception { standardReader.setFeature("http://xml.org/sax/features/namespaces", true); standardReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); standardReader.parse(new InputSource(createTestInputStream())); AbstractStaxXMLReader staxXmlReader = createStaxXmlReader(createTestInputStream()); ContentHandler contentHandler = mockContentHandler(); staxXmlReader.setFeature("http://xml.org/sax/features/namespaces", true); staxXmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); staxXmlReader.setContentHandler(contentHandler); staxXmlReader.parse(new InputSource()); verifyIdenticalInvocations(standardContentHandler, contentHandler); }
@Test public void contentHandlerNoNamespacesPrefixes() throws Exception { standardReader.setFeature("http://xml.org/sax/features/namespaces", false); standardReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); standardReader.parse(new InputSource(createTestInputStream())); AbstractStaxXMLReader staxXmlReader = createStaxXmlReader(createTestInputStream()); ContentHandler contentHandler = mockContentHandler(); staxXmlReader.setFeature("http://xml.org/sax/features/namespaces", false); staxXmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); staxXmlReader.setContentHandler(contentHandler); staxXmlReader.parse(new InputSource()); verifyIdenticalInvocations(standardContentHandler, contentHandler); }
/** * Parse the StAX XML reader passed at construction-time. * <p><b>NOTE:</b>: The given <code>InputSource</code> is not read, but ignored. * @param ignored is ignored * @throws SAXException a SAX exception, possibly wrapping a <code>XMLStreamException</code> */ public final void parse(InputSource ignored) throws SAXException { parse(); }
/** * Parse the StAX XML reader passed at construction-time. * <p><b>NOTE:</b>: The given system identifier is not read, but ignored. * @param ignored is ignored * @throws SAXException A SAX exception, possibly wrapping a <code>XMLStreamException</code> */ public final void parse(String ignored) throws SAXException { parse(); }
/** * Parse the StAX XML reader passed at construction-time. * <p><b>NOTE:</b>: The given system identifier is not read, but ignored. * @param ignored is ignored * @throws SAXException a SAX exception, possibly wrapping a {@code XMLStreamException} */ @Override public final void parse(String ignored) throws SAXException { parse(); }
/** * Parse the StAX XML reader passed at construction-time. * <p><b>NOTE:</b>: The given {@code InputSource} is not read, but ignored. * @param ignored is ignored * @throws SAXException a SAX exception, possibly wrapping a {@code XMLStreamException} */ @Override public final void parse(InputSource ignored) throws SAXException { parse(); }
/** * Parse the StAX XML reader passed at construction-time. * <p><b>NOTE:</b>: The given {@code InputSource} is not read, but ignored. * @param ignored is ignored * @throws SAXException a SAX exception, possibly wrapping a {@code XMLStreamException} */ @Override public final void parse(InputSource ignored) throws SAXException { parse(); }
/** * Parse the StAX XML reader passed at construction-time. * <p><b>NOTE:</b>: The given system identifier is not read, but ignored. * @param ignored is ignored * @throws SAXException a SAX exception, possibly wrapping a {@code XMLStreamException} */ @Override public final void parse(String ignored) throws SAXException { parse(); }