Compartilhar via


Accessing XML in Visual Basic

Visual Basic provides XML axis properties for accessing and navigating LINQ to XML structures. These properties use a special syntax to enable you to access elements and attributes by specifying the XML names.

The following table lists the language features that enable you to access XML elements and attributes in Visual Basic.

XML Axis Properties

Property description

Example

Description

child axis

contact.<phone>

Gets all phone elements that are child elements of the contact element.

attribute axis

phone.@type

Gets all type attributes of the phone element.

descendant axis

contacts...<name>

Gets all name elements of the contacts element, regardless of how deep in the hierarchy they occur.

extension indexer

contacts...<name>(0)

Gets the first name element from the sequence.

value

contacts...<name>.Value

Gets the string representation of the first object in the sequence, or Nothing if the sequence is empty.

In This Section