XML elements cannot be selected from type 'type'

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

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

Error ID: BC36807

To correct this error

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

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

See Also

Reference

XML Child Axis Property

Other Resources

XML Axis Properties

XML in Visual Basic