Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.*; import org.xml.sax.*; public class Main { /** * Forms an <code>InputSource</code> for parsing XML documents * from a string. Returns <code>null</code> if any of the exceptions * are thrown. * * @param xml String with the XML document. * @return An <code>InputSource</code> representation. */ public static InputSource getInputSourceFromString(String xml) { InputSource retVal = null; try { retVal = new InputSource(new StringReader(xml)); } catch (Exception ex) { } return retVal; } }