org.springframework.util.xml.StaxUtils#getXMLStreamReader ( )源码实例Demo

下面列出了org.springframework.util.xml.StaxUtils#getXMLStreamReader ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: spring-analysis-note   文件: AbstractMarshaller.java
/**
 * 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");
		}
	}
}
 
源代码2 项目: spring-analysis-note   文件: Jaxb2Marshaller.java
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");
		}
	}
}
 
/**
 * 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");
		}
	}
}
 
源代码4 项目: java-technology-stack   文件: Jaxb2Marshaller.java
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");
		}
	}
}
 
/**
 * 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");
		}
	}
}
 
源代码6 项目: spring4-understanding   文件: Jaxb2Marshaller.java
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");
		}
	}
}