on 12-11-2006 9:38 PM
I need to know how one can check whether if a node is empty. I have five attributes in the node. But instead of checking each element, i just want to check if all the attributes are empty are not.
Any help will be appreciated.
Thanks
Nahman
Hi there,
> I need to know how one can check whether if a node is
> empty.
- You can check if a node has elements by checking size(). If size = 0, node is empty i.e it has no elements
I have five attributes in the node. But
> instead of checking each element, i just want to
> check if all the attributes are empty are not.
If the current element exists, and you need to check whether the attribute in that element is null or not, then you need to know the attribute name. If there are too many attributes, you can consider putting all of them in an array and then iterating through the array with getAttributeValue(Arrayelement), to get each value and then checking that for null.
Regards,
LM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nahman ,
If you want to check only whether node is null then you can do that as mentioned above.
If you want to check whether the attributes are null or not then
for(int i=0;i<wdContext.nodeXXX().size;i++)
{
IPrivate<ViewName>.IXXXElement ele=(IPrivate<ViewName>.IXXXElement)wdContext.nodeXXX().getElementAt(i);
if(null !=ele.getAttributeValue("<<AttributeName>>") )
{
//
}
else
if(ele.getAttributeValue("<<AttributeName>>") .trim().equals(""))
{
//
}
}
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
try this
if(wdContext.nodeMyNode()!=null && wdContext.nodeMyNode().size()!=0)
{
}
Ashutosh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
79 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
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.