<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <!--
    relaxng schema for CodeSonar's XML output
    std_grid_entry is the standard structure for a grid entry
  -->
  <xs:attributeGroup name="std_grid_entry">
    <xs:attribute name="url"/>
  </xs:attributeGroup>
  <xs:element name="s">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="c"/>
      </xs:sequence>
      <xs:attribute name="comment" type="xs:boolean"/>
      <xs:attribute name="grayout" type="xs:boolean"/>
      <xs:attribute name="unreachable" type="xs:boolean"/>
      <xs:attribute name="keyword" type="xs:boolean"/>
      <xs:attribute name="string" type="xs:boolean"/>
      <xs:attribute name="macro" type="xs:boolean"/>
      <xs:attribute name="preprocessor" type="xs:boolean"/>
      <xs:attribute name="taint"/>
      <xs:attribute name="linksfid"/>
      <xs:attribute name="interesting" type="xs:boolean"/>
      <xs:attribute name="opcode" type="xs:boolean"/>
      <xs:attribute name="label" type="xs:boolean"/>
      <xs:attribute name="linklocal" type="xs:boolean"/>
      <xs:attribute name="loop" type="xs:boolean"/>
      <xs:attribute name="mclose" type="xs:boolean"/>
      <xs:attribute name="on_path" type="xs:boolean"/>
      <xs:attribute name="super_interesting" type="xs:boolean"/>
      <xs:attribute name="refs"/>
      <xs:attribute name="linkline" type="xs:integer"/>
      <xs:attribute name="include" type="xs:boolean"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="c" type="xs:string"/>
  <xs:element name="vtx_info">
    <xs:complexType>
      <xs:attribute name="loc" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:group name="code_grid_entry">
    <xs:sequence>
      <xs:element minOccurs="0" ref="vtx_info"/>
      <xs:element minOccurs="0" maxOccurs="unbounded" ref="s"/>
    </xs:sequence>
  </xs:group>
  <xs:element name="permissions_link">
    <xs:complexType>
      <xs:attribute name="url" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="searches" type="searchGridRef"/>
  <xs:complexType name="searchGridRef">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" ref="search"/>
    </xs:sequence>
  </xs:complexType>
  <xs:element name="search">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="id"/>
        <xs:element ref="name"/>
        <xs:element ref="created"/>
        <xs:element ref="modified"/>
        <xs:element name="search">
          <xs:complexType mixed="true">
            <xs:attributeGroup ref="std_grid_entry"/>
          </xs:complexType>
        </xs:element>
        <xs:element ref="metrics"/>
        <xs:element ref="scope"/>
        <xs:element ref="message"/>
        <xs:element ref="permissions_link"/>
      </xs:choice>
      <xs:attribute name="url"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="id">
    <xs:complexType mixed="true">
      <xs:attributeGroup ref="std_grid_entry"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="name">
    <xs:complexType mixed="true">
      <xs:attributeGroup ref="std_grid_entry"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="created">
    <xs:complexType mixed="true">
      <xs:attributeGroup ref="std_grid_entry"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="modified">
    <xs:complexType mixed="true">
      <xs:attributeGroup ref="std_grid_entry"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="metrics">
    <xs:complexType mixed="true">
      <xs:attributeGroup ref="std_grid_entry"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="scope">
    <xs:complexType mixed="true">
      <xs:attributeGroup ref="std_grid_entry"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="message">
    <xs:complexType mixed="true">
      <xs:attributeGroup ref="std_grid_entry"/>
    </xs:complexType>
  </xs:element>
</xs:schema>
