XMLChildNodeSuggestion Object

Word Developer Reference

Represents a node that is a possible child element of the current element, according to the schema, but is not guaranteed to be valid.

Remarks

Microsoft Office Word cannot validate the required order in which elements are supposed to appear (or minimum or maximum occurrence restrictions or other constraints) until after a user inserts the elements into the document. 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.

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.

Visual Basic for Applications
  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.

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

See Also