请教关于xml的问题(急)

idiudiu 2004-10-18 09:07:54
xml数据转html的解决方案,望提供!最好给出示例,谢谢!
...全文
62 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
DeltaCat 2004-10-18
  • 打赏
  • 举报
回复
用 XSL

xmldom.transformNode(xsldom) 输出就是HTML内容了
zyzhou 2004-10-18
  • 打赏
  • 举报
回复
<%

Dim objDom
Dim objRoot
Dim objChild1
Dim objChild2
Dim objPI

" XMLDOM 对象使用Server对象的CreateObject方法创建
Set objDom = Server.CreateObject("Microsoft.XMLDOM")
"使用XMLDOM的createElemnet方法创建一个IXMLDOMElement对象。
"createElemnet方法又一个string参数,这个string 表示该element的名称。
返回值被传递到objRoot变量。objRoot表示XML文档的根元素.。

Set objRoot = objDom.createElement("rootElement")

"Use the appendChild Method of the XMLDOM Object to add the objRoot
"Element Reference to the XML Document.

objDom.appendChild objRoot

"Now, following the same steps, you will create references to the
"child elements for the XML Document. The only difference is, when the
"child elements are appended to the document, you will call the
"appendChild Method of the IXMLDOMElement Object rather than the
"appendChild Method of the XMLDOM Object. By using the IXMLDOMElement
"to append the children, you are differentiating (and applying tiered
"structure to) the child elements from the root element.

Set objChild1 = objDom.createElement("childElement1")
objRoot.appendChild objChild1
Set objChild1 = objDom.createElement("childElement2")
objRoot.appendChild objChild2

"The final step to take care of before saving this document is to add
"an XML processing instruction. This is necessary so that XML parsers
"will recognize this document as an XML document.

Set objPI = objDom.createProcessingInstruction("xml","vertsion="1.0"")

"Call the insertBefore Method of the XMLDOM Object in order to insert
"the processing instruction before the root element (the zero element
"in the XMLDOM childNodes Collection).

objDom.insertBefore objPI, objDom.childNodes(0)

"Calling the Save Method of the XMLDOM Object will save this XML
"document to your disk drive. In this case, the document will be saved
"to the "c:" drive and will be named "MyXMLDoc.xml". When saving an
"XML document, if the file does not exist, it will be created. If it
"does exist, it will be overwritten.

objDom.Save "c:MyXMLDoc.xml"

%>

文档被存档之后,如果你再打开这个文档,那么则会以如下代码列表形式出现:

MyXMLDoc.xml:

<?xml version="1.0"?>
<rootElement>
<childElement1 />
<childElement2 />
</rootElement>

8,906

社区成员

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

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