Index: MessageEmitterAdapter.java =================================================================== --- MessageEmitterAdapter.java (revision 325) +++ MessageEmitterAdapter.java (working copy) @@ -543,6 +543,21 @@ private void message(MessageType type, Exception message, String systemId, int oneBasedLine, int oneBasedColumn, boolean exact) throws SAXException { + if (message instanceof BadAttributeValueException) { + BadAttributeValueException ex = (BadAttributeValueException) message; + Map datatypeErrors = ex.getExceptions(); + for (Map.Entry entry : datatypeErrors.entrySet()) { + DatatypeException dex = entry.getValue(); + if (dex instanceof Html5DatatypeException) { + Html5DatatypeException ex5 = (Html5DatatypeException) dex; + if (ex5.isWarning()) { + type.setSuperType("info"); + type.setSubType("warning"); + type.setPresentationName("Warning"); + } + } + } + } if (loggingOk && (type.getSuperType() == "error") && spec != EmptySpec.THE_INSTANCE @@ -763,7 +778,8 @@ if (i % 2 == 0) { emitStringWithQurlyQuotes(messageTextHandler, segment); } else { - String scrubbed = scrub(segment); + String warning = ex5.isWarning() ? " WARNING " : ""; + String scrubbed = scrub(segment) + warning; messageTextHandler.startCode(); messageTextHandler.characters(scrubbed.toCharArray(), 0, scrubbed.length()); messageTextHandler.endCode(); @@ -1172,4 +1188,4 @@ oneBasedFirstColumn, (oneBasedLastLine == -1) ? -1 : oneBasedLastLine + lineOffset, oneBasedLastColumn, exact); } -} \ No newline at end of file +} Index: types/Schema.java =================================================================== --- types/Schema.java (revision 325) +++ types/Schema.java (working copy) @@ -24,18 +24,10 @@ class Schema extends NonDocumentError { - private final static char[] PRESENTATION_NAME = "Schema Error".toCharArray(); - - @Override - public char[] getPresentationName() { - return PRESENTATION_NAME; - } + public Schema() { + this.presentationName = "Schema Error".toCharArray(); + this.subType = "schema"; + this.flatType = getSuperType() + (getSubType() == null ? "" : " " + getSubType()); + } - /** - * @see nu.validator.messages.types.MessageType#getSubType() - */ - @Override - public String getSubType() { - return "schema"; - } } Index: types/NonDocumentError.java =================================================================== --- types/NonDocumentError.java (revision 325) +++ types/NonDocumentError.java (working copy) @@ -24,16 +24,10 @@ class NonDocumentError extends MessageType { - private final static char[] PRESENTATION_NAME = "Non-Document Error".toCharArray(); - - @Override - public char[] getPresentationName() { - return PRESENTATION_NAME; - } + public NonDocumentError() { + this.presentationName = "Non-Document Error".toCharArray(); + this.superType = "non-document-error"; + this.flatType = getSuperType() + (getSubType() == null ? "" : " " + getSubType()); + } - @Override - public String getSuperType() { - return "non-document-error"; - } - } Index: types/Warning.java =================================================================== --- types/Warning.java (revision 325) +++ types/Warning.java (working copy) @@ -24,18 +24,10 @@ class Warning extends Info { - private final static char[] PRESENTATION_NAME = "Warning".toCharArray(); - - @Override - public char[] getPresentationName() { - return PRESENTATION_NAME; - } + public Warning() { + this.presentationName = "Warning".toCharArray(); + this.subType = "warning"; + this.flatType = getSuperType() + (getSubType() == null ? "" : " " + getSubType()); + } - /** - * @see nu.validator.messages.types.MessageType#getSubType() - */ - @Override - public String getSubType() { - return "warning"; - } } Index: types/MessageType.java =================================================================== --- types/MessageType.java (revision 325) +++ types/MessageType.java (working copy) @@ -40,20 +40,42 @@ public static final MessageType WARNING = new Warning(); - private final String flatType; + public char[] presentationName; + public String superType; + + public String subType; + + public String flatType; + public MessageType() { this.flatType = getSuperType() + (getSubType() == null ? "" : " " + getSubType()); } - public abstract char[] getPresentationName(); - - public abstract String getSuperType(); - + public char[] getPresentationName() { + return presentationName; + } + + public String getSuperType() { + return superType; + } + public String getSubType() { - return null; + return subType; } + public void setSuperType(String sup) { + this.superType = sup; + } + + public void setSubType(String sub) { + this.subType = sub; + } + + public void setPresentationName(String name) { + this.presentationName = name.toCharArray(); + } + /** * Returns the flatType. * Index: types/Fatal.java =================================================================== --- types/Fatal.java (revision 325) +++ types/Fatal.java (working copy) @@ -24,18 +24,10 @@ class Fatal extends Error { - private final static char[] PRESENTATION_NAME = "Fatal Error".toCharArray(); - - @Override - public char[] getPresentationName() { - return PRESENTATION_NAME; - } + public Fatal() { + this.presentationName = "Fatal Error".toCharArray(); + this.subType = "fatal"; + this.flatType = getSuperType() + (getSubType() == null ? "" : " " + getSubType()); + } - /** - * @see nu.validator.messages.types.MessageType#getSubType() - */ - @Override - public String getSubType() { - return "fatal"; - } } Index: types/Io.java =================================================================== --- types/Io.java (revision 325) +++ types/Io.java (working copy) @@ -24,18 +24,10 @@ class Io extends NonDocumentError { - private final static char[] PRESENTATION_NAME = "IO Error".toCharArray(); - - @Override - public char[] getPresentationName() { - return PRESENTATION_NAME; - } + public Io() { + this.presentationName = "IO Error".toCharArray(); + this.subType = "io"; + this.flatType = getSuperType() + (getSubType() == null ? "" : " " + getSubType()); + } - /** - * @see nu.validator.messages.types.MessageType#getSubType() - */ - @Override - public String getSubType() { - return "io"; - } } Index: types/Error.java =================================================================== --- types/Error.java (revision 325) +++ types/Error.java (working copy) @@ -24,16 +24,10 @@ class Error extends MessageType { - private final static char[] PRESENTATION_NAME = "Error".toCharArray(); - - @Override - public char[] getPresentationName() { - return PRESENTATION_NAME; - } + public Error() { + this.presentationName = "Error".toCharArray(); + this.superType = "error"; + this.flatType = getSuperType() + (getSubType() == null ? "" : " " + getSubType()); + } - @Override - public String getSuperType() { - return "error"; - } - } Index: types/Info.java =================================================================== --- types/Info.java (revision 325) +++ types/Info.java (working copy) @@ -24,16 +24,10 @@ class Info extends MessageType { - private final static char[] PRESENTATION_NAME = "Info".toCharArray(); - - @Override - public char[] getPresentationName() { - return PRESENTATION_NAME; - } + public Info() { + this.presentationName = "Info".toCharArray(); + this.superType = "info"; + this.flatType = getSuperType() + (getSubType() == null ? "" : " " + getSubType()); + } - @Override - public String getSuperType() { - return "info"; - } - } Index: types/Internal.java =================================================================== --- types/Internal.java (revision 325) +++ types/Internal.java (working copy) @@ -24,18 +24,10 @@ class Internal extends NonDocumentError { - private final static char[] PRESENTATION_NAME = "Internal Error".toCharArray(); - - @Override - public char[] getPresentationName() { - return PRESENTATION_NAME; - } + public Internal() { + this.presentationName = "Internal Error".toCharArray(); + this.subType = "internal"; + this.flatType = getSuperType() + (getSubType() == null ? "" : " " + getSubType()); + } - /** - * @see nu.validator.messages.types.MessageType#getSubType() - */ - @Override - public String getSubType() { - return "internal"; - } }