XML file source code viewer (5)

zhaozj2021-02-16  39

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.:) "

Else

Domxmldata.Load (StrfilePath)

IF (Domxmldata.Parseerror.Errorcode <> 0) THEN

Strresult = "

invalid XML file: "& domxmldata.parseerror.reason &" "

Else

'Removing different types of child nodes, plus highlights ( )

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 & "
"

Case 7: 'instruction node, call subunies

Strnodes = strnodes & renderinstruction (nodnode, intledel)

Case 8: 'Note node, call the sub-node

Strnodes = strnodes & rendercomment (nodnode, intledel)

转载请注明原文地址:https://www.9cbs.com/read-25758.html

New Post(0)