Altova XMLSpy 2025 Professional Edition

Method: GetElementHierarchy (out_arrElementNames as Variant)

 

Description

Retrieve the names of all XML elements that are parents of the current selection. Inner elements get listed before enclosing elements. An empty list is returned whenever the current selection is not inside a single XMLData element.

 

The names of the element hierarchy, together with the range object uniquely identify XMLData elements in the document. The attributes of these elements can be directly accessed by GetElementAttributeNames, and related methods.

 

 

Errors

2001

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

2005

Invalid address for the return parameter was specified.

 

 

 

C# Examples

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

' C#

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

 

namespace ConsoleApplication1

{

   class Program

   {

       static void Main(string[] args)

       {

           XMLSpyLib.Application app = new XMLSpyLib.Application();

 

           app.ShowApplication(true);

 

           XMLSpyLib.AuthenticView view = app.ActiveDocument.AuthenticView;

           XMLSpyLib.AuthenticRange range = view.DocumentBegin;

 

           object o = null;

           range.GetElementHierarchy(ref o);

 

           object[] elements = (object[])o;

 

           foreach (string e in elements)

           {

               Console.WriteLine(e);

           }

       }

   }

}

 

Also see: SetElementAttributeValue.

 

© 2018-2024 Altova GmbH