Java 8 SAXSource - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 SAXSource class.

This code example shows how to use the following methods: getInputSource, getXMLReader, setInputSource, setXMLReader
	 * @throws XmlMappingException if the given source cannot be mapped to an object 
	 * @throws IOException if an I/O Exception occurs 
	 * @see #unmarshalSaxReader(org.xml.sax.XMLReader, org.xml.sax.InputSource) 
	 */ 
	protected Object unmarshalSaxSource(SAXSource saxSource) throws XmlMappingException, IOException {
		if (saxSource.getXMLReader() == null) {
			try { 
				saxSource.setXMLReader(createXmlReader());
			} 
			catch (SAXException ex) {
				throw new UnmarshallingFailureException("Could not create XMLReader for SAXSource", ex);
			} 
		} 
		if (saxSource.getInputSource() == null) {
			saxSource.setInputSource(new InputSource());
		} 
		return unmarshalSaxReader(saxSource.getXMLReader(), saxSource.getInputSource());
	} 
 
	/** 

8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
	} 
 
	@Test
	public void unmarshalSAXSource() throws Exception {
		XMLReader reader = XMLReaderFactory.createXMLReader();
		SAXSource source = new SAXSource(reader, new InputSource(new StringReader(INPUT_STRING)));
		Object flights = unmarshaller.unmarshal(source);
		testFlights(flights); 
	} 
 
	@Test
	public void unmarshalStaxSourceXmlStreamReader() throws Exception {
		XMLInputFactory inputFactory = XMLInputFactory.newInstance();
		XMLStreamReader streamReader = inputFactory.createXMLStreamReader(new StringReader(INPUT_STRING));
		Source source = StaxUtils.createStaxSource(streamReader);
		Object flights = unmarshaller.unmarshal(source);
		testFlights(flights); 
	} 
 
	@Test
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
        } catch (JAXBException ex) {
            throw new ProcessingException(LocalizationMessages.ERROR_WADL_JAXB_CONTEXT(), ex);
        } 
 
        final SAXParser saxParser = saxParserFactory.newSAXParser();
        SAXSource source = new SAXSource(saxParser.getXMLReader(), new InputSource(inputStream));
        final Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
        final Object result = unmarshaller.unmarshal(source);
        return resultClass.cast(result);
    } 
 
    /** 
     * Return {@code true} if generation of full WADL with 
     * {@link org.glassfish.jersey.server.model.ExtendedResource extended resources} is requested. 
     * 
     * @param uriInfo URI info of the request. 
     * @return {@code true} if full detailed WADL should be generated; false otherwise. 
     */ 
    public static boolean isDetailedWadlRequested(UriInfo uriInfo) {
        final List<String> simple = uriInfo.getQueryParameters().get(DETAILED_WADL_QUERY_PARAM);
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
public class StaxUtilsTests { 
 
	@Test
	public void isStaxSourceInvalid() throws Exception {
		assertFalse("A StAX Source", StaxUtils.isStaxSource(new DOMSource()));
		assertFalse("A StAX Source", StaxUtils.isStaxSource(new SAXSource()));
		assertFalse("A StAX Source", StaxUtils.isStaxSource(new StreamSource()));
	} 
 
	@Test
	public void isStaxSource() throws Exception {
		XMLInputFactory inputFactory = XMLInputFactory.newInstance();
		String expected = "<element/>";
		XMLStreamReader streamReader = inputFactory.createXMLStreamReader(new StringReader(expected));
		Source source = StaxUtils.createCustomStaxSource(streamReader);
 
		assertTrue("Not a StAX Source", StaxUtils.isStaxSource(source));
	} 
 
	@Test
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
        }); 
 
        XMLFilter xmlFilter = new NoSourceAndNamespaceFilter(parser.getXMLReader());
        xmlFilter.setContentHandler(unmarshaller.getUnmarshallerHandler());
 
        SAXSource source = new SAXSource(xmlFilter, inputSource);
 
        return (Features)unmarshaller.unmarshal(source);
         
        } catch (ParserConfigurationException e) {
            throw new RuntimeException(e);
        } catch (JAXBException e) {
            throw new RuntimeException(e);
        } catch (SAXException e) {
            throw new RuntimeException(e);
        } 
    } 
 
    /** 
     * Provides an empty inputsource for the entity resolver. 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Java 8 SAXSource Methods: