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

ilian 2002-12-28 11:54:25
IE能通过!
...全文
8 点赞 收藏 6
写回复
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吧?
回复
发动态
发帖子
XML/XSL
创建于2007-09-28

8779

社区成员

XML/XSL相关问题讨论专区
申请成为版主
社区公告
暂无公告