public class W3CValidator extends Object
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
...
</env:Envelope>
According to W3C Markup Validation Service Request Format documentation:
A SOAP response for the validation of a document (invalid) will look like this:
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Body>
<m:markupvalidationresponse
env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"
xmlns:m="http://www.w3.org/2005/10/markup-validator">
<m:uri>http://qa-dev.w3.org/wmvs/HEAD/dev/tests/xhtml1-bogus-element.html</m:uri>
<m:checkedby>http://validator.w3.org/</m:checkedby>
<m:doctype>-//W3C//DTD XHTML 1.0 Transitional//EN</m:doctype>
<m:charset>utf-8</m:charset>
<m:validity>false</m:validity>
<m:errors>
<m:errorcount>1</m:errorcount>
<m:errorlist>
<m:error>
<m:line>13</m:line>
<m:col>6</m:col>
<m:source><![CDATA[
<foo<strong title="Position where error was detected.">></strong>This phrase is enclosed in a bogus FOO element.</foo>
]]>
</m:source>
<m:explanation>
<![CDATA[
<p> ... </p<p>
]]>
</m:explanation>
<m:messageid>76</m:messageid>
<m:message>element "foo" undefined</m:message>
</m:error>
</m:errorlist>
</m:errors>
<m:warnings>
<m:warningcount>0</m:warningcount>
<m:warninglist>
...
</m:warninglist>
</m:warnings>
</m:markupvalidationresponse>
</env:Body>
</env:Envelope>
the structure of this W3CValidator class is aligned to this format| Modifier and Type | Class and Description |
|---|---|
static class |
W3CValidator.Body
structure for the Body node of the message
{@code
|
| Modifier and Type | Field and Description |
|---|---|
W3CValidator.Body |
body
field that holds the structure for the Body node of the message
{@code
|
static boolean |
debug
set to true if Logging should be enabled
|
protected static Logger |
LOGGER
Logging may be enabled by setting debug to true
|
static String |
url
the URL of the official W3C Markup Validation service
if you'd like to run the tests against your own installation you might want to modify this
|
| Constructor and Description |
|---|
W3CValidator() |
| Modifier and Type | Method and Description |
|---|---|
static W3CValidator |
check(String html)
create a W3CValidator result for the default url http://validator.w3.org/check with the given html
|
static W3CValidator |
check(String url,
String html)
create a W3CValidator result for the given url with the given html
|
public static boolean debug
protected static Logger LOGGER
public static String url
public W3CValidator.Body body
<env:Body>
...
</env:Body>
public static W3CValidator check(String html) throws JAXBException
html - - the html code to be checkedJAXBException - if there is something wrong with the response message so that it
can not be unmarshalledpublic static W3CValidator check(String url, String html) throws JAXBException
url - - the url of the validator e.g. "http://validator.w3.org/check"html - - the html code to be checkedJAXBException - if there is something wrong with the response message so that it
can not be unmarshalledCopyright © 2016. All rights reserved.