VB.Net by API/System.Xml/XmlWriter — различия между версиями

Материал из VB Эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Версия 16:40, 26 мая 2010

XmlWriter.Create

  
Imports System.Xml
Imports System.Xml.Serialization
Imports System.IO

Public Class MainClass
   Public Shared Sub Main()
        Dim myXmlSettings As New XmlWriterSettings
        myXmlSettings.Indent = True
        myXmlSettings.NewLineOnAttributes = True
        Using ProductWriter As XmlWriter = XmlWriter.Create("test.xml", myXmlSettings)
            ProductWriter.WriteComment("www.vbex.ru ")
            ProductWriter.WriteStartElement("Product")
            ProductWriter.WriteAttributeString("Id", "101")
            ProductWriter.WriteAttributeString("COunt", "10")
            ProductWriter.WriteElementString("P1", "P2")
            ProductWriter.WriteEndElement() 
        End Using
   End Sub
End Class


XmlWriter.WriteAttributeString

  
Imports System.Xml
Imports System.Xml.Serialization
Imports System.IO

Public Class MainClass
   Public Shared Sub Main()
        Dim myXmlSettings As New XmlWriterSettings
        myXmlSettings.Indent = True
        myXmlSettings.NewLineOnAttributes = True
        Using ProductWriter As XmlWriter = XmlWriter.Create("test.xml", myXmlSettings)
            ProductWriter.WriteComment("www.vbex.ru ")
            ProductWriter.WriteStartElement("Product")
            ProductWriter.WriteAttributeString("Id", "101")
            ProductWriter.WriteAttributeString("COunt", "10")
            ProductWriter.WriteElementString("P1", "P2")
            ProductWriter.WriteEndElement() 
        End Using
   End Sub
End Class


XmlWriter.WriteComment

  
Imports System.Xml
Imports System.Xml.Serialization
Imports System.IO

Public Class MainClass
   Public Shared Sub Main()
        Dim myXmlSettings As New XmlWriterSettings
        myXmlSettings.Indent = True
        myXmlSettings.NewLineOnAttributes = True
        Using ProductWriter As XmlWriter = XmlWriter.Create("test.xml", myXmlSettings)
            ProductWriter.WriteComment("www.vbex.ru ")
            ProductWriter.WriteStartElement("Product")
            ProductWriter.WriteAttributeString("Id", "101")
            ProductWriter.WriteAttributeString("COunt", "10")
            ProductWriter.WriteElementString("P1", "P2")
            ProductWriter.WriteEndElement() 
        End Using
   End Sub
End Class


XmlWriter.WriteElementString

  
Imports System.Xml
Imports System.Xml.Serialization
Imports System.IO

Public Class MainClass
   Public Shared Sub Main()
        Dim myXmlSettings As New XmlWriterSettings
        myXmlSettings.Indent = True
        myXmlSettings.NewLineOnAttributes = True
        Using ProductWriter As XmlWriter = XmlWriter.Create("test.xml", myXmlSettings)
            ProductWriter.WriteComment("www.vbex.ru ")
            ProductWriter.WriteStartElement("Product")
            ProductWriter.WriteAttributeString("Id", "101")
            ProductWriter.WriteAttributeString("COunt", "10")
            ProductWriter.WriteElementString("P1", "P2")
            ProductWriter.WriteEndElement() 
        End Using
   End Sub
End Class


XmlWriter.WriteStartElement

  
Imports System.Xml
Imports System.Xml.Serialization
Imports System.IO

Public Class MainClass
   Public Shared Sub Main()
        Dim myXmlSettings As New XmlWriterSettings
        myXmlSettings.Indent = True
        myXmlSettings.NewLineOnAttributes = True
        Using ProductWriter As XmlWriter = XmlWriter.Create("test.xml", myXmlSettings)
            ProductWriter.WriteComment("www.vbex.ru ")
            ProductWriter.WriteStartElement("Product")
            ProductWriter.WriteAttributeString("Id", "101")
            ProductWriter.WriteAttributeString("COunt", "10")
            ProductWriter.WriteElementString("P1", "P2")
            ProductWriter.WriteEndElement() 
        End Using
   End Sub
End Class