It's quite hard to make a negative check for a DTD ID. That's a broader problem. But for now, we could make it easier by treating missing public ID as "". (This applies to values in general I guess.)
For instance:
<when> <xmlfile matches="//*[local-name()='jboss-app']" in="jboss-app.xml" as="have-jboss-app-root"/> <xmlfile from="have-jboss-app-root" public-id=".*(?!\QJBoss.+DTD Java EE.+5\E).*"/> </when>
This won't pass for XML files that don't have DOCTYPE or PUBLIC id.
See:
XmlFileDtdValidator @Override public boolean isValid(GraphRewrite event,EvaluationContext context, XmlFileModel model) { if (( publicId != null && !publicId.isEmpty() ) || systemId!=null) { DoctypeMetaModel doctype = model.getDoctype(); if (doctype == null ) { return false; } if(publicId != null && ( (doctype.getPublicId() == null) || !doctype.getPublicId().matches(publicId))) { return false; } if(systemId != null && ( (doctype.getSystemId() == null) || !doctype.getSystemId().matches(systemId))) { return false; } } return true; }