Information Tree and XML file traversal and XML file application

Source: Internet
Author: User

Function save ()
{
// Save the group not starting with http in the infomationtree to the local device, and then upload the group from the local device to the server.
VaR iinformationtree = document.parent?w.frameelement.doc ument. Frames ["frame0"]. Te. Interface ("iinformationtree5 ");
VaR siblingitemid;
VaR tempgroupname;
Siblingitemid = iinformationtree. getnextitem (0, 11 );
While (siblingitemid! = 0)
{
If (iinformationtree. isgroup (siblingitemid ))
{
Tempgroupname = iinformationtree. getitemname (siblingitemid );
If (tempgroupname. substr (0, 3 )! = "HTTP ")
{
Iinformationtree. saveflylayer ("tempgroupname", siblingitemid );
Uploadservice (tempgroupname );
}
}
Siblingitemid = iinformationtree. getnextitem (siblingitemid, 13 );
}
}

// Upload to the server
Function uploadservice (filename)
{
VaR uploadctrl;
Uploadctrl = new activexobject ("sdpfileupdownload. fileupdownloadclient ");
Uploadctrl. callagent = new activexobject ("sdpcallagent. scktcallagent ");
Uploadctrl. callagent. Host = "10.72.1.135 ";
Uploadctrl. callagent. Port = 223;
Uploadctrl. uploadfile ('% USERPROFILE % \' + 'application data \ skyline \ terraexplorer \ filename ');
// Actual storage path c: \ Documents and Settings \ Administrator \ Application Data \ skyline \ terraexplorer \ sadfl. Fly
}

Function callappbyparam (PARAM)
{
Appparam = parseint (Param [function]);
// Call callfunction Based on the parameter content
Callfunction (appparam );
}

Function createappparam (xmlurl, name)
{
// Read parameters from XML and generate an array.
VaR tmattributes = new object ();
// Var xmldoc = new activexobject ("msxml2.domdocument ");
VaR xmldoc = new activexobject ("Microsoft. xmldom ");
Xmldoc. async = false;
Xmldoc. resolveexternals = false;
Xmldoc. loadxml (xmlurl );
VaR savexmlarray = new array ();
VaR featureclassarray = new array ();
VaR stylearray = new array ();
Savexmlarray [imag] = xmldoc. childnodes [0]. childnodes [0]. text;
Savexmlarray [label] = xmldoc. childnodes [0]. childnodes [1]. text;
Savexmlarray [hint] = xmldoc. childnodes [0]. childnodes [2]. text;
Savexmlarray [function] = xmldoc. childnodes [0]. childnodes [3]. text;
Savexmlarray [layer] = xmldoc. childnodes [0]. childnodes [4]. text;
VaR featurenodescount = xmldoc. childnodes [0]. childnodes [5]. childnodes. length;
For (VAR p = 0; P <featurenodescount; P ++)
{
Featureclassarray [p, 0] = xmldoc. childnodes [0]. childnodes [5]. childnodes [0]. Name;
Featureclassarray [P, 1] = xmldoc. childnodes [0]. childnodes [5]. childnodes [0]. text;
}
Savexmlarray [featureclassname] = featureclassarray;
VaR stylechildcount = xmldoc. childnodes [0]. childnodes [6]. childnodes. length;
For (VAR q = 0; q <stylechildcount; q ++)
{
Switch (q)
{
Case color:
Stylearray [color] = xmldoc. childnodes [0]. childnodes [6]. childnodes [Q]. text;
Break;
Case Font:
Stylearray [font] = xmldoc. childnodes [0]. childnodes [6]. childnodes [Q]. text;
Break;
Case fillcolor:
Stylearray [fillcolor] = xmldoc. childnodes [0]. childnodes [6]. childnodes [Q]. text;
Break;
Case transparent:
Stylearray [transparent] = xmldoc. childnodes [0]. childnodes [6]. childnodes [Q]. text;
Break;
Case symble:
Stylearray [symble] = xmldoc. childnodes [0]. childnodes [6]. childnodes [Q]. text;
Break;
}
}
Savexmlarray [style] = stylearray;
Return savexmlarray;
}

Protected void page_load (Object sender, eventargs E)
{
String xmlpath = request. querystring ["xmlname"]. tostring ();
Createpage (xmlpath );
}

Public void createpage (string xmlname)
{
Table tab = new table ();
Xmltextreader curxml = new xmltextreader (xmlname );
Curxml. whitespacehandling = whitespacehandling. None;
Xmldocument xmldoc = new xmldocument ();
Xmldoc. Load (curxml );
Curxml. Close ();
Xmlnode nodes = xmldoc. documentelement;
For (INT I = 0; I <nodes. childnodes. Count; I ++)
{
Tablerow TR = new tablerow ();
Tablecell Tc = new tablecell ();
Tab. Controls. Add (TR );
Tr. Controls. Add (TC );
Xmlnode cnodes = nodes. childnodes [I];
Imagebutton IMG = new imagebutton ();
IMG. ID = "BTN" + I. tostring ();
IMG. imageurl = cnodes. childnodes [0]. innertext;
IMG. tooltip = cnodes. childnodes [2]. innertext;
IMG. attributes ["xmlvalue"] = cnodes. outerxml;
IMG. attributes ["xmlname"] = cnodes. Name;
IMG. Attributes. Add ("onclick", "javascript: var Params = createappparam (this. xmlvalue, this. xmlname); callappbyparam (Params); Return false ;");
TC. Controls. Add (IMG );
TC = new tablecell ();
TC. Font. size = int. parse (cnodes. childnodes [6]. childnodes [1]. innertext );
Tr. Controls. Add (TC );
Label LBL = new label ();
LBL. ID = "label" + I. tostring ();
LBL. Text = "" + cnodes. childnodes [1]. innertext;
TC. Controls. Add (LBL );
}
Form1.controls. Add (Tab );
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.