Węzeł Casting do elementu dający ClassCastException

tutaj n2 jest moją listą węzłów i chcę tylko zobaczyć pierwszy węzeł potomny mojego elementu głównego

public void ClickMe(View view){


    Node rootElement=n2.item(0);
    NodeList child=rootElement.getChildNodes();

    Node first=child.item(0);
    //ClassCastException error is coming whenever i am casting first to Element.

    Element nm=(Element)first;

    Option q= getOption(nm,first);
    Log.i(TAG,"the name is was talking about is : "+ q.getName());
}

to co mówi Logcat

07-31 20:32:38.376: E/AndroidRuntime(2950): Caused by: java.lang.ClassCastException: org.apache.harmony.xml.dom.TextImpl cannot be cast to org.w3c.dom.Element

questionAnswers(2)

yourAnswerToTheQuestion