<?xml version="1.0"?>
<!DOCTYPE hrc PUBLIC "-//Cail Lomecb//DTD Colorer HRC take5//EN"
  "http://colorer.sf.net/2003/hrc.dtd">
<hrc version="take5" xmlns="http://colorer.sf.net/2003/hrc"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://colorer.sf.net/2003/hrc http://colorer.sf.net/2003/hrc.xsd">

  <type name="xml" access="private">
    <annotation>
     <documentation>
       xml1.0/1.1 syntax.
       Basic W3C Recommendation implementation (Well-Formedness)

       Well-Formedness loose cases:
         - Attributes list poor check
         - No DTD ELEMENT strict content check
         - XMLDecl limitations (single string), no attributes order check
       Goals and ideas:
         - Any WF document has to be shown without visible errors
         - Most non-WF documents have to be shown with WF-violations
         - Not all WF constrains could be checked. Checks affect most
           syntax rules but not logical. The most common check loose is
           the order of productions. This model can't be reduced to colorer's
           line-based context model.
     </documentation>
     <documentation><![CDATA[
      Contributors:
       Max Belugin <belugin@mail.ru>
       Alexey Vasilyev <servent@fis.lv>
       Yury Finkel <yura@mv.ru>
       Alexander Gutman <gutman@math.nsc.ru>
       Dmitry Kirsanov <dmitry@kirsanov.com>
     ]]></documentation>
    </annotation>

    <import type="def"/>

<!-- xml1.1 entity defines -->
    <entity name="Char" value="\x{1}-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}"/>

    <entity name="NameStartChar" value=":A-Z_a-z\x{C0}-\x{02FF}\x{0370}-\x{037D}\x{037F}-\x{2027}\x{202A}-\x{218F}\x{2800}-\x{D7FF}\x{E000}-\x{FDCF}\x{FDE0}-\x{FFEF}\x{10000}-\x{10FFFF}"/>
    <entity name="NameChar" value="%NameStartChar;\-.0-9\xB7\x{0300}-\x{036F}"/>

    <entity name="NCNameStartChar" value="%NameStartChar;-[:]"/>
    <entity name="NCNameChar" value="%NameChar;-[:]"/>
<!--
        [13]   PubidChar   ::=   #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
-->
    <entity name="PubidChar" value="\x{20}\x{0D}\x{0A}a-zA-Z0-9\-'\(\)+,./:=?;!*#@$_%"/>

    <entity name="Name" value="[%NameStartChar;][%NameChar;]*"/>
    <entity name="NCName" value="[%NCNameStartChar;][%NCNameChar;]*"/>
    <entity name="QName" value="(?{}%NCName;\:)?%NCName;"/>

    <entity name="Nmtoken" value="[%NameChar;]+"/>

    <entity name="PEReference" value="\%%Name;\;"/>



    <region name="badChar"       parent="Error" description="bad stream"/>

    <region name="Comment"       parent="Comment" description="Comment body"/>
    <region name="Comment.start" parent="Comment" description="Comment start [&lt;!--]"/>
    <region name="Comment.end"   parent="Comment" description="Comment end [-->]"/>

    <region name="CharRef"       parent="Parameter" description="Character Reference"/>
    <region name="EntityRef"     parent="ParameterStrong" description="XML Entity Reference"/>
    <region name="PEReference"   parent="EntityRef" description="XML Parameter Entity Reference"/>

    <region name="element.start.name" parent="Tag"/>
    <region name="element.start.lt"   parent="OpenTag"/>
    <region name="element.start.gt"   parent="OpenTag"/>
    <region name="element.end.name"   parent="Tag"/>
    <region name="element.end.lt"     parent="CloseTag"/>
    <region name="element.end.gt"     parent="CloseTag"/>
    <region name="element.nsprefix"   parent="Prefix"/>
    <region name="element.nscolon"    parent="SymbolStrong"/>

    <region name="element.defined.start.name" parent="Keyword"/>
    <region name="element.defined.end.name"   parent="Keyword"/>

    <region name="Attribute.name"         parent="ParameterUnknown"/>
    <region name="Attribute.defined.name" parent="Parameter"/>
    <region name="Attribute.nsprefix"     parent="Prefix"/>
    <region name="Attribute.nscolon"      parent="SymbolStrong"/>
    <region name="Attribute.eq"           parent="Symbol"/>

    <region name="AttValue"          parent="String"/>
    <region name="AttValue.start"    parent="AttValue"/>
    <region name="AttValue.end"      parent="AttValue"/>

    <region name="AttValue.defined"       parent="String"/>
    <region name="AttValue.defined.start" parent="AttValue.defined"/>
    <region name="AttValue.defined.end"   parent="AttValue.defined"/>

    <region name="EntityValue"       parent="String"/>

    <region name="CDStart" parent="CommentEdge"/>
    <region name="CData"   parent="def:default"/>
    <region name="CDEnd"   parent="CommentEdge"/>

    <region name="PI.start"   parent="element.start.lt"   description="Processing Instruction [&lt;?]"/>
    <region name="PI.name"    parent="element.start.name" description="Processing Instruction Name"/>
    <region name="PI.content" parent="Directive"          description="Processing Instruction Content"/>
    <region name="PI.end"     parent="element.start.gt"   description="Processing Instruction [?&gt;]"/>

    <region name="XMLDecl"/>
    <region name="XMLDecl.start" parent="PI.start"/>
    <region name="XMLDecl.name"  parent="PI.name"/>
    <region name="XMLDecl.end"   parent="PI.end"/>
    <region name="XMLDecl.eq"    parent="Symbol"/>

    <region name="VersionInfo"   parent="DirectiveContent"/>
    <region name="VersionNum"    parent="Number"/>
    <region name="EncodingDecl"  parent="DirectiveContent"/>
    <region name="EncName"       parent="AttValue"/>
    <region name="SDDecl"        parent="DirectiveContent"/>
    <region name="SDDecl.yn"     parent="AttValue"/>

    <region name="doctypedecl"/>
    <region name="doctypedecl.start"  parent="Directive"/>
    <region name="doctypedecl.end"    parent="Directive"/>
    <region name="doctypedecl.tag"    parent="Directive"/>
    <region name="doctypedecl.name"   parent="DirectiveContent"/>

    <region name="ExternalID.SYSTEM"  parent="Keyword"/>
    <region name="ExternalID.PUBLIC"  parent="Keyword"/>
    <region name="PubidLiteral"       parent="String"/>
    <region name="SystemLiteral"      parent="String"/>

    <region name="markupdecl"/>
    <region name="markupdecl.start"   parent="element.start.lt"/>
    <region name="markupdecl.end"     parent="element.start.gt"/>

    <!--
      *.tag             - tag name
      *.start, *.end    - declaration start and end brackets
      *.name            - element name declaration
      *.spec            - type specifier declaration
    -->
    <!-- full element -->
    <region name="elementdecl"        parent="doctypedecl"/>
    <!-- element name -->
    <region name="elementdecl.name"   parent="doctypedecl.name"/>
    <!-- internal element names -->
    <region name="elementdecl.spec"/>
    <!-- ELEMENT -->
    <region name="elementdecl.tag"    parent="doctypedecl.tag"/>
    <!-- <! > -->
    <region name="elementdecl.start"  parent="doctypedecl.start"/>
    <region name="elementdecl.end"    parent="doctypedecl.end"/>

    <!-- EMPTY ANY #PCDATA -->
    <region name="contentspec.spec"   parent="Keyword"/>
    <!-- ( ) -->
    <region name="contentspec.start"  parent="Symbol"/>
    <region name="contentspec.end"    parent="Symbol"/>
    <!-- | , + * ? -->
    <region name="contentspec.op"     parent="Operator"/>


    <region name="conditionalSect"       parent="doctypedecl"/>
    <region name="conditionalSect.spec"  parent="Keyword"/>
    <region name="conditionalSect.start" parent="doctypedecl.start"/>
    <region name="conditionalSect.end"   parent="doctypedecl.end"/>


    <region name="AttlistDecl"        parent="doctypedecl"/>
    <!-- element name -->
    <region name="AttlistDecl.name"   parent="doctypedecl.name"/>
    <!-- <! > -->
    <region name="AttlistDecl.start"  parent="doctypedecl.start"/>
    <region name="AttlistDecl.end"    parent="doctypedecl.end"/>
    <!-- ATTLIST -->
    <region name="AttlistDecl.tag"    parent="doctypedecl.tag"/>

    <!-- attr name -->
    <region name="AttDef.name"        parent="AttlistDecl.name"/>
    <!-- ID, IDREF ... -->
    <region name="AttType.spec"       parent="Keyword"/>
    <!-- NOTATION -->
    <region name="NotationType.spec"  parent="Keyword"/>
    <!-- #REQUIRED #IMPLIED #FIXED -->
    <region name="DefaultDecl.spec"   parent="Keyword"/>

    <!-- (yes|no|moo) -->
    <region name="Enumeration.spec"/>
    <!-- | -->
    <region name="Enumeration.op"     parent="contentspec.op"/>
    <!-- ( ) -->
    <region name="Enumeration.start"  parent="contentspec.start"/>
    <region name="Enumeration.end"    parent="contentspec.end"/>


    <!-- <!ENTITY name PUBLIC "aaa"> -->
    <region name="EntityDecl"         parent="doctypedecl"/>
    <region name="EntityDecl.name"    parent="doctypedecl.name"/>
    <region name="EntityDecl.start"   parent="doctypedecl.start"/>
    <region name="EntityDecl.tag"     parent="doctypedecl.tag"/>
    <region name="EntityDecl.end"     parent="doctypedecl.end"/>
    <!-- % -->
    <region name="EntityDecl.PE"      parent="contentspec.op"/>
    <!-- NDATA -->
    <region name="NDataDecl"          parent="Keyword"/>

    <!-- <!NOTATION name PUBLIC "aaa"> -->
    <region name="NotationDecl"       parent="doctypedecl"/>
    <region name="NotationDecl.name"  parent="doctypedecl.name"/>
    <region name="NotationDecl.start" parent="doctypedecl.start"/>
    <region name="NotationDecl.tag"   parent="doctypedecl.tag"/>
    <region name="NotationDecl.end"   parent="doctypedecl.end"/>


    <region name='ElementOutlined' parent='Outlined' description='DTD Element'/>
    <region name='AttlistOutlined' parent='Outlined' description='DTD Element Attlist'/>
    <region name='EntityOutlined'   parent='Outlined' description='DTD Entity'/>
    <region name='NotationOutlined' parent='Outlined' description='DTD Notation'/>

    <region name='XMLTagOutline' parent='Outlined'/>



      <scheme name="xmlns-attribute">
         <block start="/(\s?#1|^)(xmlns)((:)(%NCName;))?\M([\s\=]|$)/" end="/[&#34;']?#1/"
                region02="Attribute.nsprefix" region04="Attribute.nscolon" region05="Attribute.defined.name"
                scheme="xmlschema:anyURI-AttributeContent"/>
      </scheme>
      <scheme name="xsi-attributeGroup">
         <block start="/(\s?#1|^)(xsi)(:)(schemaLocation)\M([\s\=]|$)/" end="/[&#34;']?#1/"
                region02="Attribute.nsprefix" region03="Attribute.nscolon" region04="Attribute.defined.name"
                scheme="xmlschema:anyURI-AttributeContent"/>
         <block start="/(\s?#1|^)(xsi)(:)(noNamespaceSchemaLocation)\M([\s\=]|$)/" end="/[&#34;']?#1/"
                region02="Attribute.nsprefix" region03="Attribute.nscolon" region04="Attribute.defined.name"
                scheme="xmlschema:anyURI-AttributeContent"/>
         <block start="/(\s?#1|^)(xsi)(:)(type)\M([\s\=]|$)/" end="/[&#34;']?#1/"
                region02="Attribute.nsprefix" region03="Attribute.nscolon" region04="Attribute.defined.name"
                scheme="xmlschema:QName-AttributeContent"/>
         <block start="/(\s?#1|^)(xsi)(:)(nil)\M([\s\=]|$)/" end="/[&#34;']?#1/"
                region02="Attribute.nsprefix" region03="Attribute.nscolon" region04="Attribute.defined.name"
                scheme="xmlschema:boolean-AttributeContent"/>
      </scheme>

<!-- AUTOGENERATED INCLUDE FROM xml.internal.hrc -->
<!-- It must be implementated with External DTD Entity,
     but colorer xml parser doesn't support them...
-->
      <region name="Enumeration" parent="Constant"/>

      <entity name="ns-real-prefix" value="(?{}(?{}xml):)"/>
      <entity name="nsprefix" value="(?{}(?{}xml):)"/>

      <scheme name="_hrc_int_AttValue">
         <block start="/(&#34;)/" end="/(\y1)/" region00="PairStart" region10="PairEnd" region01="AttValue.start" region11="AttValue.end" scheme="xml:AttValue.content.quot" region="AttValue"/>
         <block start="/(')/" end="/(\y1)/" region00="PairStart" region10="PairEnd" region01="AttValue.start" region11="AttValue.end" scheme="xml:AttValue.content.apos" region="AttValue"/>
      </scheme>
      <scheme name="_hrc_int_AttributeContent">
         <inherit scheme="xml:AttributeContent">
            <virtual scheme="xml:AttValue" subst-scheme="_hrc_int_AttValue"/>
         </inherit>
      </scheme>
      <scheme name="lang-attribute">
         <block end="/[&#34;']?#1/" region02="Attribute.defined.name" start="/(\s?#1|^)(?{Attribute.nsprefix}%nsprefix;)(lang)\M([\s\=]|$)/x" scheme="xmlschema:language-AttributeContent"/>
      </scheme>
      <scheme name="space-attribute">
         <block end="/[&#34;']?#1/" region02="Attribute.defined.name" start="/(\s?#1|^)(?{Attribute.nsprefix}%nsprefix;)(space)\M([\s\=]|$)/x" scheme="_hrc_int_d0e16-AttributeContent"/>
      </scheme>
      <scheme name="base-attribute">
         <block end="/[&#34;']?#1/" region02="Attribute.defined.name" start="/(\s?#1|^)(?{Attribute.nsprefix}%nsprefix;)(base)\M([\s\=]|$)/x" scheme="xmlschema:anyURI-AttributeContent"/>
      </scheme>
      <scheme name="specialAttrs-attributeGroup">
         <inherit scheme="base-attribute"/>
         <inherit scheme="lang-attribute"/>
         <inherit scheme="space-attribute"/>
      </scheme>
<!--
      parent: space
-->

      <scheme name="_hrc_int_d0e16-content">
         <regexp match="/\bdefault\b/" region="Enumeration"/>
         <regexp match="/\bpreserve\b/" region="Enumeration"/>
      </scheme>
      <scheme name="_hrc_int_d0e16-content-error">
         <inherit scheme="_hrc_int_d0e16-content"/>
         <inherit scheme="xml:badChar"/>
      </scheme>
      <scheme name="_hrc_int_d0e16-AttributeContent">
         <inherit scheme="_hrc_int_AttributeContent">
            <virtual scheme="xml:AttValue.content.stream" subst-scheme="_hrc_int_d0e16-content-error"/>
         </inherit>
      </scheme>
<!-- END AUTOGENERATED INCLUDE FROM xml.internal.hrc -->





    <scheme name="badChar">
      <regexp match="/\S/" region="badChar" priority="low"/>
    </scheme>

    <scheme name="Reference">
      <annotation><documentation><![CDATA[
        [66]   CharRef     ::=   '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';'
        [67]   Reference   ::=   EntityRef | CharRef
        [68]   EntityRef   ::=   '&' Name ';'
      ]]></documentation></annotation>
      <regexp match="/&amp;\#[0-9]+\;/" region0="CharRef"/>
      <regexp match="/&amp;\#x[0-9a-fA-F]+\;/" region0="CharRef"/>
      <regexp match="/&amp;%Name;\;/" region0="EntityRef"/>
    </scheme>

    <scheme name="PEReference">
      <annotation><documentation><![CDATA[
        [69]   PEReference ::=   '%' Name ';'
      ]]></documentation></annotation>
      <regexp match="/%PEReference;/x" region="PEReference"/>
    </scheme>

    <scheme name="Comment">
      <annotation><documentation><![CDATA[
        [15]   Comment   ::=   '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
      ]]></documentation></annotation>
      <block start="/(&lt;!--)/" end="/(--&gt;)/" scheme="Comment.content"
             region="Comment" region00="Comment.start" region10="Comment.end"
             region01="PairStart" region11="PairEnd"/>
    </scheme>
    <scheme name="Comment.content">
      <regexp match="/ - ( [%Char;-[\-]] |$)/x"/>
      <regexp match="/[\-[^%Char;]]/" region="badChar" priority="low"/>
      <inherit scheme="def:Comment"/>
    </scheme>


    <scheme name="PI">
      <annotation><documentation><![CDATA[
        [16]   PI   ::=   '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
        [17]   PITarget   ::=   Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))
      ]]></documentation></annotation>
      <block start="/(?{PI.start}&lt;\?) (?{PI.name}(xml\s)?!%Name;) /ix"
             end="/(?{PI.end}\?&gt;)/"
             scheme="PI.content"
             region="PI.content"
             region00="PairStart" region10="PairEnd"/>
    </scheme>

    <scheme name="PI.content">
    </scheme>


    <scheme name="CDSect">
      <annotation><documentation>
        [18]   CDSect   ::=   CDStart CData CDEnd
        [19]   CDStart  ::=   '&lt;![CDATA['
        [20]   CData    ::=   (Char* - (Char* ']]&gt;' Char*))
        [21]   CDEnd    ::=   ']]&gt;'
      </documentation></annotation>
      <block start="/(&lt;!\[CDATA\[)/" end="/(\]\]&gt;)/"
             scheme="CDSect.content"
             region="CData" region00="CDStart" region01="PairStart"
             region10="CDEnd" region11="PairEnd"/>
    </scheme>
    <scheme name="CDSect.content.stream"/>
    <scheme name="CDSect.content">
      <inherit scheme="CDSect.content.stream"/>
      <regexp match="/[^%Char;]+/" region="badChar"/>
    </scheme>


    <scheme name="Misc">
      <annotation><documentation><![CDATA[
        [27]   Misc   ::=   Comment | PI | S
      ]]></documentation></annotation>

      <inherit scheme="Comment"/>
      <inherit scheme="PI"/>
      <regexp  match="/\s+/"/>
    </scheme>


    <scheme name="EntityValue">
      <annotation><documentation><![CDATA[
        [9]    EntityValue  ::=   '"' ([^%&"] | PEReference | Reference)* '"' | "'" ([^%&'] | PEReference | Reference)* "'"
      ]]></documentation></annotation>
      <block start="/([&quot;&apos;])/" end="/\y1/"
             scheme="EntityValue.content" region="EntityValue"/>
    </scheme>

    <scheme name="EntityValue.content">
      <inherit scheme="Reference"/>
      <inherit scheme="PEReference"/>
      <regexp match="/[&amp;\%[^%Char;]]/" region="badChar"/>
    </scheme>


    <scheme name="AttValue">
      <annotation><documentation><![CDATA[
        [10]   AttValue   ::=   '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'"
      ]]></documentation></annotation>
      <block start="/(&quot;)/" end="/(\y1)/"
             region00="PairStart" region10="PairEnd"
             region01="AttValue.start" region11="AttValue.end"
             scheme="AttValue.content.quot" region="AttValue"/>
      <block start="/(&apos;)/" end="/(\y1)/"
             region00="PairStart" region10="PairEnd"
             region01="AttValue.start" region11="AttValue.end"
             scheme="AttValue.content.apos" region="AttValue"/>
    </scheme>
    <scheme name="AttValue.content.stream"/>
    <scheme name="AttValue.content">
      <inherit scheme="Reference"/>
      <regexp match="/[&lt;&amp;[^%Char;]]/" region="badChar"/>
      <inherit scheme="AttValue.content.stream"/>
    </scheme>
    <scheme name="AttValue.content.quot">
      <regexp match="/&quot;/" region="badChar" priority="low"/>
      <inherit scheme="AttValue.content"/>
    </scheme>
    <scheme name="AttValue.content.apos">
      <regexp match="/&apos;/" region="badChar" priority="low"/>
      <inherit scheme="AttValue.content"/>
    </scheme>


    <scheme name="SystemLiteral">
      <annotation><documentation><![CDATA[
        [11]   SystemLiteral   ::=   ('"' [^"]* '"') | ("'" [^']* "'")
      ]]></documentation></annotation>
      <block start="/([&quot;&apos;])/" end="/\y1/"
             scheme="empty" region="PubidLiteral"/>
    </scheme>

    <scheme name="PubidLiteral">
      <annotation><documentation><![CDATA[
        [12]   PubidLiteral    ::=   '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
      ]]></documentation></annotation>
      <block start="/([&quot;&apos;])/" end="/\y1/"
             scheme="PubidLiteral.content" region="PubidLiteral"/>
    </scheme>
    <scheme name="PubidLiteral.content">
      <regexp match="/[^%PubidChar;]+/" region0="badChar" priority="low"/>
    </scheme>

    <scheme name="ExternalID">
      <annotation><documentation><![CDATA[
        [75]   ExternalID      ::=   'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral
      ]]></documentation></annotation>
      <regexp match="/\bSYSTEM\b/" region="ExternalID.SYSTEM"/>
      <block  start="/\bPUBLIC\b/" end="/[&quot;&apos;]?#1/"
              scheme="PubidLiteral" region00="ExternalID.PUBLIC"/>
      <inherit scheme="SystemLiteral"/>
    </scheme>



    <scheme name="Attribute">
      <annotation><documentation><![CDATA[
        [41]   Attribute   ::=   Name Eq AttValue
      ]]></documentation></annotation>
      <inherit scheme="Attribute.common"/>
      <inherit scheme="Attribute.any"/>
      <inherit scheme="badChar"/>
    </scheme>
    <scheme name="Attribute.common">
      <inherit scheme="specialAttrs-attributeGroup"/>
      <inherit scheme="xmlns-attribute"/>
      <inherit scheme="xsi-attributeGroup"/>
    </scheme>
    <scheme name="Attribute.any">
      <!-- FIX bounds !!! -->
      <block start="/(\s?#1|^)(%Name;)\M([\s\=]|$)/" end="/[&quot;&apos;]?#1/" scheme="AttributeContent"
             region02="Attribute.name"/>
    </scheme>
    <scheme name="AttributeContent">
      <block start="/\=/" end="/[&quot;&apos;]?#1/" scheme="AttributeContent2"
             region00="Attribute.eq"/>
      <inherit scheme="badChar"/>
    </scheme>
    <scheme name="AttributeContent2">
      <inherit scheme="AttValue"/>
      <inherit scheme="badChar"/>
    </scheme>


    <scheme name="element">
      <annotation><documentation><![CDATA[
        [39]   element   ::=   EmptyElemTag | STag content ETag
      ]]></documentation></annotation>
      <block start="/\M &lt; (%Name; ([\s\/&gt;]|$) )/x"
             end="/ &gt; /x"
             scheme="elementContent"/>
    </scheme>

    <scheme name="element.root">
      <annotation><documentation>
       Single root element scheme
      </documentation></annotation>
      <block start="/~\M &lt; (%Name; ([\s\/&gt;]|$) )/x"
             end="/ &gt;?#1 /x"
             scheme="element"/>
      <inherit scheme="Misc"/>
      <regexp match="/\S+/" region0="badChar"/>
    </scheme>

    <scheme name="elementContent">
      <annotation><documentation><![CDATA[
        [40]   STag           ::=   '<' Name (S Attribute)* S? '>'
        [42]   ETag           ::=   '</' Name S? '>'
        [44]   EmptyElemTag   ::=   '<' Name (S Attribute)* S? '/>'
      ]]></documentation></annotation>
      <!-- <block start="/~( (&lt;) ((?{XMLTagOutline}  ((%xml:NCName;) (:) )? (%xml:Name;) )) \M &gt;?   )/x" -->
      <block start="/~( (&lt;) (  ((%xml:NCName;) (:) )? (%xml:Name;) ) \M &gt;?   )/x"
             end="/( (&lt;\/) (\y3 (?{}\s|$|\>)?= )?= ( (%xml:NCName;) (:) )? (%xml:Name;) \b \M \s* (&gt;?)
              | (\/ \M &gt;) )/x"
             region01="PairStart" region02="element.start.lt"
             region05="element.nsprefix" region06="element.nscolon" region07="element.start.name"
             region11="PairEnd" region12="element.end.lt" region15="element.nsprefix" region16="element.nscolon"
             region17="element.end.name" region18="element.end.gt" region19="element.start.gt"
             scheme="xml:elementContent2"/>
      <inherit scheme="badChar"/>
    </scheme>

    <scheme name="elementContent2">
      <block start="/>/" end="/ \M ( &lt;/%Name; ) /x"
             region00="element.start.gt"
             scheme="content"/>
      <inherit scheme="Attribute"/>
    </scheme>

    <scheme name="content">
      <annotation><documentation><![CDATA[
        [43]   content    ::=   CharData? ((element | Reference | CDSect | PI | Comment) CharData?)*
        [14]   CharData   ::=   [^<&]* - ([^<&]* ']]]]><![CDATA[>' [^<&]*)
      ]]></documentation></annotation>

      <inherit scheme="element"/>
      <inherit scheme="content.other"/>
      <inherit scheme="content.cdata"/>
      <regexp match="/\]\]\>/" region="badChar"/>
      <regexp match="/[&lt;&amp;[^%Char;]]+/" region="badChar" priority="low"/>
    </scheme>

    <scheme name="content.other">
      <inherit scheme="PI"/>
      <inherit scheme="Comment"/>
      <inherit scheme="Reference"/>
    </scheme>

    <scheme name="content.cdata.stream"/>
    <scheme name="content.cdata">
      <inherit scheme="CDSect"/>
      <inherit scheme="content.cdata.stream"/>

      <!-- ??? -->
      <regexp match="/[%Char;-[&lt;&amp;]]+/" priority="low"/>

    </scheme>

    <scheme name="XMLDecl">
      <annotation><documentation><![CDATA[
        [23]   XMLDecl       ::=   '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
      ]]></documentation></annotation>
      <block start="/^(&lt;\?)(?{XMLDecl.name}xml)\M(\s|$)/"
             end="/(\?>)/" scheme="XMLDecl.content"
             region="XMLDecl"
             region00="PairStart" region01="XMLDecl.start"
             region10="PairEnd" region11="XMLDecl.end"/>
    </scheme>

    <scheme name="XMLDecl.content">
      <annotation><documentation><![CDATA[
        [24]   VersionInfo   ::=   S 'version' Eq ("'" VersionNum "'" | '"' VersionNum '"')/* */
        [25]   Eq            ::=   S? '=' S?
        [26]   VersionNum    ::=   ([a-zA-Z0-9_.:] | '-')+
        [80]   EncodingDecl  ::=   S 'encoding' Eq ('"' EncName '"' | "'" EncName "'" )
        [81]   EncName       ::=   [A-Za-z] ([A-Za-z0-9._] | '-')*
        [32]   SDDecl        ::=   S 'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"'))
      ]]></documentation></annotation>
      <regexp match="/(\s|^)(?{VersionInfo}version)
                      \s* (?{XMLDecl.eq}\=) \s*
                      (?{VersionNum}(?{q}[&#x22;&#x27;])
                      [a-zA-Z0-9_.:\-]+
                      \p{q})
                     /x"/>
      <regexp match="/(\s|^)(?{EncodingDecl}encoding)
                      \s* (?{XMLDecl.eq}\=) \s*
                      (?{EncName}(?{q}[&#x22;&#x27;])
                      [a-zA-Z][a-zA-Z0-9_.:\-]*
                      \p{q})
                     /x"/>
      <regexp match="/(\s|^)(?{SDDecl}standalone)
                      \s* (?{XMLDecl.eq}\=) \s*
                      (?{SDDecl.yn}(?{q}[&#x22;&#x27;])
                      (yes|no)
                      \p{q})
                     /x"/>
      <!-- multiline variant - too exotic...
      <regexp match="/version|encoding|standalone/" region="Attribute.name"/>
      <regexp match="/=/" region="XMLDecl.eq"/>
      <regexp match="/([&#x22;&#x27;])([a-zA-Z0-9_.:\-]+|yes|no)\1/" region="AttValue"/>
      -->
      <regexp match="/\S+/" region0="badChar" priority="low"/>
    </scheme>



    <scheme name="doctypedecl">
      <annotation><documentation><![CDATA[
        [28]   doctypedecl  ::=   '<!DOCTYPE' S Name (S ExternalID)? S? ('[' (markupdecl | DeclSep)* ']' S?)? '>'
      ]]></documentation></annotation>
      <block start="/(&lt;!)(DOCTYPE\b)/"
             end="/(>)/" scheme="doctypedecl.content"
             region="doctypedecl"
             region00="PairStart" region01="doctypedecl.start" region02="doctypedecl.tag"
             region10="PairEnd" region11="doctypedecl.end"/>
    </scheme>
    <scheme name="doctypedecl.content">
      <inherit scheme="ExternalID"/>
      <regexp match="/\b%Name;\b/" region="doctypedecl.name"/>
      <block start="/(\[)/" end="/(\])/" scheme="markupdecl"
             region="markupdecl"
             region00="PairStart" region01="markupdecl.start"
             region10="PairEnd" region11="markupdecl.end"/>
      <regexp match="/\S+/" region0="badChar" priority="low"/>
    </scheme>



    <scheme name="conditionalSect">
      <annotation><documentation><![CDATA[
[61]   conditionalSect      ::=   includeSect | ignoreSect
[62]   includeSect          ::=   '<![' S? 'INCLUDE' S? '[' extSubsetDecl ']]]]><![CDATA[>'
[63]   ignoreSect           ::=   '<![' S? 'IGNORE' S? '[' ignoreSectContents* ']]]]><![CDATA[>'
[64]   ignoreSectContents   ::=   Ignore ('<![' ignoreSectContents ']]]]><![CDATA[>' Ignore)*
[65]   Ignore               ::=   Char* - (Char* ('<![' | ']]]]><![CDATA[>') Char*)
      ]]></documentation></annotation>
      <block start="/(&lt;!\[)/" end="/(\]\]&gt;)/"
             scheme="conditionalSect.content" region="conditionalSect"
             region00="PairStart" region01="conditionalSect.start"
             region10="PairEnd" region11="conditionalSect.end"/>
    </scheme>

    <scheme name="conditionalSect.content">
      <regexp match="/\b(INCLUDE|IGNORE)\b/" region="conditionalSect.spec"/>
      <inherit scheme="PEReference"/>
      <block start="/(\[)/" end="/\M(\])\]\>/"
             scheme="extSubsetDecl"
             region00="PairStart" region01="conditionalSect.start"
             region11="PairEnd"/>
    </scheme>

    <scheme name="markupdecl">
      <annotation><documentation><![CDATA[
        [28a]  DeclSep       ::=   PEReference | S
        [29]   markupdecl    ::=   elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment
      ]]></documentation></annotation>
      <inherit scheme="PEReference"/>


      <regexp match="/\M&lt;!ELEMENT \s* (\S+)/x" region1="ElementOutlined"/>
      <!--<regexp match="/\M&lt;!ATTLIST \s* (%Name;)/x" region1="AttlistOutlined"/>-->
      <regexp match="/\M&lt;!ENTITY \s* \% \s* (%Name;)/x" region1="EntityOutlined"/>
      <regexp match="/\M&lt;!NOTATION \s* (%Name;)/x" region1="NotationOutlined"/>

      <block start="/(&lt;!)(ELEMENT)/" end="/(&gt;)/"
             scheme="elementdecl" region="elementdecl"
             region00="PairStart" region01="elementdecl.start" region02="elementdecl.tag"
             region10="PairEnd" region11="elementdecl.end"/>
      <block start="/(&lt;!)(ATTLIST)/" end="/(&gt;)/"
             scheme="AttlistDecl" region="AttlistDecl"
             region00="PairStart" region01="AttlistDecl.start" region02="AttlistDecl.tag"
             region10="PairEnd" region11="AttlistDecl.end"/>
      <block start="/(&lt;!)(ENTITY)/" end="/(&gt;)/"
             scheme="EntityDecl" region="EntityDecl"
             region00="PairStart" region01="EntityDecl.start" region02="EntityDecl.tag"
             region10="PairEnd" region11="EntityDecl.end"/>
      <block start="/(&lt;!)(NOTATION)/" end="/(&gt;)/"
             scheme="NotationDecl" region="NotationDecl"
             region00="PairStart" region01="NotationDecl.start" region02="NotationDecl.tag"
             region10="PairEnd" region11="NotationDecl.end"/>
      <inherit scheme="PI"/>
      <inherit scheme="Comment"/>
      <regexp match="/\S+/" region0="badChar" priority="low"/>
    </scheme>

    <scheme name="extSubsetDecl">
      <annotation><documentation><![CDATA[
        [31]   extSubsetDecl   ::=   ( markupdecl | conditionalSect | DeclSep)*
      ]]></documentation></annotation>
      <inherit scheme="conditionalSect"/>
      <inherit scheme="markupdecl"/>
    </scheme>

    <scheme name="extSubset">
      <annotation><documentation><![CDATA[
        [30]   extSubset       ::=   TextDecl? extSubsetDecl
      ]]></documentation></annotation>
      <inherit scheme="XMLDecl"/>
      <inherit scheme="extSubsetDecl"/>
    </scheme>

    <scheme name="elementdecl">
      <annotation><documentation><![CDATA[
        [45]   elementdecl   ::=   '<!ELEMENT' S Name S contentspec S? '>'
      ]]></documentation></annotation>
      <block start="/(\b%Name;\b|%PEReference;)/" end="/\M\>/" scheme="contentspec"
             region01="elementdecl.name"/>
      <regexp match="/\S+/" region0="badChar" priority="low"/>
    </scheme>

    <scheme name="contentspec">
      <annotation><documentation><![CDATA[
        [46]   contentspec   ::=   'EMPTY' | 'ANY' | Mixed | children
        [47]   children      ::=   (choice | seq) ('?' | '*' | '+')?
      ]]></documentation></annotation>
      <regexp match="/\b(EMPTY|ANY)\b/" region="contentspec.spec"/>
      <inherit scheme="PEReference"/>
      <block start="/(\()/" end="/(\)([\?\*\+]?))/" scheme="Mixed-childred"
             region00="PairStart" region10="PairEnd"
             region01="contentspec.start" region11="contentspec.end" region12="contentspec.op"/>
      <regexp match="/\s+/"/>
      <regexp match="/\S+/" region0="badChar" priority="low"/>
    </scheme>

    <scheme name="choice-seq">
      <annotation><documentation><![CDATA[
        [48]   cp            ::=   (Name | choice | seq) ('?' | '*' | '+')?
        [49]   choice        ::=   '(' S? cp ( S? '|' S? cp )+ S? ')'
        [50]   seq           ::=   '(' S? cp ( S? ',' S? cp )* S? ')'
      ]]></documentation></annotation>
      <block start="/(\()/" end="/(\)([\?\*\+]?))/x" scheme="choice-seq"
             region00="PairStart" region10="PairEnd"
             region01="contentspec.start" region11="contentspec.end"
             region12="contentspec.op"/>
      <regexp match="/\b%Name;\b([\?\*\+]?)/"
              region="elementdecl.spec" region1="contentspec.op"/>
      <inherit scheme="PEReference"/> <!-- ???? -->
      <regexp match="/[\,\|]/" region="contentspec.op"/>
      <inherit scheme="badChar"/>
    </scheme>

    <scheme name="Mixed-childred">
      <block start="/\#PCDATA\b/" end="/\M\)([\*\>\s]|$)?=/x" scheme="Mixed"
             region00="contentspec.spec"/>
      <inherit scheme="choice-seq"/>
    </scheme>

    <scheme name="Mixed">
      <annotation><documentation><![CDATA[
        [51]   Mixed         ::=   '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | '(' S? '#PCDATA' S? ')'
      ]]></documentation></annotation>
      <!-- Conflicts with PEs
      <block start="/\|/" end="/(\b%Name;\b)|(%PEReference;)/x" scheme="Mixed.content"
             region00="contentspec.op" region11="elementdecl.spec" region12="PEReference"/>
      -->
      <regexp match="/\|/" region="contentspec.op"/>
      <regexp match="/\b%Name;\b/" region="contentspec.spec"/>
      <inherit scheme="PEReference"/>

      <inherit scheme="badChar"/>
    </scheme>

    <scheme name="Mixed.content">
      <inherit scheme="badChar"/>
    </scheme>



    <scheme name="AttlistDecl">
      <annotation><documentation><![CDATA[
        [52]   AttlistDecl    ::=   '<!ATTLIST' S Name AttDef* S? '>'
      ]]></documentation></annotation>
      <block start="/(\b%Name;\b|%PEReference;)/" end="/\M\>/" scheme="AttDef"
             region01="AttlistDecl.name"/>
      <inherit scheme="badChar"/>
    </scheme>

    <scheme name="AttDef">
      <annotation><documentation><![CDATA[
        [53]   AttDef         ::=   S Name S AttType S DefaultDecl
        [54]   AttType        ::=   StringType | TokenizedType | EnumeratedType
        [55]   StringType     ::=   'CDATA'
        [56]   TokenizedType  ::=   'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS'
        [57]   EnumeratedType ::=   NotationType | Enumeration
        [58]   NotationType   ::=   'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')'
        [59]   Enumeration    ::=   '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')'
        [60]   DefaultDecl    ::=   '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue)
      ]]></documentation></annotation>
      <keywords region="AttType.spec">
        <word name="CDATA"/>
        <word name="ID"/><word name="IDREF"/><word name="IDREFS"/>
        <word name="ENTITY"/><word name="ENTITIES"/>
        <word name="NMTOKEN"/><word name="NMTOKENS"/>
      </keywords>
      <keywords region="NotationType.spec">
        <word name="NOTATION"/>
      </keywords>
      <regexp match="/\b%Name;\b/" region="AttDef.name"/>
      <inherit scheme="PEReference"/>
      <block start="/(\()/" end="/(\))/" scheme="Enumeration"
             region00="PairStart" region10="PairEnd"
             region01="Enumeration.start" region11="Enumeration.end"/>
      <keywords region="DefaultDecl.spec">
        <word name="#REQUIRED"/><word name="#IMPLIED"/><word name="#FIXED"/>
      </keywords>
      <inherit scheme="AttValue"/>
      <inherit scheme="badChar"/>
    </scheme>

    <scheme name="Enumeration">
      <regexp match="/%Nmtoken;/" region="Enumeration.spec"/>
      <regexp match="/\|/" region="Enumeration.op"/>
      <inherit scheme="PEReference"/>
      <inherit scheme="badChar"/>
    </scheme>



    <scheme name="EntityDecl">
      <annotation><documentation><![CDATA[
        [70]   EntityDecl    ::=   GEDecl | PEDecl
        [71]   GEDecl        ::=   '<!ENTITY' S Name S EntityDef S? '>'
        [72]   PEDecl        ::=   '<!ENTITY' S '%' S Name S PEDef S? '>'
        [73]   EntityDef     ::=   EntityValue | (ExternalID NDataDecl?)
        [74]   PEDef         ::=   EntityValue | ExternalID
        [76]   NDataDecl     ::=   S 'NDATA' S Name
      ]]></documentation></annotation>
      <inherit scheme="PEReference"/>
      <regexp match="/\%/" region="EntityDecl.PE"/>
      <inherit scheme="ExternalID"/>
      <inherit scheme="EntityValue"/>
      <regexp match="/\bNDATA\b/" region="NDataDecl"/>
      <regexp match="/\b%Name;\b/" region="EntityDecl.name"/>

      <inherit scheme="badChar"/>
    </scheme>


    <scheme name="NotationDecl">
      <annotation><documentation><![CDATA[
        [82]   NotationDecl  ::=   '<!NOTATION' S Name S (ExternalID | PublicID) S? '>'
        [83]   PublicID      ::=   'PUBLIC' S PubidLiteral
      ]]></documentation></annotation>
      <inherit scheme="PEReference"/>
      <inherit scheme="ExternalID"/>
      <regexp match="/\b%Name;\b/" region="NotationDecl.name"/>
      <inherit scheme="badChar"/>
    </scheme>



    <scheme name="core" access="public">
      <annotation><documentation><![CDATA[
        [1]    document      ::=   prolog element Misc*
        [22]   prolog        ::=   XMLDecl? Misc* (doctypedecl Misc*)?
      ]]></documentation></annotation>

      <inherit scheme="XMLDecl"/>
      <inherit scheme="doctypedecl"/>
      <inherit scheme="Misc"/>
    </scheme>

    <scheme name="singleroot" access="public">
      <annotation><documentation><![CDATA[
        This adds one root element check.
        Have to be disabled for external parsed entities
      ]]></documentation></annotation>
      <inherit scheme="core"/>
      <block start="/\M(&lt; (%Name; ([\s\/&gt;]|$) ) )/x"
                end="/%neverMatch;/x"
                scheme="element.root"/>
      <inherit scheme="badChar"/>
    </scheme>


    <scheme name="xml" access="public">
      <!--
      <inherit scheme="singleroot"/>
      -->
      <!---->
      <inherit scheme="core"/>
      <inherit scheme="content"/>
      <!---->
    </scheme>


  </type>
</hrc>
<!-- ***** BEGIN LICENSE BLOCK *****
   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
   -
   - The contents of this file are subject to the Mozilla Public License Version
   - 1.1 (the "License"); you may not use this file except in compliance with
   - the License. You may obtain a copy of the License at
   - http://www.mozilla.org/MPL/
   -
   - Software distributed under the License is distributed on an "AS IS" basis,
   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
   - for the specific language governing rights and limitations under the
   - License.
   -
   - The Original Code is the Colorer Library.
   -
   - The Initial Developer of the Original Code is
   - Cail Lomecb <cail@nm.ru>.
   - Portions created by the Initial Developer are Copyright (C) 1999-2003
   - the Initial Developer. All Rights Reserved.
   -
   - Contributor(s):
   -
   - Alternatively, the contents of this file may be used under the terms of
   - either the GNU General Public License Version 2 or later (the "GPL"), or
   - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
   - in which case the provisions of the GPL or the LGPL are applicable instead
   - of those above. If you wish to allow use of your version of this file only
   - under the terms of either the GPL or the LGPL, and not to allow others to
   - use your version of this file under the terms of the MPL, indicate your
   - decision by deleting the provisions above and replace them with the notice
   - and other provisions required by the LGPL or the GPL. If you do not delete
   - the provisions above, a recipient may use your version of this file under
   - the terms of any one of the MPL, the GPL or the LGPL.
   -
   - ***** END LICENSE BLOCK ***** -->
