使用jdom解析xml字符串代碼以下java
String xml = "<root>......</root>"; SAXBuilder builder = new SAXBuilder(); Document doc = builder.build(xml);
運行時,拋異常java.net.MalformedURLException: no protocol......dom
解決辦法以下:ui
String xml="<root>......</root>"; SAXBuilder builder = new SAXBuilder(); Document doc = builder.build(new ByteArrayInputStream(xml.getBytes()));