Validierung für ATOM & RSS (habe wirklich keine DTDs gefunden :-)

git-svn-id: svn://svn.c3d2.de/c3d2-web/trunk@488 31f61c52-7bfb-0310-b897-fc00f8a278f0
This commit is contained in:
astro 2006-07-28 01:43:46 +00:00
parent e3fb265348
commit 6c95011168
3 changed files with 381 additions and 3 deletions

View File

@ -5,7 +5,10 @@ PFLAGS=--catalogs --stringparam baseurl $(BASEURL)
BASEURL=""
# XML-Validator
VALIDATOR=xmllint
VFLAGS=--noout --valid --catalogs
# VALIDATOR-Flags für Eingabe-XML (meist c3d2web)
VFLAGS_IN=--noout --valid --catalogs
# VALIDATOR-Flags für Ausgabe-XML (xhtml, rss, atom, ...)
VFLAGS_OUT=$(VFLAGS_IN)
SGML_CATALOG_FILES=$(XML_CATALOG)
export SGML_CATALOG_FILES
# Downloadmanager (Alternativ: curl, fetch):
@ -56,9 +59,9 @@ CLEAN=$(CONTENT) $(NEWSFILES) $(WWW_CCC_DE_UPDATES) $(DS_PAGES)
NOVALID_IGNORE:=false
define xml_process
$(VALIDATOR) $(VFLAGS) $<
$(VALIDATOR) $(VFLAGS_IN) $<
$(PROCESSOR) $(PFLAGS) -o $@ $(STYLE) $<
$(VALIDATOR) $(VFLAGS) $@ || $(NOVALID_IGNORE) || \
$(VALIDATOR) $(VFLAGS_OUT) $@ || $(NOVALID_IGNORE) || \
{ touch -m -t 197001010000 Makefile $@ ; exit 1 ; }
endef
@ -76,8 +79,10 @@ export: www
build/news.html: $(WWW_CCC_DE_UPDATES)
build/news-rss.xml : STYLE=xsl/rss.xsl
build/news-rss.xml : NOVALID_IGNORE:=true
build/news-rss.xml : VFLAGS_OUT=--noout --schema xsd/rss20.xsd
build/news-atom.xml : STYLE=xsl/atom.xsl
build/news-atom.xml : NOVALID_IGNORE:=true
build/news-atom.xml : VFLAGS_OUT=--noout --schema xsd/atom031.xsd
#.INTERMEDIATE: news.xml
news.xml: $(NEWSITEMS)

199
xsd/atom031.xsd Normal file
View File

