English 中文(简体)
声明无效
原标题:Non-working if statement

我有这一法典:

Node main_node = document.getDocumentElement();
NodeList main_node_list = main_node.getChildNodes();
for( int main_iterator = 0; main_iterator < main_node_list.getLength(); main_iterator++ ) {
    Node child_node = main_node_list.item( main_iterator );
    String child_node_name = child_node.getNodeName();
    if( child_node_name == "#text" ) continue;
    Toast.makeText( context, """ + child_node_name + """, Toast.LENGTH_SHORT ).show();
    if( child_node_name == "library_visual_scenes" ) {
    ...
    }
}

这一点并不明确,但是,如果说的话,在二者之间的Toast中,它表明,儿童——姓名在某个时候完全等于“图书馆——视频_scenes”。 如果声明是真实的,则没有第二次。

第一种情况是,当儿童姓名平等时,实际上已经执行。 我从未见到Toast的“文本”。

孩子们_node_name is a String Object. 比较“强硬”和描述特征的正确方法吗?

我无法了解这里的情况。 如果我把这部法典与我的电脑上的 plain一样操作起来,那么这难道是某些具体的东西吗?

最佳回答

替换

child_node_name == "library_visual_scenes"
child_node_name == "#text"

页: 1

"library_visual_scenes".equals(child_node_name);
"#text".equals(child_node_name);

这正是你们必须比较一下“ j”中的长处,而不是内容。

问题回答

更改以下线路,以使用<代码>当量/代码> 方法:

if( child_node_name.equals("#text") ) continue;

以及

if( child_node_name.equals("library_visual_scenes") ) {




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签