title: spring configuration file validation
body: <p>I've noticed this behavior in the processing of spring configuration files.<br />
  I have 2 errors in my config file:<br/></p>
  
  <ul>
  <li>one syntax (well format) error, say a mispelled closing tag (tryed with "html" tag)<br /></li>
  <li>a "namespace" (validation) error (tryed a wrong path to security namespace)<br /></li>
  </ul>
  
  <p>Since the xml is not valid, i thought that the first error that the runtime environement returned were the validation error.<br/><br />
  That's not true (spring 3.0.2 with security 3.0.2).<br/><br />
  It first returns:</p>
  
  <blockquote>
    <p>The matching wildcard is strict, but no declaration can be found for element 'http'</p>
  </blockquote>
  
  <p>then, when i fixed this first error, i get (what I was expecting as first):</p>
  
  <blockquote>
    <p>The element type "http" must be terminated by the matching end-tag ""</p>
  </blockquote>
  
  <p>So what can be said about the syntax check? It seems that the process of syntax check is not performed as a preliminar step, but checking and validation are "interlaced". Every tag is first checked then validated. Is it right? Is it implementation-dependent?<br/></p>
  
  <p>PS: My faulty xml (notice the two errors in schema location and in http closing tag): </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans:beans xmlns="http://www.springframework.org/schema/security"
     xmlns:beans="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                         http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsdFIRSTERROR"&gt;
  
  &lt;http&gt;
      &lt;form-login /&gt;
      &lt;http-basic /&gt;
      &lt;logout /&gt;
      &lt;intercept-url pattern="/**" access="ROLE_USER" /&gt;
  &lt;/SECONDERRORhttp&gt;
  
  &lt;authentication-manager&gt;
      &lt;authentication-provider&gt;
          &lt;user-service&gt;
              &lt;user name="myuser" password="mysecret" authorities="ROLE_USER" /&gt;
          &lt;/user-service&gt;
      &lt;/authentication-provider&gt;
   &lt;/authentication-manager&gt;
  
  &lt;/beans:beans&gt;
  </code></pre>