on 07-25-2005 8:57 PM
I've search the forum, but haven't found anything to address this issue.
I have a context of
NodeA
|-- NodeB
| |-- ValueA
| |-- ValueB
| |-- ValueC
|--ValueD
|--ValueE
I have 1-N of NodeA with it containing 1-N NodeB.
I'm trying to prepopulate the context on startup but can't get NodeB inserted into NodeA. I.e. my code looks like this
wdContext.nodeNodeA().invalidate();
for (int k = 0; k < some_info.length; k++) {
INodeAElement nodeA = wdContext.createNodeAElement();
nodeA.setValueD((String) some_info[k][0]);
nodeA.setValueE((String) some_info[k][1]);
String[][] outStrs = (String[][]) some_info[k][2];
INodeBElement nodeB = wdContext.createNodeBElement();
for (int j = 0; j < outStrs.length; j++) {
nodeB.setValueA(outStrs[j][0]);
nodeB.setValueB(outStrs[j][1]);
nodeB.setValueC(outStrs[j][2]);
}
wdContext.nodeNodeA().addElement(nodeA);
}
How do I get the 1-N nodes of NodeB associated with NodeA?
Any help is appreciated.
Lori
Is NodeB a singleton or a non-singleton?
If it is a non-singleton, every element of NodeA has its own instance of a NodeB which can be accessed using
NodeAElement a = ...;
NodeBElement b = a.nodeB().createNodeBElement();
a.nodeB().addElement(b);
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello Lori,
i think u want to add some child node elements inside a parent node element. similarlly like one school inside which there are many children.
now create the parent element using this code:
IPrivateView.IAElement pele = wdContext.nodeA().createAElement(); // instead of wdContext.createAElement();
now to add a child node element inside this parent element:
IPrivateView.IBElement cele = pele.nodeB().createBElement();
regards,
Piyush.
Hi Lori
Here is the example
IPrivateCommentsView.INode_AElement nodeA = null;
nodeA = wdContext.nodeNode_A().createNode_AElement();
wdContext.nodeNode_A().addElement(nodeA);
IPrivateCommentsView.INode_BElement nodeB = wdContext.nodeNode_A().nodeNode_B().createNode_BElement();
wdContext.nodeNode_B().addElement(nodeB);
nodeB.setAtt1("xyz");
nodeB.setAtt2("ABC");
nodeA.setAtt_A("Node A");
You can loop the above code for n times. Each time you create a node A inside the loop create a node B after Node A in the loop
Regards
NagaKishore V
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.