Third, ASP version source code
<%
DIM STRF
STRF = Request ("file")
DIM Strresult
StrfilePath = Server.mAppath (STRF)
'Dim Domxmldata as new msxml2.freethreadedDomDocument
DIM DOMXMLDATA
SET DOMXMLDATA = Server.createObject ("Microsoft.xmLDom") 'as new msxml2.domdocument
If strfilepath = "" ""
TXTDATA.INNERHTML = STRFILEPATH
Please browse the XML file you want to see.:) b> font> p>"
Else
Domxmldata.Load (StrfilePath)
IF (Domxmldata.Parseerror.Errorcode <> 0) THEN
Strresult = "
invalid XML file: font> "& domxmldata.parseerror.reason &" p> "
Else
'Removing different types of child nodes, plus highlights ( font>)
Strresult = renderchildNodes (Domxmldata, 0)
END IF
END IF
'Function name: RenderChildNodes
'Parameters: nodnode - XML node
'Intlevel - number of layers for indentation
Function RenderChildNodes (NodNode, Intlease)
DIM STRNODES, INTCOUNT, INTNODE
Strnodes = "" 'Used to display the HTML string, the result of processing
INTCOUNT = 0 'Temporary variables in loop all over
INTNODE = 0 'Temporary variables
DIM NODATTRLIST 'attribute set
DIM INTNODETYPE
INTNODETYPE = NODNODE.NODETYPE
SELECT CASE INTNODETYPE
Case 3: 'text node, black bold display
Strnodes = Strnodes & GetInDent (intLevel) & "" & nodnode.text & " b>
"
Case 7: 'instruction node, call subunies
Strnodes = strnodes & renderinstruction (nodnode, intledel)
Case 8: 'Note node, call the sub-node
Strnodes = strnodes & rendercomment (nodnode, intledel)