on 11-30-2006 9:31 AM
Hi all,
how can I copy an element and its subnode elements into another element considering that I cannot use WDCopyService.copyElements neither WDCopyService.copySubtree?
thanks
Stefano
wdContext.nodeFrom().moveFirst();
do {
wdContext.nodeTo().add(
wdContext.nodeTo().createElementTo()
);
wdContext.nodeTo().moveLast();
wdContext.currentToElement().setATTR(
wdContext.currentFromElement().getATTR()
);
.....
}while( wdContext.nodeFrom().moveNext() != null );
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, I've solved using iteration and then WDCopy copycorresponding...
many thanks
Stefano
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Traverse through Parent Node.
Copy elements of parent node
For each element of parent node traverse throgh child node and copy elements.
wdContext.node<ParentNode>().moveFirst();
do
{
IPrivate<ViewName>.I<ParentTargetNode>Element parentElement=
wdContext.node<ParentTargetNode>().create<ParentTargetNode>Elemen();
wdContext.node<ParentTargetNode>().addElement(parentElement);
wdContext.node<ParentTargetNode>().moveLast();
do
{
IPrivate<viewname>.I<ChildTargetNode>Element ChildElement=
wdContext.node<ChildTargetNode>().create<ChildTargetNode>Element();
wdContext.node<ChildTargetNode>().addElement(ChildElement);
ChildElement.set<attrname>(wdContext.current<ChildNode>Element().get<attrname>());
//
}while(wdContext.node<ChildNode>().moveNext()!=null);
}while(wdContext.node<ParentNode>().moveNext()!=null);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If u wanna copy so, i think u've to loop thru the node and set the values manually:
for(int i = 0; i<nodeSource().size(); i++)
{
... wdContext.nodeDest().addElement(i, wdContext.nodeDest().createElement());
... wdContext.nodeDest().getDestElementAt(i).setAtt(wdContext.nodeSource().getSourceElementAt(i).getAtt());
}
// same can be followed to sub nodes also
Regards,
Aparna .P
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.