Class XmlSchema (Excel VBA)

The class XmlSchema represents an XML schema contained by an XmlMap object.

Item

To use a XmlSchema class variable it first needs to be instantiated, for example

Dim xmlsch as XmlSchema
Set xmlsch = ActiveWorkbook.XmlMaps(1).Schemas(Index:=1)

XmlSchema class variables can be set using the XmlSchemas.Item procedure.

For Each

Here is an example of processing the XmlSchema items in a collection.

Dim xmlschSchema As XmlSchema
For Each xmlschSchema In ActiveWorkbook.XmlMaps(1).Schemas
	
Next xmlschSchema

Name

Returns a String value that represents the friendly name used to identify an XML schema in an XmlMap object.

Dim strName As String
strName = ActiveWorkbook.XmlMaps(1).Schemas(1).Name

Namespace

Returns an XmlNamespace object that represents the target namespace for the specified schema.

Dim xmlnspNamespace As XmlNamespace
Set xmlnspNamespace = ActiveWorkbook.XmlMaps(1).Schemas(1).Namespace

XML

Returns a String value that represents the content of the specified schema.

Dim strXML As String
strXML = ActiveWorkbook.XmlMaps(1).Schemas(1).XML

XmlSchemas.Count

Returns a Long value that represents the number of objects in the collection.

Dim lngCount As Long
lngCount = ActiveWorkbook.XmlMaps(1).Schemas.Count

XmlSchemas.Item

Returns a single XmlSchema object from the collection.

Item (Index)

Index: The name or index number of the object.

Dim xmlschItem As XmlSchema
Set xmlschItem = ActiveWorkbook.XmlMaps(1).Schemas(Index:=1)