XMLNode Object

Multiple objects
XMLNode
Multiple objects

Represents a single XML element applied to a document. Each XML element that has been applied to a document is displayed as a node in a tree view control in the XML Structure task pane. Each node in the tree view is an instance of an XMLNode object. The hierarchy in the tree view indicates whether a node contains child nodes.

Using the XMLNode Object

Use the Item method of the XMLNodes collection to return an individual XMLNode object. Use the Validate method to verify that an XML element is valid according to the applied schemas and that any required child elements exist and are in the required order. Once you run the Validate method, use the ValidationStatus property to verify whether an element is valid, and use the ValidationErrorText property to display information about what the user needs to do to make the document conform to the XML schema rules.

The following example validates each of the XML elements in the active document. If the element is found to be invalid against the schema, the example returns a message to the user explaining what the problem is.

Sub ValidateXMLElements()
    Dim objNode As XMLNode
    
    For Each objNode In ActiveDocument.XMLNodes
        objNode.Validate
        If objNode.ValidationStatus <> wdXMLValidationStatusOK  Then
            MsgBox objNode.ValidationErrorText(True)
        End If
    Next
End Sub

Properties | Application Property | Attributes Property | BaseName Property | ChildNodes Property | ChildNodeSuggestions Property | Creator Property | FirstChild Property | HasChildNodes Property | LastChild Property | Level Property | NamespaceURI Property | NextSibling Property | NodeType Property | NodeValue Property | OwnerDocument Property | Parent Property | ParentNode Property | PlaceholderText Property | PreviousSibling Property | Range Property | SmartTag Property | Text Property | ValidationErrorText Property | ValidationStatus Property | XML Property

Methods | Copy Method | Cut Method | Delete Method | RemoveChild Method | SelectNodes Method | SelectSingleNode Method | SetValidationError Method | Validate Method

Parent Objects | Range Object | Selection Object | SmartTag Object | XMLNode Object

Child Objects | Document Object | Range Object | SmartTag Object | XMLChildNodeSuggestions Object | XMLNode Object | XMLNodes Object