AlekSi / gocov-xml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SXXP0003: Error reported by XML parser: DOCTYPE is disallowed

hallm4 opened this issue · comments

I'm using gocov-xml to convert go coverage to xml format.

go test -tags static -coverprofile coverage.out
gocov convert coverage.out > coverage.json && \
   cat coverage.json | gocov-xml > coverage.xml

I'm then using Jenkins Pipelines to publish this to Jenkins:

publishCoverage adapters: [coberturaAdapter('coverage.xml')], sourceFileResolver: sourceFiles('NEVER_STORE')

In the jenkins.log on the server, we see :

Error on line 2 column 10 of coverage.xml:
  SXXP0003: Error reported by XML parser: DOCTYPE is disallowed when the feature
  "http://apache.org/xml/features/disallow-doctype-decl" set to true.

Looking at the first 2 lines of the coverage.xml we see

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">

I have a feeling this is a security feature of Jenkins - is there a way to suppress generation of the DOCTYPE element, for use when loading into jenkins? Should I strip the DOCTYPE line prior to attempting to publish into jenkins as a workaround?

Thanks,