xml resolvexternals

G

Guest

How can you tell a .NET XMLDocument not to resolve externals such as DTDs (in VB)

Before .NET you used to say
xmldoc.resolveExternals = False
 
T

Tian Min Huang

Hello,

Thanks for your post. In .NET, we can use the XmlDocument.XmlResolver
property. MSDN documentation on XmlDocument.XmlResolver states that:

"In version 1.1 of the .NET Framework, if this property is not set, the
trust level of the application determines the default behavior.

Fully-trusted code: The document uses a default XmlUrlResolver with no user
credentials. If authentication is required to access a network resource,
use the XmlResolver property to specify an XmlResolver with the necessary
credentials.

Semi-trusted code: The XmlResolver property is set to a null reference
(Nothing in Visual Basic). External resources are not resolved."

You should set this property to null (Nothing in VB.NET) so that the
XmlDocument loads files as anonymous, and does not attempt to resolve any
other resources. Please refer to the following MSDN article for detailed
information:

Resolving External Resources
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconResolvingExternalResources.asp?frame=true

Please feel free to let me know if you have any problems or concerns.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
G

Guest

Tian,

Thank you very much. That did the trick!

You might want to have someone review the .NET documentation. I spent a good 30 minutes or more poring over the section on xmlResolver with no success finding if it could be used for this purpose.

But your post made it crystal clear. Thanks again.

-Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top