vb System.Xml.XmlNode.Value类(方法)实例源码

下面列出了vb System.Xml.XmlNode.Value 类(方法)源码代码实例,从而了解它的用法。

作者:VB.NET开发    项目:System.Xm   
Option Strict
Option Explicit

Imports System.IO
Imports System.Xml

Public Class Sample
    
    Public Shared Sub Main()
        
        Dim doc As New XmlDocument()
        doc.LoadXml("<book xmlns:bk='urn:samples' bk:ISBN='1-861001-57-5'>" & _
                    "<title>Pride And Prejudice</title>" & _
                    "</book>")
        
        Dim root As XmlNode = doc.FirstChild
        
        'Create a new attribute.
        Dim ns As String = root.GetNamespaceOfPrefix("bk")
        Dim attr As XmlNode = doc.CreateNode(XmlNodeType.Attribute, "genre", ns)
        attr.Value = "novel"
        
        'Add the attribute to the document.
        root.Attributes.SetNamedItem(attr)
        
        Console.WriteLine("Display the modified XML...")
        doc.Save(Console.Out)
    End Sub
End Class


问题


面经


文章

微信
公众号

扫码关注公众号