Using the XmlResolver Property


Using the XmlResolver Property

The XmlResolver property provides write-only access to the object used to resolve the location of the file being loaded. The XmlResolver is an abstract class that is used for resolving remote resources. By default, the XmlTextReader uses the XmlUrlResolver with no credentials.

On the desktop .NET Framework, the XmlResolver is also used to resolve DTD references, but this is not supported on the .NET Compact Framework. If a DocumentType node is encountered , the XmlTextReader will throw an XmlException .

This property can be changed at any time and takes effect the next time a read operation is executed. In most cases the XmlResolver will be used only to load the XmlTextReader . Because there will be no DTD information to resolve, there should never be any other reason to set the XmlResolver after it has been loaded. To save on memory usage, the XmlResolver property should be set to null after loading the document. If you don't need it to load the document, it can be set to null before the document is loaded. See Listing 10.3 for an example of how to use the XmlResolver property.



Microsoft.NET Compact Framework Kick Start
Microsoft .NET Compact Framework Kick Start
ISBN: 0672325705
EAN: 2147483647
Year: 2003
Pages: 206

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net