Edit

CustomXMLPrefixMappings.AddNamespace method (Office)

Allows you to add a custom namespace/prefix mapping to use when querying an item.

Syntax

expression.AddNamespace(Prefix, NamespaceURI)

expression An expression that returns a CustomXMLPrefixMappings object.

Parameters

Name Required/Optional Data type Description
Prefix Required String Contains the prefix to add to the prefix mapping list.
NamespaceURI Required String Contains the namespace to assign to the newly added prefix.

Remarks

If the prefix already exists in the Namespace Manager, this method will overwrite the meaning of that prefix except when the prefix is one added or used by the data store (IXMLDataStore interface) internally, in which case it will return an error.

Example

The following example adds a prefix and namespace to a CustomPrefixMappings object.

Sub AddNamespacePrefix() 
  
    Dim objCustomPrefixMappings As  CustomPrefixMappings 
    Dim varCustomMapping As Variant 
 
    ' Adds a custom namespace. 
    varCustomMapping = objCustomPrefixMappings.AddNamespace("xs", "urn:invoice:namespace")      
 
End Sub

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.