无法从“type”类型中选择 XML 元素

更新:2007 年 11 月

针对类型不是 XElementXDocument 或 IEnumerable(Of XElement) 的对象引用了 XML 子元素。有关更多信息,请参见 XML 子轴属性

' Generates an error.
Dim var = "sample text".<child>

**错误 ID:**BC36807

更正此错误

  • 确保将要引用其属性的对象强类型化为 XElementXDocument 或 IEnumerable(Of XElement)。下面是一个示例:

    Dim elem As XElement = <root>
                             <child />
                           </root>
    Dim var = elem.<child>
    

请参见

参考

XML 子轴属性

其他资源

XML 轴属性

Visual Basic 中的 XML