You need to remove the corresponding node, in your code you remove the node from firstchild, which seems to be wrong.
And write your changes to the file.
if (title.equals(songTitle) && artist.equals(songArtist) && genre.equals(songGenre) ) { node.getParentNode().removeChild(node); }
// write back to the xml file
TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(new File(filepath)); transformer.transform(source, result);
source share