<%Class clsMenuInfo Public menuName ' 메뉴명 Public menuLink ' 메뉴 링크 Public menuStep ' 메뉴 단계End ClassDim XMLDOM, Rootnode, Currentnode, xml_filename, i,j,k, nCountdim lowtree ' 하위 노드 여부dim c_lowtree ' 하위 하위 노드 여부nCount = 0xml_filename = Request.ServerVariables("APPL_PHYSICAL_PATH")& "tree.xml"Set XMLDOM = Server.CreateObject("Microsoft.XMLDOM")XMLDOM.load xml_filename'--------------------------------------------------' 1 depth'--------------------------------------------------Set Rootnode = XMLDOM.DocumentElementFor i = 0 to Rootnode.Childnodes.length - 1 lowtree = Rootnode.Childnodes(i).Attributes(1).Text if lowtree = "true" then ReDim Preserve menuInfo(nCount + 1) Set menuInfo(nCount) = New clsMenuInfo menuInfo(nCount).menuName = Rootnode.Childnodes(i).Attributes(0).Text menuInfo(nCount).menuLink = "" menuInfo(nCount).menuStep = "1" nCount = nCount + 1 '-------------------------------------------------- ' 2 depth '-------------------------------------------------- Set Childnode = Rootnode.Childnodes(i) For j = 0 to Childnode.Childnodes.length - 1 c_lowtree = Childnode.Childnodes(j).Attributes(1).Text if c_lowtree = "true" then ReDim Preserve menuInfo(nCount + 1) Set menuInfo(nCount) = New clsMenuInfo menuInfo(nCount).menuName = Childnode.Childnodes(j).Attributes(0).Text menuInfo(nCount).menuLink = "" menuInfo(nCount).menuStep = "2" nCount = nCount + 1 '-------------------------------------------------- ' 3 depth '-------------------------------------------------- Set ChildChildnode = Childnode.Childnodes(j) For k = 0 to ChildChildnode.Childnodes.length - 1 ReDim Preserve menuInfo(nCount + 1) Set menuInfo(nCount) = New clsMenuInfo menuInfo(nCount).menuName = ChildChildnode.Childnodes(k).Attributes(0).Text menuInfo(nCount).menuLink = ChildChildnode.Childnodes(k).Attributes(2).Text menuInfo(nCount).menuStep = "3" nCount = nCount + 1 next else ReDim Preserve menuInfo(nCount + 1) Set menuInfo(nCount) = New clsMenuInfo menuInfo(nCount).menuName = Childnode.Childnodes(j).Attributes(0).Text menuInfo(nCount).menuLink = Childnode.Childnodes(j).Attributes(2).Text menuInfo(nCount).menuStep = "2" nCount = nCount + 1 end if next else ReDim Preserve menuInfo(nCount + 1) Set menuInfo(nCount) = New clsMenuInfo menuInfo(nCount).menuName = Rootnode.Childnodes(i).Attributes(0).Text menuInfo(nCount).menuLink = Rootnode.Childnodes(i).Attributes(2).Text menuInfo(nCount).menuStep = "1" nCount = nCount + 1 end ifNextfor i = 0 to UBound(menuInfo) - 1 strMenuName = menuInfo(i).menuName strMenuLink = menuInfo(i).menuLink strMenuStep = menuInfo(i).menuStep for j = 2 to strMenuStep strOut = strOut & " " next strOut = strOut & "" strOut = strOut & "" & strMenuName & "" & vbCrLf nextResponse.Write strOutSet Rootnode = nothingSet Childnode = nothingSet ChildChildnode = nothingSet XMLDOM = nothing%>
출처: http://www.mungchung.com