Where is the W3C XML Schema for XHTML 1.1?
There is an old W开发者_运维技巧3C recommendation containing an XML schema for XHTML 1.0, and claiming that schema for 1.1 will be forthcoming. Where is the a W3C XML Schema for XHTML 1.1?
Here's the official hosted version:
http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd
The XML schema (XSD) for XHTML 1.1 is modularized into multiple files, thus, for validating you need following files available in a local directory:
http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml11-model-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml11-modules-1.xsd
With those files (and network access) you can validate a XHTML 1.1 file like this:
$ xmllint -noout -schema xhtml11.xsd foo.xml
Without network access you also need following files:
http://www.w3.org/2001/xml.xsd
http://www.w3.org/2009/01/xml.xsd # -> xml_2009_01.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-attribs-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-base-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-bdo-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-blkphras-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-blkpres-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-blkstruct-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-charent-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-csismap-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-datatypes-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-datatypes-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-edit-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-events-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-form-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-framework-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-hypertext-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-image-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-inlphras-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-inlpres-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-inlstruct-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-inlstyle-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-link-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-list-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-meta-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-notations-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-object-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-param-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-param-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-pres-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-ruby-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-script-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-ssismap-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-struct-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-style-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-table-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-target-1.xsd
http://www.w3.org/MarkUp/SCHEMA/xhtml-text-1.xsd
Then adjust the schema locations with something like:
$ sed -i 's@schemaLocation="http://www.w3.org/2009/01/xml.xsd"@schemaLocation="xml_2009_01.xsd"@' *.xsd
$ sed -i 's@schemaLocation="[^"]\+/\([^"]\+\)"@schemaLocation="\1"@' *.xsd
With the resulting files you can locally validate a XHTML 1.1 file like this:
$ xmllint -noout -schema xhtml11.xsd -nonet foo.xml
For browsing, there is the XHTML 1.1 XML Schema Defintion appendix that contains the modules inline.
Edit: XHTML 1.1 XML Schema Definition
http://www.w3.org/TR/2009/PER-xhtml11-20090507/xhtml11_schema.html
精彩评论