Exemplo n.º 1
0
        protected void btn_transform_Click(object sender, EventArgs e)
        {
            lblHtml.Text = "";
            try
            {
                XMLServices.Service1Client xmlPxy = new XMLServices.Service1Client();
                string xml  = txtXMLUrl.Text.ToString();
                string xsl  = txtXslUrl.Text.ToString();
                Byte[] b    = xmlPxy.transformation(xml, xsl);
                string path = AppDomain.CurrentDomain.BaseDirectory;
                path += "Persons.html";
                File.WriteAllBytes(path, b);
                lblHtml.Text += System.Text.Encoding.Default.GetString(b);

                lblHtml.Text += "<br/> Path: " + path;
            }

            catch (Exception em)
            {
                lblHtml.Text = em.Message.ToString();
            }
        }
 protected void btn_search_Click(object sender, EventArgs e)
 {
     lblResult.Text = "";
     XMLServices.Service1Client xmlPxy = new XMLServices.Service1Client();
     try
     {
         string[] result = xmlPxy.XPathSearch(txtXMLUrl.Text, txtPath.Text);
         if (result.Length == 0)
         {
             lblResult.Text = "No results found, check path";
         }
         for (int i = 0; i < result.Length; i++)
         {
             string encodedXml = String.Format("<pre>{0}</pre>", HttpUtility.HtmlEncode(result[i]));
             lblResult.Text += encodedXml + "<br/>";
         }
     }
     catch (Exception em)
     {
         lblResult.Text = em.Message.ToString();
     }
 }