I am processing cXml orders and the xml begins with the following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.017/
cXML.dtd">
I am attempting to use the following code to transform the xml:
XslCompiledTransform transform = new XslCompiledTransform();
Stream resultStream = new MemoryStream();
XmlReader xslRdr = XmlReader.Create(new StringReader(xslSheet));
transform.Load(xslRdr);
XmlReaderSettings xRdrSettings = new XmlReaderSettings();
xRdrSettings.ProhibitDtd = false;
xRdrSettings.ValidationType = ValidationType.DTD;
XmlReader xmlRdr = XmlReader.Create(cxmlFilename, xRdrSettings);
transform.Transform(xmlRdr, null, resultStream);
My problem is that in my organization, my test machine cannot access
the url in the DOCTYPE without proxy authentication. I get this
exception when running the code:
"An error has occurred while opening external DTD 'http://xml.cxml.org/
schemas/cXML/1.2.017/cXML.dtd': The remote server returned an error:
(407) Proxy Authentication Required."
Can anyone point me to some examples of how to apply the proxy
authentication?
I attempted to create an XmlUriResolver with the proper proxy
credentials, and passed that into the XmlReaderSettings.XmlResolver
property, but that made no difference. I must be missing something
easy.
Any help would be appreciated.
Thanks,
Chris
Marc Gravell - 22 Sep 2007 09:49 GMT
I too would have looked at the XmlUrlResolver route; however, another
option might be to well .Net about your proxy - then *all* code should
be able to find it:
You can do this either in your local app.config/web.config, or at the
machine level if you have a lot of apps
http://support.microsoft.com/default.aspx?scid=kb;en-us;318140
Marc
Chris Dunaway - 24 Sep 2007 16:04 GMT
> I too would have looked at the XmlUrlResolver route; however, another
> option might be to well .Net about your proxy - then *all* code should
[quoted text clipped - 5 lines]
>
> Marc
Thanks for the response. But really, I didn't want to validate the
DTD in the first place. I needed the proxy authentication because of
the DTD.
I resolved the issue by setting the XmlResolver property of the
XmlReaderSettings object to null.
Thanks again,
Chris