如何在HTML中查找节点以添加从文本框中读取的文本? [英] How to find the nodes in HTML to add text read from textbox?

查看:57
本文介绍了如何在HTML中查找节点以添加从文本框中读取的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的winform应用程序中,我有一个基本的HTML模板,我需要添加存储在其他文件(header.html等)中的小HTML模板,如序列文本页脚

和内部这些小型HTMLS的内容想要添加从文本框中读取的文本。



如何继续,请指导。



我尝试过:



为标题,文本和页脚创建小htmls作为占位符

需要附加用户给出的数据

In my winform application I am having a basic HTML template and I need to add small HTML templates stored in other files(header.html etc) as per sequence like header text footer
and in inner content of these samll HTMLS want to add text read from textbox .

How to proceed on this , please guide.

What I have tried:

Create small htmls for header , text and footer as a place holder
need to append data as given by user

推荐答案

嗨使用CMS我们可以做到这一点



创建xml文件然后

hi by using CMS we can do that

create xml file then
<?xml version="1.0" encoding="utf-8"?>
<root>
  <section id="p0" name="Banner">
    <t>
      <h5>Email</h5>
      <a href="mailto:test@gmail.com">test@gmail.com</a>
    </t>

  </section>
</root>





然后在test.aspx页面





then in test.aspx page

<!DOCTYPE html>
<html dir="ltr" lang="en-US">
<head>
    <title>Test</title>
</head>
<body>
<form id="form1" runat="server">
<p id="text1" runat="server"></p>
</form>
</body>





然后在test.aspx.cs页面添加





then in test.aspx.cs page add

XmlDocument xdoc = new XmlDocument();
            xdoc.Load(Server.MapPath("xml/test.xml"));
            XmlNodeList NodeList = xdoc.SelectNodes("root/*");
            foreach (XmlNode Node in NodeList)
            {

                if (Node.Attributes[0].InnerText.ToLower().Equals("p0"))
                {
p1.innerthml=node.childnode[0].innertext;
}

then uneed to add ckeditor plugins
}



然后


then

  XmlDocument xdoc = new XmlDocument();
            xdoc.Load(Server.MapPath("xml/test.xml"));
            XmlNamespaceManager nsm = new XmlNamespaceManager(new NameTable());
            XmlNode root1 = xdoc.DocumentElement;
            XmlNodeList nodeList1 = xdoc.SelectNodes("root/*", nsm);
foreach (XmlNode node in nodeList1)
            {

                name = node.Attributes[0].InnerText;

                if (name.Equals(pageid))
                {
                    XmlNodeList nodelist2 = node.ChildNodes;
                    foreach (XmlNode node1 in nodelist2)
                    {
                        if (node1.Name.Equals("t"))
                        {

                           //FreeTextBox f = (FreeTextBox)FindControl("txt" + i);
                            CKEditorControl f = (CKEditorControl)FindControl("txt" + i);




void sample()
 {
     try
     {
         string xmlfile = "";
         string xmlfilePath = "";
         string prexmlfile = Server.MapPath("xml/test2.xml");
         XmlDocument xdoc7 = new XmlDocument();
         XmlDocument xdoc8 = new XmlDocument();

         if (xmlfile.Trim().Length <= 0)
         {
             xmlfile = Server.MapPath("xml/test.xml");
         }

         string xmlContent = "";
         if (!File.Exists(prexmlfile.Trim()))
         {
             StreamWriter sw = new StreamWriter(prexmlfile.Trim(), false, System.Text.Encoding.Default);

             xdoc7.Load(xmlfilePath.Trim());
             xmlContent = xdoc7.InnerXml;

             sw.Write(xmlContent.Trim());
             sw.Close();
         }
         else
         {
             xdoc7.Load(xmlfile.Trim());
             xmlContent = xdoc7.InnerXml;
             xdoc8.Load(prexmlfile.Trim());
             xdoc8.InnerXml = xmlContent;
             xdoc7.Save(xmlfile.Trim());
             xdoc8.Save(prexmlfile.Trim());
         }
     }

     catch { }
 }


这篇关于如何在HTML中查找节点以添加从文本框中读取的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