Java Code Examples for org.springframework.util.xml.StaxUtils#getXMLEventReader()
The following examples show how to use
org.springframework.util.xml.StaxUtils#getXMLEventReader() .
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: AbstractMarshaller.java From spring-analysis-note with MIT License | 6 votes |
/** * Template method for handling {@code StaxSource}s. * <p>This implementation delegates to {@code unmarshalXmlStreamReader} or * {@code unmarshalXmlEventReader}. * @param staxSource the {@code StaxSource} * @return the object graph * @throws XmlMappingException if the given source cannot be mapped to an object */ protected Object unmarshalStaxSource(Source staxSource) throws XmlMappingException { XMLStreamReader streamReader = StaxUtils.getXMLStreamReader(staxSource); if (streamReader != null) { return unmarshalXmlStreamReader(streamReader); } else { XMLEventReader eventReader = StaxUtils.getXMLEventReader(staxSource); if (eventReader != null) { return unmarshalXmlEventReader(eventReader); } else { throw new IllegalArgumentException("StaxSource contains neither XMLStreamReader nor XMLEventReader"); } } }
Example 2
Source File: Jaxb2Marshaller.java From spring-analysis-note with MIT License | 6 votes |
protected Object unmarshalStaxSource(Unmarshaller jaxbUnmarshaller, Source staxSource) throws JAXBException { XMLStreamReader streamReader = StaxUtils.getXMLStreamReader(staxSource); if (streamReader != null) { return (this.mappedClass != null ? jaxbUnmarshaller.unmarshal(streamReader, this.mappedClass).getValue() : jaxbUnmarshaller.unmarshal(streamReader)); } else { XMLEventReader eventReader = StaxUtils.getXMLEventReader(staxSource); if (eventReader != null) { return (this.mappedClass != null ? jaxbUnmarshaller.unmarshal(eventReader, this.mappedClass).getValue() : jaxbUnmarshaller.unmarshal(eventReader)); } else { throw new IllegalArgumentException("StaxSource contains neither XMLStreamReader nor XMLEventReader"); } } }
Example 3
Source File: AbstractMarshaller.java From java-technology-stack with MIT License | 6 votes |
/** * Template method for handling {@code StaxSource}s. * <p>This implementation delegates to {@code unmarshalXmlStreamReader} or * {@code unmarshalXmlEventReader}. * @param staxSource the {@code StaxSource} * @return the object graph * @throws XmlMappingException if the given source cannot be mapped to an object */ protected Object unmarshalStaxSource(Source staxSource) throws XmlMappingException { XMLStreamReader streamReader = StaxUtils.getXMLStreamReader(staxSource); if (streamReader != null) { return unmarshalXmlStreamReader(streamReader); } else { XMLEventReader eventReader = StaxUtils.getXMLEventReader(staxSource); if (eventReader != null) { return unmarshalXmlEventReader(eventReader); } else { throw new IllegalArgumentException("StaxSource contains neither XMLStreamReader nor XMLEventReader"); } } }
Example 4
Source File: Jaxb2Marshaller.java From java-technology-stack with MIT License | 6 votes |
protected Object unmarshalStaxSource(Unmarshaller jaxbUnmarshaller, Source staxSource) throws JAXBException { XMLStreamReader streamReader = StaxUtils.getXMLStreamReader(staxSource); if (streamReader != null) { return (this.mappedClass != null ? jaxbUnmarshaller.unmarshal(streamReader, this.mappedClass).getValue() : jaxbUnmarshaller.unmarshal(streamReader)); } else { XMLEventReader eventReader = StaxUtils.getXMLEventReader(staxSource); if (eventReader != null) { return (this.mappedClass != null ? jaxbUnmarshaller.unmarshal(eventReader, this.mappedClass).getValue() : jaxbUnmarshaller.unmarshal(eventReader)); } else { throw new IllegalArgumentException("StaxSource contains neither XMLStreamReader nor XMLEventReader"); } } }
Example 5
Source File: AbstractMarshaller.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * Template method for handling {@code StaxSource}s. * <p>This implementation delegates to {@code unmarshalXmlStreamReader} or * {@code unmarshalXmlEventReader}. * @param staxSource the {@code StaxSource} * @return the object graph * @throws XmlMappingException if the given source cannot be mapped to an object */ protected Object unmarshalStaxSource(Source staxSource) throws XmlMappingException { XMLStreamReader streamReader = StaxUtils.getXMLStreamReader(staxSource); if (streamReader != null) { return unmarshalXmlStreamReader(streamReader); } else { XMLEventReader eventReader = StaxUtils.getXMLEventReader(staxSource); if (eventReader != null) { return unmarshalXmlEventReader(eventReader); } else { throw new IllegalArgumentException("StaxSource contains neither XMLStreamReader nor XMLEventReader"); } } }
Example 6
Source File: Jaxb2Marshaller.java From spring4-understanding with Apache License 2.0 | 6 votes |
protected Object unmarshalStaxSource(Unmarshaller jaxbUnmarshaller, Source staxSource) throws JAXBException { XMLStreamReader streamReader = StaxUtils.getXMLStreamReader(staxSource); if (streamReader != null) { return (this.mappedClass != null ? jaxbUnmarshaller.unmarshal(streamReader, this.mappedClass).getValue() : jaxbUnmarshaller.unmarshal(streamReader)); } else { XMLEventReader eventReader = StaxUtils.getXMLEventReader(staxSource); if (eventReader != null) { return (this.mappedClass != null ? jaxbUnmarshaller.unmarshal(eventReader, this.mappedClass).getValue() : jaxbUnmarshaller.unmarshal(eventReader)); } else { throw new IllegalArgumentException("StaxSource contains neither XMLStreamReader nor XMLEventReader"); } } }