⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xmldomwrite.aspx

📁 asp入门到精通的源代码
💻 ASPX
字号:
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Xml" %>

<script runat=server>
   sub Page_Load(obj as object, e as eventargs)
      dim xmldoc as new XMLDocument()
         
      try
         xmldoc.Load(Server.MapPath("books3.xml"))
         dim eleBook as XmlElement = xmldoc.CreateElement _
            ("book")
         dim attStyle as XmlAttribute = xmldoc.CreateAttribute _
            ("style")

         eleBook.SetAttributeNode(attStyle)
         eleBook.SetAttribute("style", "hardback")

         dim root as XmlElement = xmldoc.Item("bookstore")
         root.AppendChild(eleBook)
         
         xmldoc.Save(Server.MapPath("books3.xml"))

      catch ex as Exception
         strOutput = "Error accessing XML file"
      end try
      
      output.Text = "Append operation successful"
   end sub
</script>

<html><body>
   <asp:Label id="output" runat="server" />
</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -