xml的小问题

golliwog 2004-05-14 04:01:10
我用DOM生成了一个XML的Document对象。现在我想把这个Document转换成OutputStream流发送出去。怎么转呢?
...全文
109 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaoxhui 2004-05-14
  • 打赏
  • 举报
回复
up
golliwog 2004-05-14
  • 打赏
  • 举报
回复
是啊,用的是JDK。
我想这样应该可以。
OutputSteam os;

Document doc = new Document();
XmlDocument xmlDoc = (XmlDocument)doc;
xmlDoc.Write(os);

nwpulipeng 2004-05-14
  • 打赏
  • 举报
回复
解析,拼装
flyxxxxx 2004-05-14
  • 打赏
  • 举报
回复
如果你用的是JDK中的...
只好自己解决,呵呵..
maowu 2004-05-14
  • 打赏
  • 举报
回复
你用什么包处理dom?
如果你用的是org.jdom,
Document doc = .......
try {
FileOutputStream fos = new FileOutputStream(file);
new XMLOutputter().output(doc, fos);
fos.close();

}
catch (Exception e) {
e.printStackTrace();

}

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