0

I'm doing a simple Java DOM app for car renting. I have a <car> tag that contains <id> tag, I'm trying to make a method that deletes the <car> tag by specifying the value of the <id> tag. I've tried thinking of a solution and looked at similar questions but haven't figured it out. Here's structure of my XML document:

<parking>
<car>
    <id>1</id>
</car>
<car>
    <id>2</id>
</car>
<car>
    <id>3</id>
</car>
<car>
    <id>4</id>
</car></parking>
  • Use XPath to select the car by it's id `/parking/car[id=3]` https://stackoverflow.com/questions/6538883/java-how-to-locate-an-element-via-xpath-string-on-org-w3c-dom-document – Mads Hansen Mar 19 '22 at 20:18
  • I've tried different stuff, here's the version of my method that seems closest to truth, but doesn't work https://pastebin.com/UmEjTcUM Could you fix it please? I feel like I'm close to figuring it out – IaroslavRiger Mar 20 '22 at 08:00

0 Answers0