Message from discussion
Append Error
Received: by 10.66.73.7 with SMTP id h7mr3102320pav.6.1350352845190;
Mon, 15 Oct 2012 19:00:45 -0700 (PDT)
Received: by 10.52.156.115 with SMTP id wd19mr2101336vdb.2.1350352845116; Mon,
15 Oct 2012 19:00:45 -0700 (PDT)
Path: jt13ni12003pbb.1!nntp.google.com!kt20no36769768pbb.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: microsoft.public.xml
Date: Mon, 15 Oct 2012 19:00:44 -0700 (PDT)
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=75.67.248.7; posting-account=Fc3NOwoAAADLF324YJj29q5HM0boXvkz
NNTP-Posting-Host: 75.67.248.7
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ea594d56-2134-4ae5-aaee-a1ed42530a39@googlegroups.com>
Subject: Append Error
From: sumiku...@gmail.com
Injection-Date: Tue, 16 Oct 2012 02:00:45 +0000
Content-Type: text/plain; charset=ISO-8859-1
Hello -
I have the following code and it works locally but when I publish it on the server it won't allow me to add new records. Is there anything I'm missing here. I just need to add more records to the XML file.
Dim strnum = GetRandom(0, 99999)
Dim xmlfile As New ConfigXmlDocument
xmlfile.Load(Server.MapPath("~\xmldata\survey.xml"))
Dim theSurveyTag As XmlElement = xmlfile.CreateElement("Survey")
Dim theTitleTag As XmlElement = xmlfile.CreateElement("Survey_Title")
Dim theLinkTag As XmlElement = xmlfile.CreateElement("Survey_Link")
Dim thePassTag As XmlElement = xmlfile.CreateElement("Survey_Pass")
Dim theNameText As XmlText = xmlfile.CreateTextNode(t1.Text)
Dim theEmailText As XmlText = xmlfile.CreateTextNode(t2.Text)
Dim theTelText As XmlText = xmlfile.CreateTextNode(t3.Text)
theTitleTag.AppendChild(theNameText)
theLinkTag.AppendChild(theEmailText)
thePassTag.AppendChild(theTelText)
theSurveyTag.SetAttribute("ID", strnum)
theSurveyTag.AppendChild(theTitleTag)
theSurveyTag.AppendChild(theLinkTag)
theSurveyTag.AppendChild(thePassTag)
xmlfile.DocumentElement.AppendChild(theSurveyTag)
xmlfile.Save(Server.MapPath("~\xmldata\survey.xml"))
Here is the existing XML output:
<?xml version="1.0" encoding="utf-8"?>
<Data>
<Survey ID="24949">
<Survey_Title>TEST</Survey_Title>
<Survey_Link>http://www.yahoo.com</Survey_Link>
<Survey_Pass>23</Survey_Pass>
</Survey>
<Survey ID="70480">
<Survey_Title>TEST</Survey_Title>
<Survey_Link>http://www.google.com</Survey_Link>
<Survey_Pass>35</Survey_Pass>
</Survey>
<Survey ID="60566">
<Survey_Title>TEST</Survey_Title>
<Survey_Link>http://www.google.com</Survey_Link>
<Survey_Pass>67</Survey_Pass>
</Survey>
</Data>