on 01-17-2006 3:07 PM
Hi guys,
Could you please help me on this one. I need to access value attributes that are under a value node?. I use the following codes and I always have the error "java.lang.NullPointerException ".
1) wdThis.wdGetContext().currentMyValueNodeElement().getMyAttribute();
2) wdContext.currentMyValueNodeElement().getMyAttribute();
Thanks in advance
Franck
Hi,
Have you initialised the node before you try to access the attribute?
If the cardinality of the node is 0..1 or 0..n then you have to manualy initialise it. If the cardinality is 1..1 or 1..n then you shouldn't get the null pointer exception.
Check that and get back to us.
Patrick.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Franck, I'm glad to help.
Make sure that the cardinality of 1..1 is correct for your use case though. This cardinality means that only one 'instance' of your attribute can exist for the node. For instance, if you were going to display a table from that node then with a cardinality of 1..1 your table would have 1 and only 1 row.
Patrick.
HEre is an example where I'm pulling a value from a value attribute where the Node is a table. "Ytdsl" is the actual value attribute name.
// Get the total from the last line of the table
String sx =
wdContext
.nodeChannelList()
.getElementAt((wdContext.nodeChannelList().size() - 1))
.getAttributeValue("Ytdsl")
.toString();
Regards,
Rich Heilman
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 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.