XNode.CreateReader creates an XmlReader for this node. : XmlReader « XML « VB.Net





XNode.CreateReader creates an XmlReader for this node.

 
Imports System
Imports System.Xml
Imports System.Xml.Schema
Imports System.Linq
Class MainClass

    Shared Sub Main()


        Dim xmlTree As XDocument =  _
            <?xml version="1.0" encoding="utf-8" standalone="yes"?>
                <Root Att1="Attribute Content">
                    <Child1>1</Child1>
                    <Child2>2</Child2>
                </Root>
        Dim reader As XmlReader = xmlTree.CreateReader()
        reader.MoveToContent()
        Dim doc As XmlDocument = New XmlDocument()
        Dim cd As XmlNode = doc.ReadNode(reader)
        doc.AppendChild(cd)
        Console.WriteLine(doc.OuterXml)
    End Sub

End Class

   
  










Related examples in the same category

1.Loads the XML document from the specified XmlReader.
2.XmlParserContext Class has context information required by the XmlReader to parse an XML fragment.
3.XmlReader Class represents a reader that provides fast, non-cached, forward-only access to XML data.
4.XmlReader.AttributeCount gets the number of attributes on the current node.
5.XmlReader.Create Method creates a new XmlReader instance using the specified stream.
6.XmlReader.Create Method creates a new XmlReader instance with specified URI.
7.XmlReader.Create Method creates a new instance with the specified URI and XmlReaderSettings.
8.XmlReader.Create Method creates a new XmlReader instance.
9.Creates a new XmlReader instance with the specified TextReader.
10.Creates a new XmlReader instance with the specified XmlReader and XmlReaderSettings objects.
11.XmlReader.GetAttribute gets the value of the attribute with the specified index.
12.XmlReader.GetAttribute Method gets the value of the attribute with the specified Name.
13.XmlReader.HasAttributes Property tells whether the current node has any attributes.
14.XmlReader.IsEmptyElement tells whether the current node is an empty element ().
15.XmlReader.Item gets the value of the attribute with the specified Name.
16.XmlReader.LocalName Property gets the local name of the current node.
17.XmlReader.MoveToAttribute Method moves to the attribute with the specified index.
18.XmlReader.MoveToFirstAttribute Method moves to the first attribute.
19.XmlReader.Name Property gets the qualified name of the current node.
20.XmlReader.ReadContentAs reads the content as an object of the type specified.
21.XmlReader.ReadContentAsBoolean reads the text content at the current position as a Boolean.
22.XmlReader.ReadElementContentAs Method reads the element content as the requested type.
23.XmlReader.ReadElementContentAsBase64 Method reads the element and decodes the Base64 content.
24.XmlReader.ReadElementContentAsBinHex Method reads the element and decodes the BinHex content.
25.XmlReader.ReadElementContentAsDateTime reads the current element and returns the contents as a DateTime object.
26.XmlReader.ReadElementContentAsObject
27.XmlReader.ReadElementContentAsString
28.XmlReader.ReadElementContentAsString
29.XmlReader.ReadElementString reads a text-only element.
30.XmlReader.ReadEndElement
31.XmlReader.ReadInnerXml
32.XmlReader.ReadOuterXml Method (System.Xml)_VB.htm
33.XmlReader.ReadSubtree
34.XmlReader.ReadToDescendant
35.XmlReader.ReadToNextSibling
36.XmlReader.Skip
37.XmlReaderSettings specifies a set of features to support on the XmlReader object created by the Create method.
38.XmlReaderSettings.XmlResolver sets the XmlResolver used to access external documents.
39.XmlWriter.WriteAttributes writes out all the attributes found at the current position in the XmlReader.
40.Creates a new sibling node after the currently selected node using the XML contents of the XmlReader object specified.
41.XPathNavigator.InsertBefore (XmlReader)
42.XPathNavigator.PrependChild (XmlReader)
43.XPathNavigator.ReadSubtree (System.Xml.XPath) returns XmlReader
44.XPathNavigator.ReplaceSelf (XmlReader) replaces the current node with the contents of the XmlReader object specified.
45.XDocument.Load (XmlReader) creates a new XDocument from an XmlReader.
46.XDocument.Load (XmlReader, LoadOptions) loads an XElement from an XmlReader, setting the base URI, and retaining line information.
47.XElement.Load (XmlReader) loads an XElement from an XmlReader.
48.XElement.Load (XmlReader, LoadOptions) loads an XElement from an XmlReader
49.Reads the current element and returns the contents as a double-precision floating-point number.
50.Reads the current element and returns the contents as a 64-bit signed integer.
51.A single-threaded XmlNameTable.