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!

XmlTextReader.ReadAttributeValue

Parses the attribute value into one or more Text and/or EntityReference node types.

[Visual Basic]
Overrides Public Function ReadAttributeValue() As Boolean
[C#]
public override bool ReadAttributeValue();
[C++]
public: override bool ReadAttributeValue();
[JScript]
public override function ReadAttributeValue() : Boolean;

Return Value

true if there are nodes to return; false if there are no more nodes to return.

Note that an empty attribute (such as, foo="") returns true with a single node with a value of String.Empty.

Remarks

For example, suppose you have the following XML:

<test name="a &b; c"/>

where the entity "b" is defined in the DTD as follows:

<!ENTITY b "123">

If the EntityHandling is set to ExpandCharEntities, this attribute value will be returned as two text nodes and one entity reference node with the following code:

[C#]

reader.MoveToAttribute("name");
while (reader.ReadAttributeValue()) 
{
  if (reader.NodeType == XmlNodeType.Text) 
  {
    // at this point reader.Text == "a " or " c"
  }
  else if (reader.NodeType == XmlReader.EntityReference)
  {
    // at this point reader.Name == "b"
    reader.ResolveEntity();
    while (reader.ReadAttributeValue() && 
   reader.NodeType != XmlNodeType.EndEntity) 
    {
      // reader.Text == "123"
    }
  }
}

See Also

XmlTextReader Class | XmlTextReader Members | System.NewXml Namespace