Insert data on xml file on web

  • Thread starter Thread starter monzer ahmed
  • Start date Start date
M

monzer ahmed

Guest
I'm trying to insert data between specific tag inside my xml file , The code works well on my computer but when I run it on the web it Does not insert the data between the specific tag like that : this is my xml file :

<?xml version='1.0' encoding='utf-8'?>
<rss version='2.0' xmlns:media='http://search.yahoo.com/mrss/'>
<channel>

</channel>
</rss>

I want to insert data inside "channel" tag . this is my code it's working fine ! :

FilePath = "h:\root\home\karary-001\www\site1\xmlfile1.xml" **//this is path to my xml file on website**
Dim document As New XDocument
document = XDocument.Load(FilePath)
Dim root = New XElement("item")
Dim title = New XElement("title", New XCData(TextBox3.Text))
Dim link = New XElement("link", TextBox6.Text)
root.Add(title, link)
document.Root.Elements.First().Add(root)
document.Save(FilePath)
Label1.Text = "! done"

when I change FilePath ="C:\Users\MONZER\Downloads\XMLFile1.xml" : I get this :

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<item>
<title><![CDATA[ title]]></title>
<link>صفحة دخول المسؤول</link>
<pubDate>2018/08/06 06:20</pubDate>
<description><![CDATA[fsdsdsdsgntbx cfv]]></description>
<media.thumbnail url="http://karary-001-site1.htempurl.com/images/" height="266" width="127" />
</item>
</channel>
</rss>

but when I use FilePath ="h:\root\home\karary-001\www\site1\xmlfile1.xml" : I get this :

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
<channel></channel>
<item>
<title><![CDATA[ title]]></title>
<link>صفحة دخول المسؤول</link>
<pubDate>2018/08/06 06:20</pubDate>
<description><![CDATA[fsdsdsdsgntbx cfv]]></description>
<media.thumbnail url="http://karary-001-site1.htempurl.com/images/" height="266" width="127" />
</item>
</rss>

Continue reading...
 
Back
Top