程序中的n2代表NodeList,我只想查看根元素中的第一個子節(jié)點(diǎn)。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());
}但是 logcat報出錯誤12-20 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請問這是怎么回事啊?
查看根元素中的節(jié)點(diǎn)報出ClassCastException錯誤
慕田峪7331174
2019-03-20 18:15:41