473,699 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XmlDocument.Loa d() 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(th is.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.n et : leading provider of web-based applications.
// myLittleAdmin : online MS SQL manager
// http://www.mylittletools.net
// we*******@mylit tletools.net
Nov 12 '05 #1
2 9327


el.c. - myLittleTools.n et 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(ne w Uri(Request.Url , "../xml/genxml.aspx").T oString())
works for you.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 12 '05 #2
Martin Honnen wrote:
el.c. - myLittleTools.n et 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(ne w Uri(Request.Url ,
"../xml/genxml.aspx").T oString()) works for you.


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

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

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

Similar topics

2
8713
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 System.IO.StringReader(node.InnerText); xdoc.Load(sr);
5
3606
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 instruction document (not data based) - same as using an xml web control. The resulting html is on the client? but what about the server side of things? Trying to figure out how to change and save the xmlDocument. It I put a button OUTSIDE of the...
2
6036
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 XmlDocument TransformXmlDoc(XmlDocument docToTransform, string xsltFilePath) { //load the xslt
1
9682
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
10163
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 error "The Root Element is Missing" ... any help would be appreciated. Thanks, Rob Panosh
7
1724
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 going to get the DTD at "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd". The result is a time-out because this machine is isolated from the database, the web, everything really :-) I tried to pass XmlDocument a non-validating reader...
1
2113
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 MyDocument(); doc.Load("input.txt"); // doc is now an XmlDocument // Query or modify the XmlDocument as usual doc.Save("output.xml"); // doc saved using XmlDocument.Save(); That is, the input file is not XML, and the Load() method is obviously
4
3270
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 some speed improvements by having one, central XmlDocument and using doc.ReadNode() to process all of the fragments. Other than pumping up the NameTable with a mish-mash of different node names and namespaces, are there any other implications I'm...
1
4984
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 = new XmlDocument(); doc.Load("medicationXML.xml"); The error message is "FileNotFoundException is unhandled"
0
8697
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8622
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9184
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8930
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8892
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6538
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4634
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3061
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.