本文整理匯總了VB.NET中System.Xml.XmlValidatingReader.XmlResolver屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET XmlValidatingReader.XmlResolver屬性的具體用法?VB.NET XmlValidatingReader.XmlResolver怎麽用?VB.NET XmlValidatingReader.XmlResolver使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。
在下文中一共展示了XmlValidatingReader.XmlResolver屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: XmlTextReader
' Create the reader.
Dim txtreader as XmlTextReader = new XmlTextReader("book5.xml")
Dim reader as XmlValidatingReader = new XmlValidatingReader(txtreader)
txtreader.WhitespaceHandling = WhitespaceHandling.None
' Set the credentials necessary to access the DTD file stored on the network.
Dim resolver as XmlUrlResolver = new XmlUrlResolver()
resolver.Credentials = System.Net.CredentialCache.DefaultCredentials
reader.XmlResolver = resolver
' Display each of the element nodes.
while (reader.Read())
select case reader.NodeType
case XmlNodeType.Element:
Console.Write("<{0}>", reader.Name)
case XmlNodeType.Text:
Console.Write(reader.Value)
case XmlNodeType.DocumentType:
Console.Write("<!DOCTYPE {0} [{1}]", reader.Name, reader.Value)
case XmlNodeType.EntityReference:
Console.Write(reader.Name)
case XmlNodeType.EndElement:
Console.Write("</{0}>", reader.Name)
end select
end while