how to modify xml tag specific value in java?

后端 未结 3 508
深忆病人
深忆病人 2020-12-10 00:08

i am new to work on xml.i have used an xml file as follows:

 
      - 
      - 
              


        
3条回答
  •  时光说笑
    2020-12-10 00:31

    You are not checking if the value of the node is "wallstreet?" - so it simply changes every first child node.

    String str = child.getFirstChild( ).getNodeValue( );
    if ( "wallstreet?".compareTo( str ) == 0 )
    {
        child.getFirstChild( ).setNodeValue( "WonderWorld" );
        System.out.println( "tag val modified success fuly" );
    }
    

提交回复
热议问题