Microsoft Office Tutorials and References
In Depth Information
Table 26-4. The XPath Object’s Properties and Methods
A read-only property that returns the XmlMap object that
represents the schema assigned to the XPath object.
A read-only Boolean value that returns True if the XPath object is
assigned to a list, or returns False if the object is assigned to a
Returns a string that represents the XPath for the object.
Clears the schema mapping from the cell or cells mapped to the
specified XPath .
The Map argument (required) is an XmlMap variable representing
the schema map into which you’ll import your XML data; XPath
(required) is a valid XPath statement; SelectionNamespace (an
optional variant) specifies any namespace prefixes (you can
leave this argument out if you put the full XPath in the XPath
argument); Repeating (an optional Boolean) indicates whether
the XPath object should be mapped to a single cell ( False ) or to a
column in the list ( True ).
For more (and very technical) information on the XML Path language, visit the official XPath Web site at
The XPath object’s SetValue method is the most important method in the bunch—it lets you
map a schema element directly to a cell or range. The following procedure defines the data
file that contains the XML data, assigns the schema to be used in the SetValue method calls to
the myMap object variable, and maps the elements to specific ranges. The result of the pro
cedure is shown in Figure 26-7.
Warning This procedure will only run correctly if you have previously mapped the
MySuppliers.xsd schema to the active workbook. You can do so by running the ApplySchema
procedure from the “Mapping a Schema to a Worksheet Programmatically” section found
earlier in this chapter or by mapping the schema to your workbook manually.
Dim myMap As XmlMap
Dim strXPath As String
Dim strSelNS As String
Dim xMapName As String
Dim xDataFile As String