Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            requestGetfilestore rgf = new requestGetfilestore();

            rgf.location   = filestorelocation.local;
            rgf.annotated  = true;
            rgf.layoutonly = false;
            request xmlr = new request();

            xmlr.domain = domain;
            xmlr.Item   = rgf;
            response xmlres;

            xmlres = bar.operation(xmlr);
            responseFilestore xmlres1;

            xmlres1 = (responseFilestore)xmlres.Item;



            textBox1.Text = xmlres1.ToString();
            textBox1.Text = xmlres1.Any[0].InnerXml.ToString();
            //treeView1.da
        }
Exemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            xmlmgmt             bar = new xmlmgmt();
            requestGetfilestore rgf = new requestGetfilestore();

            rgf.location   = filestorelocation.local;
            rgf.annotated  = true;
            rgf.layoutonly = false;
            request xmlr = new request();

            xmlr.domain = domain;
            xmlr.Item   = rgf;
            response xmlres;

            xmlres = bar.operation(xmlr);
            responseFilestore xmlres1;

            xmlres1 = (responseFilestore)xmlres.Item;

            // create a writer and open the file

            TextWriter tw    = new StreamWriter("datapower.xml");
            string     test  = xmlres1.Any.Length.ToString();
            int        test2 = Convert.ToInt32(test);

            tw.WriteLine("<foo>");
            for (int i = 0; i <= test2 - 1; i++)
            {
                // write a line of text to the file
                tw.WriteLine("<foo" + i + ">");
                tw.WriteLine(xmlres1.Any[i].InnerXml.ToString());
                //tw.WriteLine(xmlres.Item.);
                tw.WriteLine("</foo" + i + ">");
            }
            tw.WriteLine("</foo>");
            // close the stream
            tw.Close();



            XmlDocument xmldoc = new XmlDocument();

            //xmldoc.Load(DataPowerFileManager
            xmldoc.Load("datapower.xml");



            XslTransform myXslTrans = new XslTransform();
            //myXslTrans.Load("datapower.xslt");
            XmlTextReader xsltReader = new XmlTextReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("DataPowerFileManager.DataPower FileSystem Transformations.xslt"));
            XmlTextWriter myWriter   = new XmlTextWriter("result.xml", null);

            myXslTrans.Load(xsltReader, null, null);
            myXslTrans.Transform(xmldoc, null, myWriter);
            myWriter.Close();
            xmldoc.Load("result.xml");



            //string size = null;
            //string modified = null;
            //XmlNodeList list = null;
            //XmlNodeReader reader = null;

            //list = xmldoc.GetElementsByTagName("file");
            //foreach (XmlNode n in list)
            //{
            //    reader = new XmlNodeReader(n);
            //    reader.Read();
            //    string test = reader.GetAttribute("name");
            //    modified = n[modified].InnerText;
            //    size = n["size"].InnerText;  //do something with s
            //}



            //XmlNodeList xnode = xmldoc.SelectNodes(@" /foo/directory[1]/file[*]/@name");
            //XmlNode xnode = xmldoc.SelectNodes(@" /foo/directory[1]/file[*]/@name");

            //XmlNodeReader nr = new XmlNodeReader(xnode);

            DataSet ds = new DataSet();

            //ds.ReadXml(nr);

            //dataGridView1.DataSource = ds.Tables[0];
            //dataGridView1.Columns[0].Visible = false;



            System.IO.StringReader sr  = new System.IO.StringReader(xmldoc.InnerXml);
            XPathDocument          doc = new XPathDocument(sr);
            XPathNavigator         nav = doc.CreateNavigator();
            //XPathExpression expImgSize = nav.Compile(@" /foo/directory[*]/@name");
            XPathExpression   expImgSize    = nav.Compile(@" /foo/directory[1]/file[*]/@name");
            XPathNodeIterator iterImageSize = nav.Select(expImgSize);

            if (iterImageSize != null)
            {
                while (iterImageSize.MoveNext())
                {
                    string imageSize = iterImageSize.Current.Value;
                    words = imageSize.Split(delimiterChars);
                    //lvDataPower.Items.Add(words[0]);
                }
            }



            try
            {
                // SECTION 2. Initialize the TreeView control.
                treeView2.Nodes.Clear();
                treeView2.Nodes.Add(new TreeNode(xmldoc.DocumentElement.Name));
                TreeNode tNode = new TreeNode();
                tNode = treeView2.Nodes[0];

                // SECTION 3. Populate the TreeView with the DOM nodes.
                AddNode(xmldoc.DocumentElement, tNode);
                treeView2.ExpandAll();
            }
            catch (XmlException xmlEx)
            {
                MessageBox.Show(xmlEx.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }



            //textBox1.Text = xmlres1.ToString();
            //textBox1.Text = xmlres1.Any[0].InnerXml.ToString();
            //treeView1.da
        }
Exemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            xmlmgmt bar = new xmlmgmt();
            requestGetfilestore rgf = new requestGetfilestore();
            rgf.location = filestorelocation.local;
            rgf.annotated = true;
            rgf.layoutonly = false;
            request xmlr = new request();
            xmlr.domain = domain;
            xmlr.Item = rgf;
            response xmlres;
            xmlres = bar.operation(xmlr);
            responseFilestore xmlres1;
            xmlres1 = (responseFilestore) xmlres.Item;

            // create a writer and open the file

            TextWriter tw = new StreamWriter("datapower.xml");
            string test = xmlres1.Any.Length.ToString();
            int test2 = Convert.ToInt32(test);
            tw.WriteLine("<foo>");
            for (int i = 0; i <=test2  - 1; i++)
            {
                // write a line of text to the file
                tw.WriteLine("<foo"+i+">");
                tw.WriteLine(xmlres1.Any[i].InnerXml.ToString());
                //tw.WriteLine(xmlres.Item.);
                tw.WriteLine("</foo"+i+">");
            }
            tw.WriteLine("</foo>");
            // close the stream
            tw.Close();

            XmlDocument xmldoc = new XmlDocument();
            //xmldoc.Load(DataPowerFileManager
            xmldoc.Load("datapower.xml");

            XslTransform myXslTrans = new XslTransform() ;
            //myXslTrans.Load("datapower.xslt");
            XmlTextReader xsltReader = new XmlTextReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("DataPowerFileManager.DataPower FileSystem Transformations.xslt"));
            XmlTextWriter myWriter = new XmlTextWriter("result.xml", null);
            myXslTrans.Load(xsltReader, null, null);
            myXslTrans.Transform(xmldoc, null, myWriter);
            myWriter.Close();
            xmldoc.Load("result.xml");

            //string size = null;
            //string modified = null;
            //XmlNodeList list = null;
            //XmlNodeReader reader = null;

            //list = xmldoc.GetElementsByTagName("file");
            //foreach (XmlNode n in list)
            //{
            //    reader = new XmlNodeReader(n);
            //    reader.Read();
            //    string test = reader.GetAttribute("name");
            //    modified = n[modified].InnerText;
            //    size = n["size"].InnerText;  //do something with s
            //}

            //XmlNodeList xnode = xmldoc.SelectNodes(@" /foo/directory[1]/file[*]/@name");
            //XmlNode xnode = xmldoc.SelectNodes(@" /foo/directory[1]/file[*]/@name");

            //XmlNodeReader nr = new XmlNodeReader(xnode);

            DataSet ds = new DataSet();

            //ds.ReadXml(nr);

            //dataGridView1.DataSource = ds.Tables[0];
            //dataGridView1.Columns[0].Visible = false;

            System.IO.StringReader sr = new System.IO.StringReader(xmldoc.InnerXml);
            XPathDocument doc = new XPathDocument(sr);
            XPathNavigator nav = doc.CreateNavigator();
            //XPathExpression expImgSize = nav.Compile(@" /foo/directory[*]/@name");
            XPathExpression expImgSize = nav.Compile(@" /foo/directory[1]/file[*]/@name");
            XPathNodeIterator iterImageSize = nav.Select(expImgSize);
            if (iterImageSize != null)
            {
                while (iterImageSize.MoveNext())
                {
                    string imageSize = iterImageSize.Current.Value;
                    words = imageSize.Split(delimiterChars);
                    //lvDataPower.Items.Add(words[0]);

                }
            }

            try
            {

                // SECTION 2. Initialize the TreeView control.
                treeView2.Nodes.Clear();
                treeView2.Nodes.Add(new TreeNode(xmldoc.DocumentElement.Name));
                TreeNode tNode = new TreeNode();
                tNode = treeView2.Nodes[0];

                // SECTION 3. Populate the TreeView with the DOM nodes.
                AddNode(xmldoc.DocumentElement, tNode);
                treeView2.ExpandAll();
            }
            catch (XmlException xmlEx)
            {
                MessageBox.Show(xmlEx.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            //textBox1.Text = xmlres1.ToString();
            //textBox1.Text = xmlres1.Any[0].InnerXml.ToString();
            //treeView1.da
        }