this is my code:
Vector v = new Vector();
if(some condition ){ v.addElement(node)}
for(int i =0; i < visize();i++)
{
Node n = (node)v.elementAt(i);
Node parent = n.getParentNode(); // this gives me parent as null although parent exists.
}
Andy Clark <[EMAIL PROTECTED]> wrote:
Gude Reshma wrote:
> I get a set of nodes & store them in a vector. Then i access the
> vector in a for loop & try to retrieve the parent of each node using
> node.getParentNode(); However this gives me null for some nodes, even
> when the parent is existing. How is it possible? How can the parent of
> any node be null??
Document, document fragment, and attribute nodes are defined
to have null parents. (Attribute nodes have an "owner element",
not a "parent".) Also, any node not connected to the tree has
a null parent.
Please provide more information about the types of nodes that
you are storing in your vector. Perhaps a small test program
that shows the problem would be helpful to determine what is
wrong.
--
Andy Clark * [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
