473,382 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

XmlDocument.Load() and relative URL

Hi all

I'm creating an XmlDocument object and then i need to load its xml
content from an url which returns an xml stream
My problem is that i cannot use absolute URL but *relative* URL
i.e.
oXmlDoc.Load("../xml/genxml.aspx");

I know that
oXmlDoc.Load(http://xx.xx.xx.xx/site/xml/genxml.aspx);
and oXmlDoc.Load(this.Page.Server.MapPath("myfile.xml" ));
are working

But how can specify that the string parameter is a relative url and not
a full path ?

Thanks in advance

Elian Chrebor
--
// myLittleTools.net : leading provider of web-based applications.
// myLittleAdmin : online MS SQL manager
// http://www.mylittletools.net
// we*******@mylittletools.net
Nov 12 '05 #1
2 9312


el.c. - myLittleTools.net wrote:

I'm creating an XmlDocument object and then i need to load its xml
content from an url which returns an xml stream
My problem is that i cannot use absolute URL but *relative* URL
i.e.
oXmlDoc.Load("../xml/genxml.aspx");


A relative URI needs a base URI to resolve it so perhaps within ASP.NET
oXmlDoc.Load(new Uri(Request.Url, "../xml/genxml.aspx").ToString())
works for you.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 12 '05 #2
Martin Honnen wrote:
el.c. - myLittleTools.net wrote:
I'm creating an XmlDocument object and then i need to load its xml
content from an url which returns an xml stream
My problem is that i cannot use absolute URL but *relative* URL
i.e.
oXmlDoc.Load("../xml/genxml.aspx");


A relative URI needs a base URI to resolve it so perhaps within
ASP.NET oXmlDoc.Load(new Uri(Request.Url,
"../xml/genxml.aspx").ToString()) works for you.


That perfectly works !
Thanks a lot for this prompt help !

best regards
elian chrebor
--
// myLittleTools.net : web-based applications for ASP developers
// myLittleAdmin v2.7 released !!
// More info on http://www.myLittleTools.net/
// we*******@mylittletools.net
Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
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...
5
by: KathyB | last post by:
If someone could just explain this to me...I just don't get it! I have an aspx page where I retrieve several session variables and use xmlDocument to transform xml file with xsl file into an...
2
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...
1
by: Peter Nofelt | last post by:
Hey All, I'm running into this issue with parsing through an xml document by tag name. Below is an example xml document: File Name: things.xml <things> <people> <name>Peter</name>
5
by: Rob Panosh | last post by:
Hello, I am trying to create a xmlDocument from as dataset. My code is listed below. All seems to go well until xmlDocument.Load(CType(ms, System.IO.Stream)) ... I keep getting the following...
7
by: emma_middlebrook | last post by:
Hi In one of our test suites we load an xml document (it's actually .svg). I'm trying to find some way of stopping the eventual call to HttpWebRequest.GetResponse which I presume it's doing when...
1
by: Gustaf | last post by:
I have a class that contains a certain kind of XML document. The input file is *not* an XmlDocument, but when loaded, I want it to work like the XmlDocument class, like: MyDocument doc = new...
4
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... We've got a lot of places in our code where we read relatively small xml user preference blocks. Currently that's creating a new XmlDocument in every spot. I was thinking we might see...
1
by: fengtso | last post by:
I've try to use the following command to load xml file. It works for Windows Application but doesn't work for Device Application. Please take a look the code and error message.Thanks a lot. doc...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.