URL url = new URL(obj.toString());
new URL(obj.toString());
    public static Document parseXml(Object obj)                             throws SAXException, IOException,                                     ParserConfigurationException {        if (domBuilderFactory == null) {            domBuilderFactory = javax.xml.parsers.DocumentBuilderFactory.newInstance();        }        DocumentBuilder parser = domBuilderFactory.newDocumentBuilder();        Document doc = null;        if (obj instanceof String) {            try {                // first try to interpret string as URL                URL url = new URL(obj.toString());                doc = parser.parse(obj.toString());            } catch (MalformedURLException nourl) {                // if not a URL, maybe it is the XML itself                doc = parser.parse(new InputSource(new StringReader(obj.toString())));            }        } else if (obj instanceof InputStream) {            doc = parser.parse(new InputSource((InputStream) obj));        } else if (obj instanceof Reader) {            doc = parser.parse(new InputSource((Reader) obj));        }        doc.normalize();        return doc;    }