@ -0,0 +1,199 @@
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="http://purl.org/atom/ns#" elementFormDefault="qualified" attributeFormDefault="unqualified"
xmlns:atom="http://purl.org/atom/ns#" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:documentation>
This version of the Atom API schema is based on version 0.3 of the Atom API and format specifications,
found here http://www.ietf.org/internet-drafts/draft-ietf-atompub-protocol-00.txt
and here http://www.ietf.org/internet-drafts/draft-ietf-atompub-format-00.txt.
</xs:documentation>
</xs:annotation>
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/03/xml.xsd" />
<xs:element name="feed" type="atom:feedType">
<xs:annotation>
<xs:documentation>
The Atom feed is defined in section 4 of the format spec.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="feedinfoType">
<xs:choice maxOccurs="unbounded">
<xs:element name="title" type="atom:contentType" />
<xs:element name="author" type="atom:authorType" />
<xs:element name="contributor" type="atom:authorType" />
<xs:element name="tagline" type="atom:contentType" />
<xs:element name="link" type="atom:linkType" />
<xs:element name="id" type="atom:uriType" />
<xs:element name="generator" type="atom:generatorType" />
<xs:element name="copyright" type="atom:contentType" />
<xs:element name="info" type="atom:contentType" />
<xs:element name="modified" type="atom:dateTimeType" />
</xs:choice>
<xs:attributeGroup ref="atom:commonAttributes"/>
</xs:complexType>
<xs:complexType name="feedType">
<xs:sequence>
<xs:element name="feedinfo" type="atom:feedinfoType" />
<xs:element name="entry" type="atom:entryType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="version" type="atom:versionType" use="required" />
<xs:attributeGroup ref="atom:commonAttributes"/>
</xs:complexType>
<xs:element name="entry" type="atom:entryType">
<xs:annotation>
<xs:documentation>
The Atom feed is defined in section 4.13 of the format spec.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="entryType">
<xs:choice maxOccurs="unbounded">
<xs:element name="title" type="atom:contentType" />
<xs:element name="author" type="atom:authorType" />
<xs:element name="id" type="atom:stringType" />
<xs:element name="modified" type="atom:dateTimeType" />
<xs:element name="issued" type="atom:dateTimeType" />
<xs:element name="created" type="atom:dateTimeType" />
<xs:element name="summary" type="atom:contentType" />
<xs:element name="generator" type="atom:generatorType" />
<xs:element name="link" type="atom:linkType" />
<xs:element name="contributor" type="atom:authorType" />
<xs:element name="content" type="atom:contentType" />
</xs:choice>
<xs:attribute name="version" type="atom:versionType" use="required" />
<xs:attributeGroup ref="atom:commonAttributes"/>
</xs:complexType>
<xs:complexType name="contentType" mixed="true">
<xs:annotation>
<xs:documentation>
The Atom content construct is defined in section 3.1 of the format spec.
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="type" use="optional" default="text/plain" />
<xs:attribute name="mode" use="optional" default="xml">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="xml" />
<xs:enumeration value="escaped" />
<xs:enumeration value="base64" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attributeGroup ref="atom:commonAttributes"/>
</xs:complexType>
<xs:complexType name="authorType">
<xs:annotation>
<xs:documentation>
The Atom person construct is defined in section 3.2 of the format spec.
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="name" type="atom:stringType" />
<xs:element name="url" type="atom:uriType" minOccurs="0" maxOccurs="1" />
<xs:element name="email" type="atom:emailType" minOccurs="0" maxOccurs="1" />
</xs:sequence>
<xs:attributeGroup ref="atom:commonAttributes"/>
</xs:complexType>
<xs:complexType name="linkType">
<xs:annotation>
<xs:documentation>
The Atom link construct is defined in section 3.4 of the format spec.
</xs:documentation>
</xs:annotation>
<xs:attribute name="rel" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="alternate" />
<xs:enumeration value="start" />
<xs:enumeration value="next" />
<xs:enumeration value="prev" />
<xs:enumeration value="service.edit" />
<xs:enumeration value="service.post" />
<xs:enumeration value="service.feed" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="type" use="required" type="xs:string" />
<xs:attribute name="href" use="required" type="xs:anyURI" />
<xs:attribute name="hreflang" use="optional" type="xs:NMTOKEN" />
<xs:attribute name="title" use="optional" type="xs:string" />
<xs:attributeGroup ref="atom:commonAttributes"/>
</xs:complexType>
<xs:complexType name="generatorType">
<xs:annotation>
<xs:documentation>
The Atom generator element is defined in section 4.9 of the format spec.
</xs:documentation>
</xs:annotation>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="url" use="optional" type="xs:anyURI" />
<xs:attribute name="version" use="optional" type="atom:versionType" />
<xs:attributeGroup ref="atom:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="uriType">
<xs:simpleContent>
<xs:extension base="xs:anyURI">
<xs:attributeGroup ref="atom:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="stringType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attributeGroup ref="atom:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="dateTimeType">
<xs:simpleContent>
<xs:extension base="atom:iso8601dateTime">
<xs:attributeGroup ref="atom:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="iso8601dateTime">
<xs:annotation>
<xs:documentation>
The Atom date construct is defined in section 3.3 of the format spec.
</xs:documentation>
</xs:annotation>
<xs:union memberTypes="xs:dateTime xs:date xs:gYearMonth xs:gYear"/>
</xs:simpleType>
<xs:simpleType name="versionType">
<xs:annotation>
<xs:documentation>
General description for a version number.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:normalizedString">
<xs:pattern value="\d+\.\d+" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="emailType">
<xs:simpleContent>
<xs:extension base="atom:emailSimpleType">
<xs:attributeGroup ref="atom:commonAttributes"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="emailSimpleType">
<xs:annotation>
<xs:documentation>
Schema definition for an email address.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:normalizedString">
<xs:pattern value="\w+@(\w+\.)+\w+" />
</xs:restriction>
</xs:simpleType>
<xs:attributeGroup name="commonAttributes">
<xs:attribute ref="xml:base" />
<xs:attribute ref="xml:lang" />
</xs:attributeGroup>
</xs:schema>

174
xsd/rss20.xsd Normal file
View File

