2

New Jenkins versions are using xml version 1.1 for configuration files. I used XMLStarlet to manipulate these files from a Bash script but XMLStarlet doesn't support xml version 1.1

Do you know of any alternative to XMLStarlet?

Pedro
  • 692
  • 8
  • 24
  • 2
    It seems a rather rash decision on the part of Jenkins. A great deal of XML software will never be upgraded to version 1.1, which was generally considered a lame duck. – Michael Kay Dec 05 '18 at 21:51
  • I couldn't agree more with you. – Pedro Dec 06 '18 at 22:17

2 Answers2

2

Since I first posted this question I've found a couple of workarounds valid only if you're not using a xml 1.1 specific feature that is usually the case:

1st- xmlstarlet 2>/dev/null xmlstarlet recognizes that xml 1.1 is unsupported and outputs a warning to STDERR (fd2) that you can see in the console. Redirecting (only) STDERR to dev/null makes the trick.

2nd- removing the xml 1.1 first line declaration in the file. According to the xml standard if the declaration is missing, the file is considered to be xml 1.0. Does a valid XML file require an XML declaration?

Pedro
  • 692
  • 8
  • 24
1

I got the same issue before, in my case I had to install jenkins job config.xml and edit it and then upload it again to Jenkins.

As a workaround to fix this issue I used to replace the version from version='1.1' to version='1.0' and then apply XmlStarlet command and before upload the file I return the version to be version='1.1'

Saleh Ibrahim
  • 57
  • 1
  • 8