With FluidXML you can use XPath to select the elements to remove.
$doc = fluidify($doc);
$doc->remove('//*[@id="A12"]');
https://github.com/servo-php/fluidxml
The XPath //*[@id="A12"] means:
- in any point of the document (
//)
- every node (
*)
- with the attribute
id equal to A12 ([@id="A12"]).