BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
System.XML
System.Xml.XmlTextWriter Class
System.Xml.XmlTextReader Class
System.Xml.XmlText Class
System.Xml.XmlSignificantWhitespace Class
System.Xml.XmlSecureResolver Class
System.Xml.XmlResolver Class
System.Xml.XmlReader Class
System.Xml.XmlQualifiedName Class
System.Xml.XmlProcessingInstruction Class
System.Xml.XmlParserContext Class
System.Xml.XmlNotation Class
System.Xml.XmlNodeReader Class
System.Xml.XmlNodeList Class
System.Xml.XmlNodeChangedEventArgs Class
System.Xml.XmlNode Class
System.Xml.XmlNameTable Class
System.Xml.XmlNamespaceManager Class
System.Xml.XmlNamedNodeMap Class
System.Xml.XmlLinkedNode Class
System.Xml.XmlImplementation Class
<< SQL XML
Uncategorized >>

By :Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :03/24/2008
Times viewed :233

 

The System.Xml.XmlUrlResolver Class

Supported Versions

.NET Framework 1.0, 1.1, 1.2

Public Members

Bold members are covered in the sample code.

Public Properties

Public Methods

Credentials

Equals

NameTable

GetEntity

GetHashCode

GetType

ResolveUri

ToString

Overview

This class is a concrete implementation of the XmlResolver class, and acts as the default resolver class used within the System.Xml library. Its primary function is to resolve references to external DTD, XML Schema, and XSL documents.

Example #1 (VB.NET): How to turn off the XmlResolver on an XmlTextReader object.

In the example below we create an XmlTextReader that reads in the contents of an XML document containing an *invalid* reference to an external Document Type Definition. The XmlTextReader.XmlResolver property is intentionally set to nothing, allowing the XmlTextReader to ignore the DTD reference.

        Dim objXmlTextReader As System.Xml.XmlTextReader

        Dim objXmlUrlResolver As System.Xml.XmlUrlResolver

        Dim strValues As String

        objXmlTextReader = New XmlTextReader("c:\note.xml")

        objXmlTextReader.XmlResolver = Nothing

        strValues = "First Try - no resolver" & CrLf

        While (objXmlTextReader.Read)

            strValues &= objXmlTextReader.ReadInnerXml

        End While

        TextBox1.Text = strValues

Example #2 (VB.NET): How to explicitly assign an XmlUrlResolver object to an XmlTextReader object.

(This is a continuation of our previous example.) We now explicitly create an XmlUrlResolver object and assign it to the XmlTextReader object. By doing so the XmlTextReader.Read method is forced to check the DTD reference. Upon discovering that the reference is invalid, an error is generated and displayed.

            ...

        objXmlUrlResolver = New XmlUrlResolver

        Try

            objXmlTextReader.XmlResolver = objXmlUrlResolver

            strValues &= "Second Try - with resolver" & CrLf

            While (objXmlTextReader.Read)

                strValues &= objXmlTextReader.ReadInnerXml

            End While

        Catch objException As Exception

            strValues &= objException.Message

        End Try

        TextBox1.Text = strValues


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

Software Developers Needed in Charl
Sr. Software Engineer - Analytics
Immediate Mainframe openings for Ch
Immediate TANDEM-TAL openings for C
Immediate ASP.NET/C# Openings for C

View all Jobs (Add yours)
View all CV (Add yours)



bigfoot conferencing
swimming pool contractor
saveonconferences uk rates
water softener
Teleconference
Host Department NOLIMIT Web Hosting
MSN
sunglasses


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP