Share via


XMLChildNodeSuggestion Object

XMLChildNodeSuggestions
XMLChildNodeSuggestion
XMLSchemaReference

Represents a node that is a possible child element of the current element, according to the schema, but is not guaranteed to be valid. Word cannot validate the required order in which elements are supposed to appear, as well as minimum or maximum occurrence restrictions or other constraints, until after a user inserts the elements into the document.

Note  Each XMLChildNodeSuggestion object is an item in the list of XML elements at the bottom of the XML Structure task pane when the List only child elements of current element check box is checked.

Using the XMLChildNodeSuggestion Object

Use the XMLSchemaReference property to access the individual schema that the node references. Use the Item method to return an individual XMLChildNodeSuggestion object from a collection of XMLChildNodeSuggestion object. The following code inserts all allowed elements into the active element.

Dim objSuggestion As XMLChildNodeSuggestion
Dim objNode As XMLNode
    
Set objNode = Selection.XMLParentNode 
    
For Each objSuggestion In objNode.ChildNodeSuggestions
    objSuggestion.Insert
    Selection.MoveRight
Next

Use the NamespaceURI property to return the namespace for the schema referenced in an XMLChildNodeSuggestion object. Use the BaseName property to return the name of the element that represents the XMLChildNodeSuggestion object.

Dim objSuggestion As XMLChildNodeSuggestion
    
For Each objSuggestion In ActiveDocument _
        .ChildNodeSuggestions
        
    If objSuggestion.BaseName = "example" Then
        objSuggestion.Insert
    End If
            
Next

Properties | Application Property | BaseName Property | Creator Property | NamespaceURI Property | Parent Property | XMLSchemaReference Property

Methods | Insert Method

Parent Objects

Child Objects | XMLSchemaReference Object