Here you can find the source of buildXmlStreamReader(String xml)
public static XMLStreamReader buildXmlStreamReader(String xml) throws XMLStreamException
//package com.java2s; //License from project: Open Source License import java.io.StringReader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; public class Main { public static XMLStreamReader buildXmlStreamReader(String xml) throws XMLStreamException { XMLInputFactory factory = XMLInputFactory.newInstance(); return factory.createXMLStreamReader(new StringReader(xml)); }/*w w w . ja v a 2 s. c o m*/ }