XmlReader.ReadAttributeValue 方法


当在派生类中被重写时,将属性值解析为一个或多个 TextEntityReferenceEndEntity 节点。When overridden in a derived class, parses the attribute value into one or more Text, EntityReference, or EndEntity nodes.

 abstract bool ReadAttributeValue();
public abstract bool ReadAttributeValue ();
abstract member ReadAttributeValue : unit -> bool
Public MustOverride Function ReadAttributeValue () As Boolean



如果有可返回的节点,则为 truetrue if there are nodes to return.

如果进行初始调用时读取器不是定位在属性节点上,或者如果已读取了所有属性值,则为 falsefalse if the reader is not positioned on an attribute node when the initial call is made or if all the attribute values have been read.

如果是空属性(如 misc=""),则返回 true,同时返回值为 String.Empty 的单个节点。An empty attribute, such as, misc="", returns true with a single node with a value of String.Empty.


在上一次异步操作完成之前调用了 XmlReader 方法。An XmlReader method was called before a previous asynchronous operation finished. 在此情况下,会引发 InvalidOperationException 并显示消息“异步操作已在进行中。”In this case, InvalidOperationException is thrown with the message "An asynchronous operation is already in progress."


在调用 MoveToAttribute 以读取组成特性值的文本或实体引用节点之前,请使用此方法。Use this method after calling MoveToAttribute to read through the text or entity reference nodes that make up the attribute value. Depth属性值节点的是一个加号节点的深度,在单步执行和跳出常规实体引用时,它会递增和递减一个。The Depth of the attribute value nodes is one plus the depth of the attribute node; it increments and decrements by one when you step into and out of general entity references.