Unicorn Response specification
Presentation
In future versions, we plan to replace this with RDF that could be "mapped"
to any XML format. This RDF will provide classes such as Error
or Column, but as this is quite hard to implement, we chose a
simpler first solution: impose a generic output to each observer.
This output is a XML document conforming to a particular schema, and will probably imply to write a specific output on each observer.
But whatever the choice, the different solutions will provide the same features.
To write this XML schema, we used the document http://esw.w3.org/topic/MarkupValidator/M12N.
This schema should be able to fit any observer needs, but, if not, we hope it will be extensible.
Description of the elements
Observationresponse
The observationresponse element forms the root of a response and contains
the following elements :
- Exactly one
urielement containing the URI of the document validated - An optional
checkedbyelement containing the URI of the observer -
An optional
versionelement containing information on what was checked, such as CSS2.1, XHTML1.0, Links, ... - An optional
dateelement containing the date of the observation -
An optional
passedelement indicating if the document has passed the observation. Its default value is set totrue. - A
resultelement containing all the useful observations.
Result
The result element is the container for all the messages produced during
the observation. It can contain zero or one of the following:
- An
errorselement. - A
warningselement. - A
informationselement.
Errors, warnings and informations
These three elements are built on the same model:
-
An attribute
xml:langindicating the language of the messages -
Zero or one
countelement (errorcount,warningcountorinfocount) containing the total number of errors, warnings, informations. -
Zero or more
listelement (errorlist,warninglistorinfolist), one for each sub-document. See below for more information.
Errorlist, warninglist and infolist
Each list contains can contain:
-
Exactly one
urielement, containing the URI of the sub-document represented by this list -
Zero or one
countelement (errorcount,warningcountorinfocount) containing the number of messages for this sub-document -
Zero or more
errorelement (resp.warning,info)
Error
An error element can contain zero or one of the following:
- A
lineelement: the line in the source code where the error appears - A
columnelement: the column in the source code where the error appears -
A
errortypeelement: can be one of:-
criticalif a critical error appeared (such as "file not found" or "unsupported mime type", ...) -
lexicalif an error during the lexical analysis appeared (such as an unknown token) -
semanticif an error during the semantic analysis appeared (such as a grammar rule mismatch) - ... (other types might be needed)
-
- A
contextelement containing a piece of source code showing where the error appeared
It must also contain at least one message element and can contain several
longmessage element.
These elements will contain descriptions of the error.
Warning
A warning element can contain zero or one of the following:
- A
lineelement: the line in the source code where the error appears. - A
columnelement: the column in the source code where the error appears. - A
levelelement: [0, 1, 2, 3], the higher the more important. - A
contextelement containing a piece of source code showing where the error appeared.
It must also contain at least one message element and can contain several
longmessage element.
These elements will contain descriptions of the warning.
Info
An info element can contain zero or one of the following:
- A
lineelement: the line in the source code where the error appears. - A
columnelement: the column in the source code where the error appears. - A
contextelement containing a piece of source code showing where the error appeared.
It must also contain at least one message element and can contain several
longmessage element.
These elements will contain descriptions of the info.
Long message
A longmessage element can contain one or more of the following:
- Any text data.
- One or more
aelement: link as in html with ahrefattribute. - One or more
imgelement: display picture as in html with asrcand aaltattribute. - One or more
codeelement: use to indicate code as in html.
Full schema
The schema of an observation response can be found at observer-response.xsd.
Sample response document
<?xml version='1.0' encoding="utf-8"?> <observationresponse xmlns="http://www.w3.org/unicorn/observationresponse" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/unicorn/observationresponse http://www.w3.org/QA/Tools/Unicorn/response/observer-response.xsd"> <uri>http://example.org</uri> <checkedby>http://jigsaw.w3.org/css-validator/</checkedby> <version>css2</version> <date>2006-05-22T11:22:54</date> <passed>false</passed> <result> <errors xml:lang="en"> <errorcount>5</errorcount> <errorlist> <uri>http://www.example.org/style.css</uri> <errorcount>3</errorcount> <error> <line>331</line> <column>10</column> <errortype>semantic</errortype> <context>div.citation, div.spoiler</context> <message>The property -moz-border-radius doesn't exist.</message> </error> <error> <line>344</line> <errortype>semantic</errortype> <context>table#navbar</context> <message>The property -moz-border-radius doesn't exist.</message> </error> <error> <line>347</line> <errortype>semantic</errortype> <context>table#navbar td.alt2</context> <message>The property -moz-border-radius-topleft doesn't exist.</message> </error> </errorlist> <errorlist> <uri>http://www.example.org/style2.css</uri> <errorcount>2</errorcount> <error> <line>328</line> <errortype>semantic</errortype> <context>div.citation, div.spoiler</context> <message>The property -moz-border-radius doesn't exist.</message> </error> <error> <line>341</line> <errortype>semantic</errortype> <context>table#navbar</context> <message>The property -moz-border-radius doesn't exist.</message> </error> </errorlist> </errors> <warnings xml:lang="en"> <warningcount>0</warningcount> </warnings> <miscmessages xml:lang="en"> <miscmessagecount>1</miscmessagecount> <miscmessagelist> <uri>http://example.org</uri> <miscmessage> <message>You should also try to validate XHTML</message> <longmessage> CSS works better with valid XHTML. Check the document using the markup-validator (http://validator.w3.org). </longmessage> </miscmessage> </miscmessagelist> </miscmessages> </result> </observationresponse>
