NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

XmlReader.ReadAttr

Reads the next available attribute.

[Visual Basic]
Public Function ReadAttr() As XmlAttribute
[C#]
public XmlAttribute ReadAttr();
[C++]
public: XmlAttribute ReadAttr();
[JScript]
public function ReadAttr() : XmlAttribute;

Return Value

The next attribute in the current start tag.

Exceptions

Exception Type Condition
XmlException If the reader is not positioned on a start tag, or if all attributes of the start tag have already been read.

Remarks

The reader must be positioned on a start tag and the HasAttr property must be true. If this is not the case, an exception is thrown.

The ReadAttr method is typically used in a loop of the form:

while (reader.HasAttr) {
      XmlAttribute a = reader.ReadAttr();
      Console.WriteLine("{0}='{1}'", a.ID, a.Value);
  }

There is no requirement that all attributes be read before a reader can be advanced to the next XML node.

To obtain the value of an attribute with a particular name or identifier, use one of the GetAttr methods.

See Also

XmlReader Class | XmlReader Members | System.Xml Namespace | HasAttr