byterat

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  54 随笔 :: 0 文章 :: 15 评论 :: 0 Trackbacks
dom4j 直接往Element中加入符合格式的xml串!

下面的代码直接往root元素插入符合格式的xml串:

String strXml = "<aaa><bbb></bbb><ccc></ccc></aaa>";
Document doc = DocumentHelper.createDocument();
Element  root = doc.getRootElement();
root.add(DocumentHelper.parseText(strXml).getRootElement());
posted on 2007-03-27 16:20 比特鼠 阅读(469) 评论(1)  编辑  收藏 所属分类: Java

评论

# re: dom4j 直接往Element中加入符合格式的xml串! 2008-11-23 13:53 RKing
String strXml = "<aaa><bbb></bbb><ccc></ccc></aaa>";
可以用 strXml 直接构造 Element 不   回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航: