XML file source code viewer (six)

zhaozj2021-02-16  45

Case 9: 'Document Node - "Root" node. No need to display, just display sub-nodes

'Traversing the child's child's node is to write:), SO Easy

Intcount = nodnode.childnodes.length

IF Intcount> 0 THEN

For intNode = 0 to intcount-1

Strnodes = strnodes & renderchildNodes (Nodnode.childNodes (intNode), Intlevel 1)

NEXT

END IF

Case Else: 'Native Node

Strnodes = strnodes & getindent (intLevel) & " & lt "'blue <

Strnodes = strnodes & " "& nodnode.nodename &" "'Brown Node Name

'Display properties

Set nodattriist = nodnode.attributes' Get the property node set (Collection - one of my favorite data types)

INTCOUNT = NODATTRLIST.LENGTH 'Collection Length, convenient? :)

IF Intcount> 0 THEN

For intatTR = 0 to intcount-1

'Red attribute name, blue quotation mark

Strnodes = strnodes & ""> nodattrlist (intattr) .NodeName = " < "& nodattrlist INTATTR) .NodeValue & " "" "

NEXT

END IF

'Handling child nodes of current nodes

Intcount = nodnode.childnodes.length

IF Intcount> 0 Then 'If there is a child node

Strnodes = strnodes & " & gt
"" 'attribute is displayed, ">" closed TAG first

'Recursive renderchildNodes for each child node

For intNode = 0 to intcount-1

Strnodes = strnodes & renderchildNodes (Nodnode.childNodes (intNode), Intlevel 1)

NEXT

'Display Close Tag

Strnodes = strnodes & getindent (intlevel) & " & lt / nodnode.nodeename & " & gt
" ELSE

Strnodes = strnodes & " / & gt
"No child node, display" /> "

END IF

End SELECT

RenderChildNodes = strnodes

END FUNCTION

'Coloring the comment node

Function rendercomment (nodnode, intledel)

DIM STRNODES, INTCOUNT, INTNODE

Strnodes = ""

INTCOUNT = 0

INTNODE = 0

Dim nodattrlist

Strnodes = strnodes & getindent (intLevel) & " & lt! - "

Strnodes = strnodes & nodnode.nodevalue

Strnodes = Strnodes & "- & gt

Rendercomment = Strnodes

END FUNCTION

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

New Post(0)