XmlReader.ResolveEntity 方法


当在派生类中被重写时,解析 EntityReference 节点的实体引用。When overridden in a derived class, resolves the entity reference for EntityReference nodes.

 abstract void ResolveEntity();
public abstract void ResolveEntity ();
abstract member ResolveEntity : unit -> unit
Public MustOverride Sub ResolveEntity ()


读取器未定位在 EntityReference 节点上;该读取器的实现不能解析实体(CanResolveEntity 返回 false)。The reader is not positioned on an EntityReference node; this implementation of the reader cannot resolve entities (CanResolveEntity returns false).

- 或 --or-

在上一次异步操作完成之前调用了 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."


如果读取器定位在 EntityReference 节点 (XmlNodeType.EntityReference) ,则在 Read 调用此方法后调用时,将分析实体替换文本。If the reader is positioned on an EntityReference node (XmlNodeType.EntityReference), if Read is called after calling this method, the entity replacement text is parsed. 实体替换文本完成后,将返回一个 EndEntity 节点以关闭实体引用作用域。When the entity replacement text is finished, an EndEntity node is returned to close the entity reference scope.


调用此方法后,如果实体是属性值的一部分,则必须调用 ReadAttributeValue 以单步执行此实体。After calling this method, if the entity is part of an attribute value, you must call ReadAttributeValue to step into the entity.