Parse Method

XDocument.Parse Method

Creates a new XDocument from a string, optionally preserving white space, setting the base URI, and retaining line information.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  Name Description
Public method Static member Supported by Silverlight for Windows Phone Supported by Xbox 360 Parse(String) Creates a new XDocument from a string.
Public method Static member Supported by Silverlight for Windows Phone Supported by Xbox 360 Parse(String, LoadOptions) Creates a new XDocument from a string, optionally preserving white space, setting the base URI, and retaining line information.
Top

This method parses a string and creates an XML tree.

The following example creates a string that contains XML. It then parses the string into an XDocument.


Dim output As New StringBuilder
Dim str As String = _
    "<?xml version= '1.0'?>" & _
    "<!-- comment at the root level -->" & _
    "<Root>" & _
    "  <Child>Content</Child>" & _
    "</Root>"

Dim doc As XDocument = XDocument.Parse(str)
output.Append(doc)
output.Append(Environment.NewLine)


OutputTextBlock.Text = output.ToString()


Community Additions

ADD
Show:
© 2016 Microsoft