on 02-01-2007 10:07 AM
Hi
I have a parent node and a child node:
ParentNode
|-->ChildNode
|-->Attribute1
|-->Attribute2
Cardinality of ParentNode is 0..n and is bound to a structure.
The cardinality of the child node is 1..1, singleton = false and not bound to any structure.
So i assume that exactly one instance of the child node is going to be present for every instance of the parent node
In my code where I populate the ParentNode, I also have to set the attributes in the child node for that instance of the parentnode created. I also have not bound the structure to the node programatically. is this necessary?
But when I access the child node to set the attributes, it gives me runtime error message:
You must not access child nodes before the element is bound to a node
What could be wrong?
Thanks for all help in advance
Madhan
IParentNodeElement parent = wdContext.nodeParentNode().createParentNodeElement();
wdContext.nodeParentNode().addElement(parent);
parent.nodeChildNode().currentChildNodeElement().setAttribute1(<value>);
Make sure that ChildNode.selection = 1:1 too.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
Check out this code.
wdContext.node<parentnode>.get<parentnode>element.node<childnode>.get<childnode>element.get<attribute>();
Regards,
Gopi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Madhan,
create element for the parent node then add it.
after adding it try to create a elements for child node.
sample code:
Iprivate<virename>.ipaerntnode obj = wdContext.createParentNode();
wdcontext.nodeParentNode().addelement(obj);
now create child node elemts
Iprivate<virename>.iChildnode obj1 = wdcontext.createChildNode();
wdContext.currentParentNodeElement().childNode().addElement(obj1);
Hope this helps
With Regards
Naidu
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 | |
25 | |
12 | |
9 | |
6 | |
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.