@ -0,0 +1,174 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation>
XML Schema for 2.0 by Randy Charles Morin
</xs:documentation>
<xs:documentation>
I wrote this with a little help from Jorgen Thelin's similar XML schema.
This schema is more strict, by intention.
</xs:documentation>
</xs:annotation>
<xs:element name="rss" type="rssType">
<xs:annotation>
<xs:documentation>Top level element is rss</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="rssType">
<xs:sequence>
<xs:element name="channel" type="channelType"/>
<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="version" type="xs:decimal" use="required" fixed="2.0"/>
<xs:anyAttribute namespace="##any"/>
</xs:complexType>
<xs:complexType name="channelType">
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="link" type="xs:anyURI"/>
<xs:element name="description" type="xs:string"/>
<xs:element name="language" type="xs:language" minOccurs="0"/>
<xs:element name="copyright" type="xs:string" minOccurs="0"/>
<xs:element name="managingEditor" type="emailType" minOccurs="0"/>
<xs:element name="webMaster" type="emailType" minOccurs="0"/>
<xs:element name="pubDate" type="rfc822Type" minOccurs="0"/>
<xs:element name="lastBuildDate" type="rfc822Type" minOccurs="0"/>
<xs:element name="category" type="categoryType" minOccurs="0"/>
<xs:element name="generator" type="xs:string" minOccurs="0"/>
<xs:element name="docs" type="xs:anyURI" minOccurs="0"/>
<xs:element name="cloud" type="cloudType" minOccurs="0"/>
<xs:element name="ttl" type="xs:nonNegativeInteger" minOccurs="0"/>
<xs:element name="image" type="imageType" minOccurs="0"/>
<xs:element name="textInput" type="textInputType" minOccurs="0"/>
<xs:element name="skipHours" type="skipHoursType" minOccurs="0"/>
<xs:element name="skipDays" type="skipDaysType" minOccurs="0"/>
<xs:element name="item" type="itemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:anyAttribute namespace="##any"/>
</xs:complexType>
<xs:complexType name="itemType">
<xs:sequence>
<xs:element name="title" type="xs:string" minOccurs="0"/>
<xs:element name="description" type="xs:string" minOccurs="0"/>
<xs:element name="link" type="xs:anyURI" minOccurs="0"/>
<xs:element name="author" type="emailType" minOccurs="0"/>
<xs:element name="category" type="categoryType" minOccurs="0"/>
<xs:element name="comments" type="xs:anyURI" minOccurs="0"/>
<xs:element name="enclosure" type="enclosureType" minOccurs="0"/>
<xs:element name="guid" type="guidType" minOccurs="0"/>
<xs:element name="pubDate" type="rfc822Type" minOccurs="0"/>
<xs:element name="source" type="sourceType" minOccurs="0"/>
<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="sourceType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="url" type="xs:anyURI"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="guidType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="isPermaLink" type="xs:boolean" use="optional" default="true"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="enclosureType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="url" type="xs:anyURI" use="required"/>
<xs:attribute name="length" type="xs:nonNegativeInteger" use="required"/>
<xs:attribute name="type" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="skipDaysType">
<xs:sequence>
<xs:element name="day" minOccurs="0" maxOccurs="7">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Monday"/>
<xs:enumeration value="Tuesday"/>
<xs:enumeration value="Wednesday"/>
<xs:enumeration value="Thursday"/>
<xs:enumeration value="Friday"/>
<xs:enumeration value="Saturday"/>
<xs:enumeration value="Sunday"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="skipHoursType">
<xs:sequence>
<xs:element name="hour" minOccurs="0" maxOccurs="24">
<xs:simpleType>
<xs:restriction base="xs:nonNegativeInteger">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="23"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="emailType">
<xs:restriction base="xs:string">
<xs:pattern value="([a-zA-Z0-9_\-])([a-zA-Z0-9_\-\.]*)@(\[((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}|((([a-zA-Z0-9\-]+)\.)+))([a-zA-Z]{2,}|(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\])"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="rfc822Type">
<xs:restriction base="xs:string">
<xs:pattern value="(((Mon)|(Tue)|(Wed)|(Thu)|(Fri)|(Sat)|(Sun)), *)?\d\d? +((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec)) +\d\d(\d\d)? +\d\d:\d\d(:\d\d)? +(([+\-]?\d\d\d\d)|(UT)|(GMT)|(EST)|(EDT)|(CST)|(CDT)|(MST)|(MDT)|(PST)|(PDT)|\w)"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="categoryType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="domain" type="xs:string" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="cloudType">
<xs:attribute name="domain" type="xs:string" use="required"/>
<xs:attribute name="port" type="xs:positiveInteger" use="required"/>
<xs:attribute name="path" type="xs:string" use="required"/>
<xs:attribute name="registerProcedure" type="xs:string" use="required"/>
<xs:attribute name="protocol" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="imageType">
<xs:all>
<xs:element name="url" type="xs:anyURI"/>
<xs:element name="title" type="xs:string"/>
<xs:element name="link" type="xs:anyURI"/>
<xs:element name="width" default="88" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:maxExclusive value="400"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="height" default="31" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
<xs:maxExclusive value="144"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="description" type="xs:string" minOccurs="0"/>
</xs:all>
</xs:complexType>
<xs:complexType name="textInputType">
<xs:all>
<xs:element name="title" type="xs:string"/>
<xs:element name="description" type="xs:string"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="link" type="xs:anyURI"/>
</xs:all>
</xs:complexType>
</xs:schema>