Altova XMLSpy 2025 Professional Edition

Method: PerformAction (eAction as SPYAuthenticActions, strElementName as String) as Boolean

 

Description

PerformAction and its related methods, give access to the entry-helper functions of Authentic. This function allows easy and consistent modification of the document content without a need to know exactly where the modification will take place. The beginning  of the range object is used to locate the next valid location where the specified action can be performed. If no such location can be found, the method returns False. Otherwise, the document gets modified and the range points to the beginning of the modification.

 

HINT: To find out element names that can be passed as the second parameter use CanPerformActionWith.

 

Errors

2001

The authentic range object, or its related view object is no longer valid.

2005

Invalid address for the return parameter was specified.

2007

Invalid action was specified.

 

Examples

' --------------------------------------------

' Scripting environment - VBScript

' Insert the innermost element

' --------------------------------------------

Dim objRange

' we assume that the active document is open in authentic view mode

Set objRange = Application.ActiveDocument.AuthenticView.Selection

 

' we determine the elements that can be inserted at the current position

Dim arrElements()

objRange.CanPerformActionWith spyAuthenticInsertBefore, arrElements

 

' we insert the first (innermost) element

If UBound(arrElements) >= 0 Then

 objRange.PerformAction spyAuthenticInsertBefore, arrElements(0)

 ' objRange now points to the beginning of the inserted element

 ' we set a default value and position at its end

 objRange.Text = "Hello"

 objRange.ExpandTo(spyAuthenticTag).CollapsToEnd().Select

Else

 MsgBox "Can't insert any elements at current position"

End If

© 2018-2024 Altova GmbH