解析XML的parse()方法如何解析XML样式的字符串?????着急多谢指教!!!
要求必须解析一个XML样式的字符串,用Parse()方法如何实现??????
String strXML="<xml><root><name>ddd</name></root></xml>";
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = null;
try{
db = dbf.newDocumentBuilder();
Document doc = null;
doc = db.parse(new StringBufferInputStream(strXML));
}
catch(){
...
在“new StringBufferInputStream(strXML)”处提示错误,多谢关注散分为盼!!!