Udostępnij za pośrednictwem


XML attributes cannot be selected from type 'type'

An XML attribute has been referenced for an object that is not of type XElement or IEnumerable(Of XElement). For more information, see XML Attribute Axis Property.

' Generates an error.
Dim var = "sample text".@attr

Error ID: BC36808

To correct this error

  • Ensure that the object of which you are referencing an attribute is strongly typed as XElement or IEnumerable(Of XElement). Following is an example:

    Dim elem As XElement = <root attr="value"/>
    Dim var = elem.@attr
    

See Also

Reference

XML Attribute Axis Property

Other Resources

XML Axis Properties

XML in Visual Basic