XML에 removechild() 또는 replacechild() 함수가있는 단추를 추가하는 방법을 알고 싶습니다. 1 주일 동안 이걸 찾고 있었어.removechild() 함수가있는 ASP.NET VB 추가 단추
의견을 보내 주시면 대단히 감사하겠습니다. 감사합니다 :)이
내 xml 파일의 내용
<?xml version="1.0" encoding="utf-8"?>
<theNews>
<news>
<contents>News3 Contents</contents>
<title>News3 Title</title>
<pubDate>February 13, 2012</pubDate>
</news>
<news>
<contents>News2 Contents</contents>
<title>News2 Title</title>
<pubDate>February 1, 2012</pubDate>
</news>
<news>
<contents>News1 Contents</contents>
<title>News1 Title</title>
<pubDate>January 22, 2012</pubDate>
</news>
</theNews>
이 내 뉴스 업데이
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="NewsUpdater.aspx.vb" Inherits="NewsUpdater" %>
<%-- Add content controls here --%><asp:Content ID="Content1" runat="server"
contentplaceholderid="ContentPlaceHolder1">
<p>
</p>
<table align="center" style="width: 63%">
<tr>
<td align=center>
<div>
<h3>News Title</h3>
<asp:TextBox runat="server" ID="txtTitle" Width="308px"></asp:TextBox>
<br />
<h3>News Content</h3>
<asp:TextBox runat="server" ID="txtContents" TextMode="MultiLine" Height="119px" Width="513px"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Update News" />
</div></td>
</tr>
</table>
<p>
<br />
</p>
코드입니다 그리고 이것은 NewsUpdater 버튼 뒤에있는 코드
Partial Class NewsUpdater
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim xmlFile As New System.Xml.XmlDocument()
xmlFile.Load("D:\My Documents\PresentableII\NewsContent.xml")
Dim theNewsTag As System.Xml.XmlElement = xmlFile.CreateElement("news")
Dim theTitleTag As System.Xml.XmlElement = xmlFile.CreateElement("title")
Dim theContentsTag As System.Xml.XmlElement = xmlFile.CreateElement("contents")
Dim theTitleText As System.Xml.XmlText = xmlFile.CreateTextNode(txtTitle.Text)
Dim theContentsText As System.Xml.XmlText = xmlFile.CreateTextNode(txtContents.Text)
theTitleTag.PrependChild(theTitleText)
theContentsTag.PrependChild(theContentsText)
theNewsTag.PrependChild(theTitleTag)
theNewsTag.PrependChild(theContentsTag)
xmlFile.DocumentElement.PrependChild(theNewsTag)
xmlFile.Save("D:\My Documents\PresentableII\NewsContent.xml")
Response.Redirect("NewsFrame.aspx")
End Sub
마지막/최신 항목을 XML에 제거하거나 바꾸는 기능이있는 다른 버튼을 추가하고 싶습니다.
XML 서버 측 또는 클라이언트 측은 어디에 있습니까? 클라이언트 측, jQuery를 사용하고 있다면 괜찮습니까? – CompanyDroneFromSector7G
나는 내 게시물을 이미 업데이트했습니다. 그것을 확인하시기 바랍니다. 나는 서버쪽에있다 –
고마워. "마지막/최신 항목"은 어떻게 정의합니까? 예 : 루트 노드의 마지막 자식입니까? – CompanyDroneFromSector7G