<commit_before><?xml version="1.0" encoding="UTF-8"?>
<%
 referenced_modules = data_module.xml.referenced_data_modules
%>
<xs:schema targetNamespace="<%= data_module.xml.namespace %>"
           version="1.0"
<% ([data_module] + referenced_modules).each do |dm| -%>
           xmlns:<%= dm.xml.prefix %>="<%= dm.xml.namespace %>"
<% end -%>
           xmlns:xs="http://www.w3.org/2001/XMLSchema">
<% referenced_modules.each do |dm| -%>
  <xs:import namespace="<%= dm.xml.namespace %>"/>
<% end -%>
<% data_module.enumerations.select{|enum| enum.xml?}.each do |enum| -%>
<% if enum.top_level? -%>
  <xs:element name="<%= enum.xml.name %>" type="<%= data_module.xml.prefix %>:<%= enum.name %>"/>
<% end -%>
  <xs:simpleType name="<%= enum.name %>">
    <xs:restriction base="xs:<%= enum.numeric_values? ? 'integer' : 'string' %>">
<% enum.values.each_with_index do |val, index| -%>
      <xs:enumeration value="<%= enum.numeric_values? ? index: val.name %>" />
<% end -%>
    </xs:restriction>
  </xs:simpleType>
<% end -%>
<% data_module.structs.select{|s|s.xml?}.each do |struct| -%>
  <xs:element name="<%= struct.xml.name %>" type="<%= data_module.xml.prefix %>:<%= struct.name %>"/>
  <xs:complexType name="<%= struct.name %>">
<% if !struct.fields.select{|f| f.collection? || f.struct? || f.xml.element?}.empty? -%>
    <xs:sequence>
<% struct.fields.each do |field| -%>
<% if field.collection? -%>
      <xs:element name="<%= field.xml.name %>" nillable="false">
        <xs:complexType>
          <xs:sequence>
<% if field.struct? -%>
            <xs:element name="<%= field.xml.component_name %>" type="<%= field.referenced_struct.data_module.xml.prefix %>:<%= field.referenced_struct.name %>" <%= xsd_element_occurrences(field) %>/>
<% else -%>
            <xs:element name="<%= field.xml.component_name %>" <%= xsd_type(field) %> <%= xsd_element_occurrences(field) %>/>
<% end -%>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
<% elsif field.struct? -%>
      <xs:element name="<%= field.xml.name %>" type="<%= field.referenced_struct.data_module.xml.prefix %>:<%= field.referenced_struct.name %>" <%= xsd_element_occurrences(field) %>/>
<% elsif field.xml.element? -%>
      <xs:element name="<%= field.xml.name %>" <%= xsd_type(field) %> <%= xsd_element_occurrences(field) %>/>
<% end -%>
<% end -%>
    </xs:sequence>
<% else -%>
    <xs:sequence/>
<% end -%>
<% struct.fields.select{|f| !f.collection? && !f.struct? && !f.xml.element?}.each do |field| -%>
    <xs:attribute name="<%= field.xml.name %>" <%= xsd_type(field) %> <%= xsd_attribute_use(field) %>/>
<% end -%>
  </xs:complexType>
<% end -%>
<% data_module.exceptions.select{|e|e.xml?}.each do |exception| -%>
  <xs:element name="<%= exception.xml.name %>" nillable="false" type="<%= data_module.xml.prefix %>:<%= exception.name %>"/>
  <xs:complexType name="<%= exception.name %>">
<% if exception.parameters.size > 0 -%>
    <xs:sequence><commit_msg>Whitespace<commit_after><?xml version="1.0" encoding="UTF-8"?>
<%
 referenced_modules = data_module.xml.referenced_data_modules
%>
<xs:schema targetNamespace="<%= data_module.xml.namespace %>"
           version="1.0"
<% ([data_module] + referenced_modules).each do |dm| -%>
           xmlns:<%= dm.xml.prefix %>="<%= dm.xml.namespace %>"
<% end -%>
           xmlns:xs="http://www.w3.org/2001/XMLSchema">
<% referenced_modules.each do |dm| -%>
  <xs:import namespace="<%= dm.xml.namespace %>"/>
<% end -%>
<% data_module.enumerations.select{|enum| enum.xml?}.each do |enum| -%>
<% if enum.top_level? -%>
  <xs:element name="<%= enum.xml.name %>" type="<%= data_module.xml.prefix %>:<%= enum.name %>"/>
<% end -%>
  <xs:simpleType name="<%= enum.name %>">
    <xs:restriction base="xs:<%= enum.numeric_values? ? 'integer' : 'string' %>">
<% enum.values.each_with_index do |val, index| -%>
      <xs:enumeration value="<%= enum.numeric_values? ? index: val.name %>" />
<% end -%>
    </xs:restriction>
  </xs:simpleType>
<% end -%>
<% data_module.structs.select{|s|s.xml?}.each do |struct| -%>
  <xs:element name="<%= struct.xml.name %>" type="<%= data_module.xml.prefix %>:<%= struct.name %>"/>
  <xs:complexType name="<%= struct.name %>">
<% if !struct.fields.select{|f| f.collection? || f.struct? || f.xml.element?}.empty? -%>
    <xs:sequence>
<% struct.fields.each do |field| -%>
<% if field.collection? -%>
      <xs:element name="<%= field.xml.name %>" nillable="false">
        <xs:complexType>
          <xs:sequence>
<% if field.struct? -%>
            <xs:element name="<%= field.xml.component_name %>" type="<%= field.referenced_struct.data_module.xml.prefix %>:<%= field.referenced_struct.name %>" <%= xsd_element_occurrences(field) %>/>
<% else -%>
            <xs:element name="<%= field.xml.component_name %>" <%= xsd_type(field) %> <%= xsd_element_occurrences(field) %>/>
<% end -%>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
<% elsif field.struct? -%>
      <xs:element name="<%= field.xml.name %>" type="<%= field.referenced_struct.data_module.xml.prefix %>:<%= field.referenced_struct.name %>" <%= xsd_element_occurrences(field) %>/>
<% elsif field.xml.element? -%>
      <xs:element name="<%= field.xml.name %>" <%= xsd_type(field) %> <%= xsd_element_occurrences(field) %>/>
<% end -%>
<% end -%>
    </xs:sequence>
<% else -%>
    <xs:sequence/>
<% end -%>
<% struct.fields.select{|f| !f.collection? && !f.struct? && !f.xml.element?}.each do |field| -%>
    <xs:attribute name="<%= field.xml.name %>" <%= xsd_type(field) %><%= xsd_attribute_use(field) %>/>
<% end -%>
  </xs:complexType>
<% end -%>
<% data_module.exceptions.select{|e|e.xml?}.each do |exception| -%>
  <xs:element name="<%= exception.xml.name %>" nillable="false" type="<%= data_module.xml.prefix %>:<%= exception.name %>"/>
  <xs:complexType name="<%= exception.name %>">
<% if exception.parameters.size > 0 -%>
    <xs:sequence>
{'fraction_non_alphanumeric': 0.2466078697421981, 'fraction_numerical': 0.0037313432835820895, 'mean_word_length': 3.980574324324324, 'pattern_counts': {'":': 0, '<': 191, '<?xml version=': 2, '>': 193, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 56}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4110378', 'n_tokens_mistral': 2383, 'n_tokens_neox': 2154, 'n_words': 319}