cancel
Showing results for 
Search instead for 
Did you mean: 

How to iterate the whole context?

Former Member
0 Kudos

Hello,

I have a certain Context which contains many Nodes. Part of the nodes contain attributes, part of them contain other nodes and part of them contain attributes as well as other nodes. I would like to iterate the whole context and print it's content. I beleive a recursive methos would be helpfull here. Can someone please help me with that?

Roy

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Start with wdContext.getRootNode().getNodeInfo().iterateChildren() and iterateAttributes().

Former Member
0 Kudos

Hey Pascal,

1. the wdContext doesn't have getRootNode() method.

2. This part I know, the rest is my problem...

Roy

Former Member
0 Kudos

Hi Roy,

Try to extract necessary parts from this code

(hint: recursion is done using pair parseElement / parseNode)

VS

Former Member
0 Kudos

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/javadocs/nw04/sp12... dynpro runtime environment/com/sap/tc/webdynpro/progmodel/api/iwdcontext.html#getrootnode()

As you can see there's even a getRootNodeInfo() which is short for getRootNode().getNodeInfo().

PS. You need to call wdContext.getContext() to get a IWDContext instance.

Former Member
0 Kudos

10x Pascal and Valery, I'll go over your suggestions and get back 2 U...

Roy

Former Member
0 Kudos

Hey,

problem solved. I've decided to use Pascal's method.

Valery: 10X for the source code, I'm keeping it for later, I am sure it will come handy in some other time..

Roy

Answers (0)