title: Checking XML file for specified rules
body: <p>Let's say I have the following xml file:</p>
  
  <pre><code>&lt;report&gt;
    &lt;income&gt;
      &lt;amount type="type1"&gt;50&lt;/amount&gt;
      &lt;amount type="type2"&gt;100&lt;/amount&gt;
    &lt;/income&gt;
    &lt;outcome&gt;
      &lt;amount type="type1"&gt;75&lt;/amount&gt;
      &lt;amount type="type2"&gt;10&lt;/amount&gt;
    &lt;/outcome&gt;
  &lt;/report&gt;
  </code></pre>
  
  <p>I want to be sure that xml file contains only above tags, type attribute is only type1 or type2, and amount is only integer. What should I use to validate xml file according to specified rules? Must I do it manually (parse xml file and check each tag for rules) or is there any method like predefining template or anything else?</p>