Good night Stack Overflow!
Tonight I'm trying to remove the "header" from an XML I've parsed as a string and use replaceAll to remove the following:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
From the string. Since it's going to be concatenated with another XML String, and leaving it would leave two of those.
So I tried:
// getXML already has my XML.
getXML = getXML.replaceAll("<?xml version="1.0" encoding="UTF-8" standalone="no"?>", "");
This fails to compile, due to the "" inside of the String. I then tried with escape sequences:
String headerXMLString = ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>");
getXML = getXML.replaceAll(headerXMLString, "");
This fails as well, While the program itself runs I assume due to the escapes (\) it doesn't delete the string
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
Since the String is technically not the same.
How would one work around this? Any and all help is greatly appreciated.