<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

	<xsd:element name="anti-samy-rules">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="include" type="Include" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:element name="directives" type="Directives"/>
				<xsd:element name="common-regexps" type="CommonRegexps"/>
				<xsd:element name="common-attributes" type="AttributeList"/>
				<xsd:element name="global-tag-attributes" type="AttributeList"/>
				<xsd:element name="dynamic-tag-attributes" type="AttributeList" minOccurs="0"/>
				<xsd:element name="tags-to-encode" type="TagsToEncodeList" minOccurs="0"/>
				<xsd:element name="tag-rules" type="TagRules"/>
				<xsd:element name="css-rules" type="CSSRules"/>
				<xsd:element name="allowed-empty-tags" type="LiteralListTag" minOccurs="0"/>
				<xsd:element name="require-closing-tags" type="LiteralListTag" minOccurs="0"/>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:complexType name="Include">
		<xsd:attribute name="href" use="required" type="xsd:string"/>
	</xsd:complexType>

	<xsd:complexType name="Directives">
		<xsd:sequence maxOccurs="unbounded">
			<xsd:element name="directive" type="Directive" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="Directive">
		<xsd:attribute name="name" use="required"/>
		<xsd:attribute name="value" use="required"/>
	</xsd:complexType>

	<xsd:complexType name="CommonRegexps">
		<xsd:sequence maxOccurs="unbounded">
			<xsd:element name="regexp" type="RegExp" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="AttributeList">
		<xsd:sequence maxOccurs="unbounded">
			<xsd:element name="attribute" type="Attribute" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="TagsToEncodeList">
		<xsd:sequence maxOccurs="unbounded">
			<xsd:element name="tag" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="TagRules">
		<xsd:sequence maxOccurs="unbounded">
			<xsd:element name="tag" type="Tag" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="Tag">
		<xsd:sequence maxOccurs="unbounded">
			<xsd:element name="attribute" type="Attribute" minOccurs="0" />
		</xsd:sequence>
		<xsd:attribute name="name" use="required"/>
		<xsd:attribute name="action" use="required"/>
	</xsd:complexType>

    <xsd:complexType name="LiteralListTag">
        <xsd:sequence>
            <xsd:element name="literal-list" type="LiteralList" minOccurs="0"/>
        </xsd:sequence>
    </xsd:complexType>

	<xsd:complexType name="Attribute">
		<xsd:sequence>
			<xsd:element name="regexp-list" type="RegexpList" minOccurs="0"/>
			<xsd:element name="literal-list" type="LiteralList" minOccurs="0"/>
		</xsd:sequence>
		<xsd:attribute name="name" use="required"/>
		<xsd:attribute name="description"/>
		<xsd:attribute name="onInvalid"/>
	</xsd:complexType>

	<xsd:complexType name="RegexpList">
		<xsd:sequence maxOccurs="unbounded">
			<xsd:element name="regexp" type="RegExp" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="RegExp">
		<xsd:attribute name="name" type="xsd:string"/>
		<xsd:attribute name="value" type="xsd:string"/>
	</xsd:complexType>

	<xsd:complexType name="LiteralList">
		<xsd:sequence maxOccurs="unbounded">
			<xsd:element name="literal" type="Literal" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="Literal">
		<xsd:attribute name="value" type="xsd:string"/>
	</xsd:complexType>

	<xsd:complexType name="CSSRules">
		<xsd:sequence maxOccurs="unbounded">
			<xsd:element name="property" type="Property" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="Property">
		<xsd:sequence>
			<xsd:element name="category-list" type="CategoryList" minOccurs="0"/>
			<xsd:element name="literal-list" type="LiteralList" minOccurs="0"/>
			<xsd:element name="regexp-list" type="RegexpList" minOccurs="0"/>
			<xsd:element name="shorthand-list" type="ShorthandList" minOccurs="0"/>
		</xsd:sequence>
		<xsd:attribute name="name" type="xsd:string" use="required"/>
		<xsd:attribute name="default" type="xsd:string"/>
		<xsd:attribute name="description" type="xsd:string"/>
	</xsd:complexType>

	<xsd:complexType name="ShorthandList">
		<xsd:sequence maxOccurs="unbounded">
			<xsd:element name="shorthand" type="Shorthand" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="Shorthand">
		<xsd:attribute name="name" type="xsd:string" use="required"/>
	</xsd:complexType>

	<xsd:complexType name="CategoryList">
		<xsd:sequence maxOccurs="unbounded">
			<xsd:element name="category" type="Category" minOccurs="0"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:complexType name="Category">
		<xsd:attribute name="value" type="xsd:string" use="required"/>
	</xsd:complexType>

	<xsd:complexType name="Entity">
		<xsd:attribute name="name" type="xsd:string" use="required"/>
		<xsd:attribute name="cdata" type="xsd:string" use="required"/>
	</xsd:complexType>
</xsd:schema>
