Hi I would like to know how we can convert the string content which is in the form of XML tag and I need to convert it into XMLStreamReader
You can use XMLInputFactory.createXMLStreamReader
, passing in a StringReader
to wrap your string.
String text = "<foo>This is some XML</foo>";
Reader reader = new StringReader(text);
XMLInputFactory factory = XMLInputFactory.newInstance(); // Or newFactory()
XMLStreamReader xmlReader = factory.createXMLStreamReader(reader);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With