473,503 Members | 1,629 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Local xml resource problem with XmlDocument.Load()

1 New Member
Platform: Windows XP Pro
IDE: Visual Studio 2005
Language: C# (.NET 2.0.505727)

Symptom: In debug, my page can load the xml from an external website

into an XmlDocument object. When I try to load xml from the local file,

I get no exceptions, but the XmlDocument object is empty. The xml file

is in the same folder as the aspx page with the code snippet. I'm not

sure why it's not able to load local resources. Might it have something

to do with the local webserver that VS2005 uses to debug pages? Help!!!



Here's the code:

Expand|Select|Wrap|Line Numbers
  1. protected void Page_Load( object sender, EventArgs e )
  2. {
  3.     XmlDocument feed = new XmlDocument();
  4.     try
  5.     {
  6.         string feedUrl = Page.ResolveUrl( @"~/debug/test.xml" );
  7.         feed.Load( feedUrl );
  8.     }
  9.     catch( WebException feedException )
  10.     {
  11.         int i = 0;
  12.     }
  13.     catch( Exception feedException )
  14.     {
  15.         int i = 0;
  16.     }
  17.  
  18.     return;
  19. }
  20.  
Here's the contents of the xml file (named test.xml):

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <rss version="2.0">
  3.   <channel>
  4.     <title>Sample Channel</title>
  5.     <link>~/scenario5.aspx</link>
  6.     <description>Channel For Scenario5 in ASP.NET RSS Toolkit 
  7.  
  8. samples.</description>
  9.     <ttl>10</ttl>
  10.     <name></name>
  11.     <user></user>
  12.     <item>
  13.       <title>Title1</title>
  14.       <description>Description1</description>
  15.       <link>www.fark.com</link>
  16.     </item>
  17.     <item>
  18.       <title>Title2</title>
  19.       <description>Description2</description>
  20.       <link>www.cnn.com</link>
  21.     </item>
  22.   </channel>
  23. </rss>
  24.  

- O8
Sep 20 '07 #1
0 1208

Sign in to post your reply or Sign up for a free account.

Similar topics

2
8697
by: Ayende Rahien | last post by:
Serious problem I'm using Chris Lovett's SgmlReader class SgmlReader sr = new SgmlReader(); XmlDocument xdoc = new XmlDocument(); sr.DocType = "HTML"; sr.InputStream = new...
6
3375
by: Robert Reineri | last post by:
Hello, New to the XML world and .NET. I have what I believe to be a simple problem, but I have read the .NET docs till I'm blue in the face and still can't locate a simple example of how to...
2
6010
by: Graham Pengelly | last post by:
Hi I am trying to transform on System.Xml.XmlDocument into another using XslTransform without writing the object out to a file. I am guessing it should work something like this... public...
2
12049
by: Jani Mantytorma | last post by:
I have embedded resource called Settings.xml. I'm able to read the resource but how can I write data to the resource. The code for read operation follows: private XmlDocument m_doc = new...
2
1752
by: Arjen | last post by:
Hello, I have 2 resource files. The resource files have both inside the name field values. I want to select from the first resource file the records where the name field haves a value between 1...
7
19213
by: Christofer Dutz | last post by:
Hi, I am trying to read a XML-File which I marked as embedded resource from within the code of my DLL. Unfortunately it doesn't work. On my search for the error I inserted some code for...
3
2783
by: Grandpa Pete | last post by:
How can I share resources across all users of a web service for read/write access. *Situation* *one*: I want to have an in memory counter that all users of the webservice could access. Call...
1
2132
by: Lore Leunoeg | last post by:
Hello I want to load a local file into the XmlDocument cache. But when I'm not connected to the internet I get this exeption: "The underlying connection was closed: The remote name could not be...
2
2266
by: Nesster13 | last post by:
Hi, I am building an application that will utilize the local resource file. Right now the application is separated into two part, the header and the content. One of the line at the top of the...
0
7070
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5566
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4993
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
372
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.