Parses the attribute value into one or more Text and/or EntityReference node types.
[Visual Basic] MustOverride Public Function ReadAttributeValue() As Boolean [C#] public abstract bool ReadAttributeValue(); [C++] public: virtual bool ReadAttributeValue() = 0; [JScript] public abstract function ReadAttributeValue() : Boolean;
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.
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" } } }
XmlReader Class | XmlReader Members | System.NewXml Namespace