GUIR
12-18-2008, 05:07 AM
Hi,
I am in need of validating a programatically created RSS file. With that I coded the following XSD, but all validators I used say schema is invalid.
How can I confirm its actual validity and what are other ways to validate a RSS file.
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="rss" maxOccurs="1" minOccurs="1">
<xsd:complexType>
<xsd:attribute name="version" type="xsd:string" default="2.0" />
<xsd:element name="channel" maxOccurs="1" minOccurs="1">
<xsd:complexType>
<xsd:element name="title" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="link" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="14"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="description" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="image" minOccurs="0" maxOccurs="1">
<xsd:complexType>
<xsd:element name="title" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="link" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="14"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="url" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="14"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="description" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="width" minOccurs="0" maxOccurs="1" default="88">
<xsd:simpleType>
<xsd:restriction base="xs:integer">
<xsd:maxExclusive value="144"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="height" minOccurs="0" maxOccurs="1" default="31">
<xsd:simpleType>
<xsd:restriction base="xs:integer">
<xsd:maxExclusive value="400"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:complexType>
</xsd:element>
<xsd:element name="category" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="copyright" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="docs" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="generator" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="language" minOccurs="0" maxOccurs="1" default="en-us">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="5"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="lastBuildDate" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="10"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="managingEditor" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="5"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="pubDate" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="10"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="skipDays" minOccurs="0" maxOccurs="1">
<xsd:complexType>
<xsd:element name="day" minOccurs="1" maxOccurs="6">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:complexType>
</xsd:element>
<xsd:element name="skipHours" minOccurs="0" maxOccurs="1">
<xsd:complexType>
<xsd:element name="hour" minOccurs="1" maxOccurs="23">
<xsd:simpleType>
<xsd:restriction base="xsd:integer">
<xsd:maxExclusive value="23"/>
<xsd:minExclusive value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:complexType>
</xsd:element>
<xsd:element name="ttl" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xsd:integer">
<xsd:minExclusive value="1"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="webMaster" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="5"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<!-- Item -->
<xsd:element name="item" maxOccurs="unbounded" minOccurs="1">
<xsd:complexType>
<xsd:element name="title" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="link" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="14"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="description" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="category" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="comments" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:complexType>
</xsd:element>
</xsd:complexType>
</xsd:element>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Thanks and Best Regards
I am in need of validating a programatically created RSS file. With that I coded the following XSD, but all validators I used say schema is invalid.
How can I confirm its actual validity and what are other ways to validate a RSS file.
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="rss" maxOccurs="1" minOccurs="1">
<xsd:complexType>
<xsd:attribute name="version" type="xsd:string" default="2.0" />
<xsd:element name="channel" maxOccurs="1" minOccurs="1">
<xsd:complexType>
<xsd:element name="title" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="link" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="14"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="description" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="image" minOccurs="0" maxOccurs="1">
<xsd:complexType>
<xsd:element name="title" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="link" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="14"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="url" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="14"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="description" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="width" minOccurs="0" maxOccurs="1" default="88">
<xsd:simpleType>
<xsd:restriction base="xs:integer">
<xsd:maxExclusive value="144"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="height" minOccurs="0" maxOccurs="1" default="31">
<xsd:simpleType>
<xsd:restriction base="xs:integer">
<xsd:maxExclusive value="400"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:complexType>
</xsd:element>
<xsd:element name="category" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="copyright" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="docs" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="generator" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="language" minOccurs="0" maxOccurs="1" default="en-us">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="5"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="lastBuildDate" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="10"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="managingEditor" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="5"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="pubDate" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="10"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="skipDays" minOccurs="0" maxOccurs="1">
<xsd:complexType>
<xsd:element name="day" minOccurs="1" maxOccurs="6">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:complexType>
</xsd:element>
<xsd:element name="skipHours" minOccurs="0" maxOccurs="1">
<xsd:complexType>
<xsd:element name="hour" minOccurs="1" maxOccurs="23">
<xsd:simpleType>
<xsd:restriction base="xsd:integer">
<xsd:maxExclusive value="23"/>
<xsd:minExclusive value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:complexType>
</xsd:element>
<xsd:element name="ttl" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xsd:integer">
<xsd:minExclusive value="1"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="webMaster" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="5"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<!-- Item -->
<xsd:element name="item" maxOccurs="unbounded" minOccurs="1">
<xsd:complexType>
<xsd:element name="title" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="link" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="14"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="description" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="category" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="comments" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xs:string">
<xsd:length value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:complexType>
</xsd:element>
</xsd:complexType>
</xsd:element>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Thanks and Best Regards