XmlXapResolver Constructor
Collapse the table of content
Expand the table of content

XmlXapResolver Constructor

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Initializes a new instance of the XmlXapResolver class.

Namespace:  System.Xml
Assembly:  System.Xml (in System.Xml.dll)

public XmlXapResolver()

The following example loads an XML file from your application's XAP file.


StringBuilder output = new StringBuilder();

// XmlXapResolver is the default resolver.
using (XmlReader reader = XmlReader.Create("book.xml"))
{
    // Moves the reader to the root element.
    reader.MoveToContent();

    reader.ReadToFollowing("book");
    // Note that ReadInnerXml only returns the markup of the node's children
    // so the book's attributes are not returned.
    output.AppendLine("Read the first book using ReadInnerXml...");
    output.AppendLine(reader.ReadInnerXml());

    reader.ReadToFollowing("book");

    // ReadOuterXml returns the markup for the current node and its children
    // so the book's attributes are also returned.
    output.AppendLine("Read the second book using ReadOuterXml...");
    output.AppendLine(reader.ReadOuterXml());

}

OutputTextBlock.Text = output.ToString();


The example uses bool.xml file as input.

<bookstore>
    <book genre='novel' ISBN='10-861003-324'>
        <title>The Handmaid's Tale</title>
        <price>19.95</price>
    </book>
    <book genre='novel' ISBN='1-861001-57-5'>
        <title>Pride And Prejudice</title>
        <price>24.95</price>
    </book>
</bookstore>

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft