469,290 Members | 1,824 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,290 developers. It's quick & easy.

Parsing an XML file, ERROR: The remote server returned an error: (407) Proxy Authentication Required. HELP!

I'm getting the above error thrown somewhere in the code:

XPathDocument xPathDocument = new XPathDocument(FileLocation);
XPathNavigator xPathNavigator = xPathDocument.CreateNavigator();
XPathNodeIterator nodeIterator = xPathNavigator.Select("/plist/dict");
nodeIterator.MoveNext();
nodeIterator = nodeIterator.Current.SelectChildren(XPathNodeType. All);

where FileLocation contains the full path of a local XML file. Why is this
trying to access the file via the proxy ? What can I do to fix this ?
Nov 12 '05 #1
6 8087


JezB wrote:
I'm getting the above error thrown somewhere in the code:

XPathDocument xPathDocument = new XPathDocument(FileLocation); where FileLocation contains the full path of a local XML file. Why is this
trying to access the file via the proxy ? What can I do to fix this ?


Well how does FileLocation look like? Is that a HTTP URL e.g.
http://example.com/document.xml
or
http://localhost/document.xml
The error message suggests that and that you get the HTTP status 407
<http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.8>. That
is not an XML problem then but a problem on how your HTTP access is
going through a proxy. Perhaps
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaccessinginternetthroughproxy.asp>
helps.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 12 '05 #2
It's something like :

"C:\Documents and Settings\JeremyB\Desktop\Library.xml"

Why this has to go through a proxy is a mystery to me.

"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:em**************@TK2MSFTNGP15.phx.gbl...


JezB wrote:
I'm getting the above error thrown somewhere in the code:

XPathDocument xPathDocument = new XPathDocument(FileLocation);

where FileLocation contains the full path of a local XML file. Why is
this trying to access the file via the proxy ? What can I do to fix this
?


Well how does FileLocation look like? Is that a HTTP URL e.g.
http://example.com/document.xml
or
http://localhost/document.xml
The error message suggests that and that you get the HTTP status 407
<http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.8>. That
is not an XML problem then but a problem on how your HTTP access is going
through a proxy. Perhaps
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaccessinginternetthroughproxy.asp>
helps.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

Nov 12 '05 #3


JezB wrote:
It's something like :

"C:\Documents and Settings\JeremyB\Desktop\Library.xml"

Why this has to go through a proxy is a mystery to me.


Sounds odd indeed. Sorry, I don't understand why you would get 407 Proxy
Authentication Required for a local file access.
When I try to use XPathDocument on Windows XP to access a local file in
a directory of another user then I get a normal access denied to that
path which sounds right.
I have googled to find whether someone has reported a problem similar to
yours but not found anything.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 12 '05 #4
A-ha. The xml header in my local file has this:

<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">

So it's trying to read schema information from the internet when it
executes:
XPathDocument xPathDocument = new XPathDocument(FileLocation);

Does it have to ? Can this be bypassed ?
"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:eu*************@tk2msftngp13.phx.gbl...


JezB wrote:
It's something like :

"C:\Documents and Settings\JeremyB\Desktop\Library.xml"

Why this has to go through a proxy is a mystery to me.


Sounds odd indeed. Sorry, I don't understand why you would get 407 Proxy
Authentication Required for a local file access.
When I try to use XPathDocument on Windows XP to access a local file in a
directory of another user then I get a normal access denied to that path
which sounds right.
I have googled to find whether someone has reported a problem similar to
yours but not found anything.
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

Nov 12 '05 #5


JezB wrote:

<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">

So it's trying to read schema information from the internet when it
executes:
XPathDocument xPathDocument = new XPathDocument(FileLocation);

Does it have to ? Can this be bypassed ?


I think you can try
XmlTextReader xmlReader = new XmlTextReader(FileLocation);
xmlReader.XmlResolver = null;
XPathDocument xPathDocument = new XPathDocument(xmlReader);
to suppress the access.

However if the DTD defines entities and the document references them you
could get problems. A complete solution would be to implement your own
resolver that for instance reads a locally safed version of the DTD when
the URL needs to be resolved.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 12 '05 #6
Actually that helped - many thanks :)

"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:u4****************@TK2MSFTNGP10.phx.gbl...


JezB wrote:

<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">

So it's trying to read schema information from the internet when it
executes:
XPathDocument xPathDocument = new XPathDocument(FileLocation);

Does it have to ? Can this be bypassed ?


I think you can try
XmlTextReader xmlReader = new XmlTextReader(FileLocation);
xmlReader.XmlResolver = null;
XPathDocument xPathDocument = new XPathDocument(xmlReader);
to suppress the access.

However if the DTD defines entities and the document references them you
could get problems. A complete solution would be to implement your own
resolver that for instance reads a locally safed version of the DTD when
the URL needs to be resolved.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

Nov 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Greg Vereschagin | last post: by
2 posts views Thread by Mr. Ali Hasan | last post: by
2 posts views Thread by Mr. Ali Hasan | last post: by
5 posts views Thread by John | last post: by
reply views Thread by =?Utf-8?B?c3VqaXRo?= | last post: by
3 posts views Thread by =?Utf-8?B?UmljaGFyZEBub3NwYW0ubm9zcGFt?= | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.