fix XML parser self-destructing when it tries to get child elements belonging to a developer comment

This commit is contained in:
Downforce Agent 2024-08-02 18:40:31 -05:00
parent 64230f5eb4
commit 168e536068

View File

@ -47,12 +47,8 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource; import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.OutputKeys; import javax.xml.transform.OutputKeys;
import org.w3c.dom.Attr;
import org.w3c.dom.Document; import org.w3c.dom.*;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.apache.commons.text.StringEscapeUtils; import org.apache.commons.text.StringEscapeUtils;
@ -353,6 +349,7 @@ public class Rizzo {
ns = ((Element)parent).getChildNodes(); ns = ((Element)parent).getChildNodes();
for (int i = 0; i < ns.getLength(); i++) { for (int i = 0; i < ns.getLength(); i++) {
Node n = ns.item(i); Node n = ns.item(i);
if (n instanceof Comment) continue;
if (n.getNodeName().equals("#text")) continue; if (n.getNodeName().equals("#text")) continue;
if (((Element)n).getAttribute("name").equals(name)) { if (((Element)n).getAttribute("name").equals(name)) {
newParent = (Element)n; newParent = (Element)n;