XPathNavigator.LookupPrefix(String) 方法
定义
获取为指定的命名空间 URI 声明的前缀。Gets the prefix declared for the specified namespace URI.
public:
virtual System::String ^ LookupPrefix(System::String ^ namespaceURI);
public virtual string? LookupPrefix (string namespaceURI);
public virtual string LookupPrefix (string namespaceURI);
abstract member LookupPrefix : string -> string
override this.LookupPrefix : string -> string
Public Overridable Function LookupPrefix (namespaceURI As String) As String
参数
- namespaceURI
- String
要为前缀解析的命名空间 URI。The namespace URI to resolve for the prefix.
返回
一个 String,它包含分配给指定的命名空间 URI 的命名空间前缀;如果没有向指定的命名空间 URI 分配任何前缀,则为 Empty。A String that contains the namespace prefix assigned to the namespace URI specified; otherwise, Empty if no prefix is assigned to the namespace URI specified. 返回的 String 是原子化的。The String returned is atomized.
实现
注解
LookupPrefix方法返回与指定的命名空间 URI 相匹配的第一个前缀。The LookupPrefix method returns the first prefix that matches the namespace URI specified. 不会以任何特定方式对引用相同命名空间 URI 的多个前缀进行排序,因此,每次分配多个时,都不能返回特定的前缀。Multiple prefixes referring to the same namespace URI are not ordered in any particular way, so a particular prefix may not be returned each time when more than one is assigned.
备注
用于前缀映射的命名空间 URI 可以从节点更改为 XML 文档中的节点。Namespace URI to prefix mappings can change from node to node in an XML document. 因此, LookupPrefix 从一个节点到下一个节点,该方法的值可能不一致。As a result, the value of the LookupPrefix method may not be consistent from one node to the next.