谁能给个最简单的XML程序,要全部过程!

ilian 2002-12-28 11:54:25
IE能通过!
...全文
43 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
squirrel_1976 2002-12-30
  • 打赏
  • 举报
回复
The following example performs a transformation using DOM nodes as input for the TransformerFactory, as input for the
Transformer, and as the output of the transformation.

TransformerFactory tfactory = TransformerFactory.newInstance();
// Make sure the TransformerFactory supports the DOM feature.
if (tfactory.getFeature(DOMSource.FEATURE) && tfactory.getFeature(DOMResult.FEATURE))
{
// Use javax.xml.parsers to create our DOMs.
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
dfactory.setNamespaceAware(true); // do this always for XSLT
DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
// Create the Templates from a DOM.
Node xslDOM = docBuilder.parse(xslID);
DOMSource dsource = new DOMSource(xslDOM, xslID);
Templates templates = tfactory.newTemplates(dsource);
// Create the source tree in the form of a DOM.
Node sourceNode = docBuilder.parse(sourceID);
// Create a DOMResult that the transformation will fill in.
DOMResult dresult = new DOMResult();
// And transform from the source DOM tree to a result DOM tree.
Transformer transformer = templates.newTransformer();
transformer.transform(new DOMSource(sourceNode, sourceID), dresult);
// The root of the result tree may now be obtained from
// the DOMResult object.
Node out = dresult.getNode();
// Serialize it to System.out for diagnostics.
Transformer serializer = tfactory.newTransformer();
serializer.transform(new DOMSource(out), new StreamResult(System.out));
}
platinum 2002-12-29
  • 打赏
  • 举报
回复
XML 的 ML 两个字母是 Markup Language,标识语言何谈程序?单独的 XML 没有任何用处,只有配合其他前后台语言才能体现其巨大的优势
孟子E章 2002-12-29
  • 打赏
  • 举报
回复
<?xml version="1.0"?>
<a/>
ilian 2002-12-29
  • 打赏
  • 举报
回复
一个完整而简单的例子!!!
单单XML标记算全部过程吗?
binxiao 2002-12-29
  • 打赏
  • 举报
回复
用什么語言和xml的例子
zhigangxie 2002-12-29
  • 打赏
  • 举报
回复
可能是说XML COMPONENT吧?

8,909

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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