I am trying to parse an XML file and run this error:
org.xml.sax.SAXParseException: Content is not allowed in prolog
I saw other posts in SO, but my XML document looks fine - no extra characters or spaces before the XML declaration.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
<coverage branch-rate="0.24074074074074073" branches-covered="39" branches-valid="162" complexity="0" line-rate="0.3485915492957746" lines-covered="198" lines-valid="568" timestamp="1396622452625" version="0.2.6">
Below is the relevant part of the script (Groovy 1.8.9):
def coveragedata = new XmlSlurper(false,false).parseText(coverageFile)
Thanks for the help.
source
share