Error change values in node of a xml
问题 I need to change several values of an xml, but when I run the line .setText, it shows the java.lang.NullPointerException error and I do not understand why. <?xml version="1.0" encoding="UTF-8"?> <prueba> <reg id="576340"> <dato cant="680" id="1" val="-1" num="" desc="" /> <dato cant="684" id="5" val="-1" num="" desc="" /> <dato cant="1621" id="1" val="-1" num="" desc="Hi" /> <dato cant="1625" id="5" val="-1" num="" desc="Hola" /> </reg> </prueba> This is the code: public static void main