
Yves Lafon, ylafon@w3.org
XML Protocol Working Group
Web Services Choreography Working Group
XML Schema Patterns for Databinding Working Group
Demonstrate which technologies?
Goals:
Current ways of extracting the information:
Timeline
<?xml version='1.0' encoding="utf-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Body>
<m:cssvalidationresponse
env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"
xmlns:m="http://www.w3.org/2005/07/css-validator">
<m:uri>http://www.w3.org/</m:uri>
<m:checkedby>http://jigsaw.w3.org/css-validator/</m:checkedby>
<m:csslevel>css2</m:csslevel>
<m:date>2006.03.05T06:04:35Z</m:date>
<m:validity>true</m:validity>
<m:result>
<m:errors xml:lang="en">
<m:errorcount>0</m:errorcount>
</m:errors>
<m:warnings xml:lang="en">
<m:warningcount>75</m:warningcount>
<m:warninglist>
<m:uri>http://www.w3.org/StyleSheets/home.css</m:uri>
<m:warning>
<m:line>24</m:line>
<m:level>2</m:level>
<m:message>Redefinition of margin-bottom</m:message>
<m:context>#logo</m:context>
</m:warning>
[..]
</m:warninglist>
</m:warnings>
</m:result>
</m:cssvalidationresponse>
</env:Body>
</env:Envelope>
Easy check with XSL (but can be done in multiple ways):
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:validator="http://www.w3.org/2005/07/css-validator"
version="1.0">
<xsl:output
method="text"
/>
<xsl:strip-space elements="*" />
<xsl:template match="/|soap:Envelope|soap:Body|validator:cssvalidationresponse">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="validator:validity">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="*">
</xsl:template>
</xsl:stylesheet>
Sample UNIX shell script
#!/bin/sh
# return 0, both validation OK
# 1, one of them is not valid
# 2, URI issue
if [ ! $# -eq 1 ]; then
echo "Usage: $0 URI"
exit 2
fi
# construct URI according to the validator definition at
# http://qa-dev.w3.org/wmvs/HEAD/docs/api
# first encore the URI to check in form-urlencoded mode
uri=`echo $1 | sed 's/:/%3A/g' | sed 's|/|%2F|g' | sed 's,\?,%3F,g'`
# construct the URI
requri="http://qa-dev.w3.org/wmvs/HEAD/check?uri=${uri}&output=soap12"
tmpfile=/tmp/val-$$
# do the request on the markup validator
wget -o /dev/null -O $tmpfile $requri
# check for mustUnderstand (to be a valid SOAP processor)
grep "mustUnderstand=\"true\"" $tmpfile > /dev/null
if [ $? -eq 0 ]; then
echo "a mustUnderstand - unable to process"
exit 2
fi
# use XSLT to extract the "validity" part of the output
markupvalid=`xsltproc ismarkupok.xsl $tmpfile`
# and output the retult
if [ $markupvalid = "true" ]; then
echo "Markup OK for $1"
else
echo "Bad Markup for $1"
rm $tmpfile
exit 1
fi
# construct now the CSS Validator request
requri="http://jigsaw.w3.org/css-validator/validator?uri=${uri}&output=soap12"
# do the request on the CSS validator
wget -o /dev/null -O $tmpfile $requri
# check for mustUnderstand (to be a valid SOAP processor)
grep "mustUnderstand=\"true\"" $tmpfile > /dev/null
if [ $? -eq 0 ]; then
echo "a mustUnderstand - unable to process"
exit 2
fi
cssvalid=`xsltproc iscssok.xsl $tmpfile`
# and output the retult
if [ $cssvalid = "true" ]; then
echo "CSS OK for $1"
else
echo "Bad CSS for $1"
rm $tmpfile
exit 1
fi
echo "CONGRATULATIONS $1 is Valid!"
rm $tmpfile
exit 0