XmlReader.IsStartElement Method (String)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Calls MoveToContent and tests if the current content node is a start tag or empty element tag and if the Name property of the element found matches the given argument.
Assembly: System.Xml (in System.Xml.dll)
Parameters
- name
- Type: System.String
The string matched against the Name property of the element found.
Return Value
Type: System.Booleantrue if the resulting node is an element and the Name property matches the specified string. false if a node type other than XmlNodeType.Element was found or if the element Name property does not match the specified string.
| Exception | Condition |
|---|---|
| XmlException | Incorrect XML is encountered in the input stream. |
StringBuilder output = new StringBuilder(); String xmlString = @"<book> <title>Pride And Prejudice</title> <price>19.95</price> <misc/> </book>"; // Create an XmlReader using (XmlReader reader = XmlReader.Create(new StringReader(xmlString))) { // Parse the file and display each price node. while (reader.Read()) { if (reader.IsStartElement("price")) { output.Append(reader.ReadInnerXml()); } } } OutputTextBlock.Text = output.ToString();
Show: