title: MyBatis: Error when adding a 'bind' inside of 'foreach'
body: <p>I'm using MyBatis for handling SQL queries. Here is my problematic piece of code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!DOCTYPE mapper
    PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
    "http://mybatis.org/dtd/mybatis-3-mapper.dtd"&gt;
  &lt;mapper namespace="com.foo.Foo"&gt;
      ...
      &lt;insert id="insert" parameterType="com.foo.FooParam"&gt;
          &lt;foreach collection="bars" item="bar" separator=" "&gt;
              &lt;bind name="inFavorites" value="bar.sectionId == '_favorites'" /&gt;
              &lt;foreach collection="bar.bars2" item="bar2" index="index" separator=" "&gt;
                 ...
              &lt;/foreach&gt;
          &lt;/foreach&gt;
       &lt;/insert&gt;
      ...
  &lt;/mapper&gt;
  </code></pre>
  
  <p>Intelij shows the following error when validiting the xml:</p>
  
  <blockquote>
    <p>Error:(24, 74) Element type "bind" must be declared.</p>
    
    <p>Error:(28, 19) The content of element type "foreach" must match "(include|trim|where|set|foreach|choose|if)".</p>
  </blockquote>
  
  <p>And when i put a compiled module as an osgi package in a jetty server (mvn compiles it w/o errors and warnings) I'm getting the following error: </p>
  
  <blockquote>
    <p>lineNumber: 28; columnNumber: 19; The content of element type "foreach"
    must match "(include|trim|where|set|foreach|choose|if)".</p>
  </blockquote>
  
  <p>So Ok, I get this. I cannot add a 'bind' element inside of a 'foreach'. </p>
  
  <p>But why, if <a href="http://mybatis.org/dtd/mybatis-3-mapper.dtd" rel="nofollow">http://mybatis.org/dtd/mybatis-3-mapper.dtd</a> says otherwise?</p>
  
  <pre><code>&lt;!ELEMENT foreach (#PCDATA | include | trim | where | set | foreach | choose | if | bind)*&gt;
  </code></pre>