ITeye博客

String 与 dom4j

dodoflying · 2007-03-01 11:58 · about CS · Markdown

If you have some XML as a String you can parse it back into a Document again using the helper method DocumentHelper.parseText()


java 代码

String text = " James ";   Document document = DocumentHelper.parseText(text);  
而通常情况,如果是文件或者url,则使用如下形式

java 代码

SAXReader xmlReader = new SAXReader();    this.doc = xmlReader.read(url);  
在Figo项目中,首先将表示包体的字节流放入bytebuffer中,将其转换为String类型,然后使用dom4j进行解析:)

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。