<?xml version="1.0" encoding="UTF-8"?>
<grammar ns="http://www.w3.org/2000/svg" xml:lang="en"
         xmlns="http://relaxng.org/ns/structure/1.0"
         xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

  <a:documentation>
    SVG 1.1 Basic Structure Module
    file: svg-basic-structure.rng

    This is SVG, a language for describing two-dimensional graphics in XML.
    Copyright 2001, 2002 W3C (MIT, INRIA, Keio), All Rights Reserved.

    $Id: svg-basic-structure.rng,v 1.1 2003/07/15 07:11:10 dean Exp $
  </a:documentation>

  <a:documentation>
    Basic Structure

        svg, g, defs, desc, title, metadata, use

    This module declares the major structural elements and their attributes.
  </a:documentation>

<!-- move to the main schema file
  <start>
    <a:documentation>
      The root element is "svg".
    </a:documentation>
    <ref name="svg"/>
  </start>
-->

  <div>
    <a:documentation>
      Include core set of modules
    </a:documentation>

    <include href="svg-datatypes.rng">
      <a:documentation>
        Datatypes Module
      </a:documentation>
    </include>

    <include href="svg-core-attrib.rng">
      <a:documentation>
        Core Attribute Module
      </a:documentation>
    </include>
  </div>

  <a:documentation>
    Content Models (Default)
  </a:documentation>

  <define name="SVG.Profile.class">
    <notAllowed/>
  </define>

  <define name="SVG.Gradient.class">
    <notAllowed/>
  </define>

  <define name="SVG.Pattern.class">
    <notAllowed/>
  </define>

  <define name="SVG.Clip.class">
    <notAllowed/>
  </define>

  <define name="SVG.Mask.class">
    <notAllowed/>
  </define>

  <define name="SVG.Filter.class">
    <notAllowed/>
  </define>

  <define name="SVG.Cursor.class">
    <notAllowed/>
  </define>

  <define name="SVG.Marker.class">
    <notAllowed/>
  </define>

  <define name="SVG.View.class">
    <notAllowed/>
  </define>

  <define name="SVG.Script.class">
    <notAllowed/>
  </define>

  <define name="SVG.Font.class">
    <notAllowed/>
  </define>

  <define name="SVG.Extensibility.class">
    <notAllowed/>
  </define>

  <define name="SVG.Conditional.class">
    <notAllowed/>
  </define>

  <define name="SVG.Image.class">
    <notAllowed/>
  </define>

  <define name="SVG.Style.class">
    <notAllowed/>
  </define>

  <define name="SVG.Shape.class">
    <notAllowed/>
  </define>

  <define name="SVG.Text.class">
    <notAllowed/>
  </define>

  <define name="SVG.Hyperlink.class">
    <notAllowed/>
  </define>

  <define name="SVG.Animation.class">
    <notAllowed/>
  </define>

  <a:documentation>
    Attribute Collections (Default)
  </a:documentation>

  <define name="SVG.Container.attrib">
    <empty/>
  </define>

  <define name="SVG.Viewport.attrib">
    <empty/>
  </define>

  <define name="SVG.Text.attrib">
    <empty/>
  </define>

  <define name="SVG.TextContent.attrib">
    <empty/>
  </define>

  <define name="SVG.Opacity.attrib">
    <empty/>
  </define>

  <define name="SVG.Marker.attrib">
    <empty/>
  </define>

  <define name="SVG.Profile.attrib">
    <empty/>
  </define>

  <define name="SVG.Gradient.attrib">
    <empty/>
  </define>

  <define name="SVG.Clip.attrib">
    <empty/>
  </define>

  <define name="SVG.Mask.attrib">
    <empty/>
  </define>

  <define name="SVG.Filter.attrib">
    <empty/>
  </define>

  <define name="SVG.FilterColor.attrib">
    <empty/>
  </define>

  <define name="SVG.Cursor.attrib">
    <empty/>
  </define>

  <define name="SVG.External.attrib">
    <empty/>
  </define>

  <define name="SVG.Conditional.attrib">
    <empty/>
  </define>

  <define name="SVG.Color.attrib">
    <empty/>
  </define>

  <define name="SVG.Paint.attrib">
    <empty/>
  </define>

  <define name="SVG.Graphics.attrib">
    <empty/>
  </define>

  <define name="SVG.DocumentEvents.attrib">
    <empty/>
  </define>

  <define name="SVG.GraphicalEvents.attrib">
    <empty/>
  </define>

  <define name="SVG.onload.attrib">
    <empty/>
  </define>

  <define name="SVG.AnimationEvents.attrib">
    <empty/>
  </define>

  <define name="SVG.XLink.attrib">
    <empty/>
  </define>

  <define name="SVG.XLinkRequired.attrib">
    <empty/>
  </define>

  <define name="SVG.XLinkEmbed.attrib">
    <empty/>
  </define>

  <define name="SVG.XLinkReplace.attrib">
    <empty/>
  </define>

  <define name="SVG.Style.attrib">
    <empty/>
  </define>

  <define name="SVG.Font.attrib">
    <empty/>
  </define>

  <a:documentation>
    SVG.Description.class
  </a:documentation>

  <define name="SVG.Description.extra.class">
    <notAllowed/>
  </define>

  <define name="SVG.Description.class">
    <choice>
      <ref name="desc"/>
      <ref name="SVG.title"/>
      <ref name="metadata"/>
      <ref name="SVG.Description.extra.class"/>
    </choice>
  </define>

  <a:documentation>
    SVG.Use.class
  </a:documentation>

  <define name="SVG.Use.extra.class">
    <notAllowed/>
  </define>

  <define name="SVG.Use.class">
    <choice>
      <ref name="use"/>
      <ref name="SVG.Use.extra.class"/>
    </choice>
  </define>

  <a:documentation>
    SVG.Structure.class
  </a:documentation>

  <define name="SVG.Structure.extra.class">
    <notAllowed/>
  </define>

  <define name="SVG.Structure.class">
    <choice>
      <ref name="svg"/>
      <ref name="g"/>
      <ref name="defs"/>
      <ref name="SVG.Use.class"/>
      <ref name="SVG.Structure.extra.class"/>
      <ref name="SVG.Extensibility.class"/> <!-- added per Issue 222 -->
    </choice>
  </define>

  <a:documentation>
    SVG.Presentation.attrib
  </a:documentation>

  <define name="SVG.Presentation.extra.attrib">
    <empty/>
  </define>

  <define name="SVG.Presentation.attrib">
    <ref name="SVG.Container.attrib"/>
    <ref name="SVG.Viewport.attrib"/>
    <ref name="SVG.Text.attrib"/>
    <ref name="SVG.TextContent.attrib"/>
    <ref name="SVG.Font.attrib"/>
    <ref name="SVG.Paint.attrib"/>
    <ref name="SVG.Color.attrib"/>
    <ref name="SVG.Opacity.attrib"/>
    <ref name="SVG.Graphics.attrib"/>
    <ref name="SVG.Marker.attrib"/>
    <ref name="SVG.Profile.attrib"/>
    <ref name="SVG.Gradient.attrib"/>
    <ref name="SVG.Clip.attrib"/>
    <ref name="SVG.Mask.attrib"/>
    <ref name="SVG.Filter.attrib"/>
    <ref name="SVG.FilterColor.attrib"/>
    <ref name="SVG.Cursor.attrib"/>
    <optional>
      <attribute name="flood-color">
        <ref name="SVGColor.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="flood-opacity">
        <ref name="OpacityValue.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="lighting-color">
        <ref name="SVGColor.datatype"/>
      </attribute>
    </optional>
    <ref name="SVG.Presentation.extra.attrib"/>
  </define>

  <a:documentation>
    svg: SVG Document Element
  </a:documentation>

  <define name="SVG.svg.content">
    <zeroOrMore>
      <choice>
        <ref name="SVG.Description.class"/>
        <ref name="SVG.Animation.class"/>
        <ref name="SVG.Structure.class"/>
        <ref name="SVG.Conditional.class"/>
        <ref name="SVG.Image.class"/>
        <ref name="SVG.Style.class"/>
        <ref name="SVG.Shape.class"/>
        <ref name="SVG.Text.class"/>
        <ref name="SVG.Marker.class"/>
        <ref name="SVG.Profile.class"/>
        <ref name="SVG.Gradient.class"/>
        <ref name="SVG.Pattern.class"/>
        <ref name="SVG.Clip.class"/>
        <ref name="SVG.Mask.class"/>
        <ref name="SVG.Filter.class"/>
        <ref name="SVG.Cursor.class"/>
        <ref name="SVG.Hyperlink.class"/>
        <ref name="SVG.View.class"/>
        <ref name="SVG.Script.class"/>
        <ref name="SVG.Font.class"/>
      </choice>
    </zeroOrMore>
  </define>

  <define name="svg">
    <element name="svg">
      <ref name="attlist.svg"/>
      <ref name="SVG.svg.content"/>
    </element>
  </define>

  <define name="attlist.svg" combine="interleave">
    <ref name="SVG.Core.attrib"/>
    <ref name="SVG.Conditional.attrib"/>
    <ref name="SVG.Style.attrib"/>
    <ref name="SVG.Presentation.attrib"/>
    <ref name="SVG.DocumentEvents.attrib"/>
    <ref name="SVG.GraphicalEvents.attrib"/>
    <ref name="SVG.External.attrib"/>
    <optional>
      <attribute name="x">
        <ref name="Coordinate.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="y">
        <ref name="Coordinate.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="width">
        <ref name="SVGLength.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="height">
        <ref name="SVGLength.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="viewBox">
        <ref name="ViewBoxSpec.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="preserveAspectRatio" a:defaultValue="xMidYMid meet">
        <ref name="PreserveAspectRatioSpec.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="zoomAndPan" a:defaultValue="magnify">
        <choice>
          <value>disable</value>
          <value>magnify</value>
        </choice>
      </attribute>
    </optional>
    <optional>
      <attribute name="version" a:defaultValue="1.1">
        <value type="string">1.1</value>
      </attribute>
    </optional>
    <optional>
      <attribute name="baseProfile">
        <ref name="SVGText.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="contentScriptType" a:defaultValue="text/ecmascript">
        <ref name="SVGContentType.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="contentStyleType" a:defaultValue="text/css">
        <ref name="SVGContentType.datatype"/>
      </attribute>
    </optional>
  </define>

  <a:documentation>
    g: Group Element
  </a:documentation>

  <define name="SVG.g.content">
    <zeroOrMore>
      <choice>
        <ref name="SVG.Description.class"/>
        <ref name="SVG.Animation.class"/>
        <ref name="SVG.Structure.class"/>
        <ref name="SVG.Conditional.class"/>
        <ref name="SVG.Image.class"/>
        <ref name="SVG.Style.class"/>
        <ref name="SVG.Shape.class"/>
        <ref name="SVG.Text.class"/>
        <ref name="SVG.Marker.class"/>
        <ref name="SVG.Profile.class"/>
        <ref name="SVG.Gradient.class"/>
        <ref name="SVG.Pattern.class"/>
        <ref name="SVG.Clip.class"/>
        <ref name="SVG.Mask.class"/>
        <ref name="SVG.Filter.class"/>
        <ref name="SVG.Cursor.class"/>
        <ref name="SVG.Hyperlink.class"/>
        <ref name="SVG.View.class"/>
        <ref name="SVG.Script.class"/>
        <ref name="SVG.Font.class"/>
      </choice>
    </zeroOrMore>
  </define>

  <define name="g">
    <element name="g">
      <ref name="attlist.g"/>
      <ref name="SVG.g.content"/>
    </element>
  </define>

  <define name="attlist.g" combine="interleave">
    <ref name="SVG.Core.attrib"/>
    <ref name="SVG.Conditional.attrib"/>
    <ref name="SVG.Style.attrib"/>
    <ref name="SVG.Presentation.attrib"/>
    <ref name="SVG.GraphicalEvents.attrib"/>
    <ref name="SVG.External.attrib"/>
    <optional>
      <attribute name="transform">
        <ref name="TransformList.datatype"/>
      </attribute>
    </optional>
  </define>

  <a:documentation>
    defs: Definisions Element
  </a:documentation>

  <define name="SVG.defs.content">
    <zeroOrMore>
      <choice>
        <ref name="SVG.Description.class"/>
        <ref name="SVG.Animation.class"/>
        <ref name="SVG.Structure.class"/>
        <ref name="SVG.Conditional.class"/>
        <ref name="SVG.Image.class"/>
        <ref name="SVG.Style.class"/>
        <ref name="SVG.Shape.class"/>
        <ref name="SVG.Text.class"/>
        <ref name="SVG.Marker.class"/>
        <ref name="SVG.Profile.class"/>
        <ref name="SVG.Gradient.class"/>
        <ref name="SVG.Pattern.class"/>
        <ref name="SVG.Clip.class"/>
        <ref name="SVG.Mask.class"/>
        <ref name="SVG.Filter.class"/>
        <ref name="SVG.Cursor.class"/>
        <ref name="SVG.Hyperlink.class"/>
        <ref name="SVG.View.class"/>
        <ref name="SVG.Script.class"/>
        <ref name="SVG.Font.class"/>
      </choice>
    </zeroOrMore>
  </define>

  <define name="defs">
    <element name="defs">
      <ref name="attlist.defs"/>
      <ref name="SVG.defs.content"/>
    </element>
  </define>

  <define name="attlist.defs" combine="interleave">
    <ref name="SVG.Core.attrib"/>
    <ref name="SVG.Conditional.attrib"/>
    <ref name="SVG.Style.attrib"/>
    <ref name="SVG.Presentation.attrib"/>
    <ref name="SVG.GraphicalEvents.attrib"/>
    <ref name="SVG.External.attrib"/>
    <optional>
      <attribute name="transform">
        <ref name="TransformList.datatype"/>
      </attribute>
    </optional>
  </define>

  <a:documentation>
    desc: Description Element
  </a:documentation>

  <define name="SVG.desc.content">
    <text/>
  </define>

  <define name="desc">
    <element name="desc">
      <ref name="attlist.desc"/>
      <ref name="SVG.desc.content"/>
    </element>
  </define>

  <define name="attlist.desc" combine="interleave">
    <ref name="SVG.Core.attrib"/>
    <ref name="SVG.Style.attrib"/>
  </define>

  <a:documentation>
    title: Title Element
  </a:documentation>

  <define name="SVG.title.content">
    <text/>
  </define>

  <define name="SVG.title">
    <element name="title">
      <ref name="attlist.title"/>
      <ref name="SVG.title.content"/>
    </element>
  </define>

  <define name="attlist.title" combine="interleave">
    <ref name="SVG.Core.attrib"/>
    <ref name="SVG.Style.attrib"/>
  </define>

  <a:documentation>
    metadata: Metadata Element
  </a:documentation>

  <define name="SVG.metadata.content">
    <text/>
  </define>

  <define name="metadata">
    <element name="metadata">
      <ref name="attlist.metadata"/>
      <ref name="SVG.metadata.content"/>
    </element>
  </define>

  <define name="attlist.metadata" combine="interleave">
    <ref name="SVG.Core.attrib"/>
  </define>

  <a:documentation>
    use: Use Element
  </a:documentation>

  <define name="SVG.use.content">
    <zeroOrMore>
      <ref name="SVG.Description.class"/>
    </zeroOrMore>
    <zeroOrMore>
      <ref name="SVG.Animation.class"/>
    </zeroOrMore>
  </define>

  <define name="use">
    <element name="use">
      <ref name="attlist.use"/>
      <ref name="SVG.use.content"/>
    </element>
  </define>

  <define name="attlist.use" combine="interleave">
    <ref name="SVG.Core.attrib"/>
    <ref name="SVG.Conditional.attrib"/>
    <ref name="SVG.Style.attrib"/>
    <ref name="SVG.Presentation.attrib"/>
    <ref name="SVG.GraphicalEvents.attrib"/>
    <ref name="SVG.XLinkEmbed.attrib"/>
    <ref name="SVG.External.attrib"/>
    <optional>
      <attribute name="x">
        <ref name="Coordinate.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="y">
        <ref name="Coordinate.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="width">
        <ref name="SVGLength.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="height">
        <ref name="SVGLength.datatype"/>
      </attribute>
    </optional>
    <optional>
      <attribute name="transform">
        <ref name="TransformList.datatype"/>
      </attribute>
    </optional>
  </define>

</grammar>
