How do I throw an exception if an element is present that shouldn't be
<p>I am using XmlReader.  I am basically going through an if statement reading each element if it's present.  If I come across an element that shouldn't be there I want to throw an XmlException.  Then I have an else basically saying if we have already read all of the elements and there aren't any that don't match what we are looking for close the element that all of these other elements are wrapped inside of.  Everthing is working except for the checking for an invalid or unrecognized element. </p>

<pre><code>public void ReadXml(XmlReader reader)
        {
            if (reader.IsStartElement("job"))
            {
                //
                // Get the values of all the &lt;job&gt; attributes
                //
                JobName = reader.GetAttribute("name");
                MethodName = reader.GetAttribute("method");

                //
                // Read past &lt;job&gt;
                //
                reader.Read();

                //
                // We could have (in any order):
                //   &lt;Description&gt;&lt;/Description&gt;
                //   &lt;Source&gt;&lt;/Source&gt;
                //   &lt;Properties&gt;&lt;/Properties&gt;
                //   &lt;Elements&gt;&lt;/Elements&gt;
                // 
                while (true)
                {
                    if (reader.IsStartElement("description"))
                    {
                        Description = reader.ReadElementContentAsString();
                    }
                    else if (reader.IsStartElement("source"))
                    {
                        Source = reader.ReadElementContentAsString();
                    }
                    else if (reader.IsStartElement("properties"))
                    {
                        Properties.ReadXml(reader);
                    }
                    else if ((reader.IsStartElement("elements")) &amp;&amp; (!reader.IsEmptyElement))
                    {
                        Elements.ReadXml(reader);
                    }
                    else if ((reader.IsStartElement("parameters")) &amp;&amp; (!reader.IsEmptyElement))
                    {
                        Parameters.ReadXml(reader);
                    }
                    else if (((!reader.IsStartElement("description"))
                        &amp;&amp; (!reader.IsStartElement("source"))
                        &amp;&amp; (!reader.IsStartElement("properties"))
                        &amp;&amp; (!reader.IsStartElement("elements"))
                        &amp;&amp; (!reader.IsStartElement("parameters"))
                        &amp;&amp; (!reader.IsStartElement("job"))))
                    {
                        throw new XmlException("Unexpected element was present");
                    }
                    else
                    {
                        reader.MoveToContent();
                        reader.ReadEndElement();
                        break;
                    }
                }
            }
            else
            {
                throw new XmlException("Expected &lt;job&gt; element was not present");
            }
        }
</code></pre>

<p>The part that is breaking is this code below.  It goes inside of this if statement everytime and throws and exception. </p>

<pre><code>else if (((!reader.IsStartElement("description"))
     &amp;&amp; (!reader.IsStartElement("source"))
     &amp;&amp; (!reader.IsStartElement("properties"))
     &amp;&amp; (!reader.IsStartElement("elements"))
     &amp;&amp; (!reader.IsStartElement("parameters"))
     &amp;&amp; (!readerE("job"))))
{
    throw new XmlException("Unexpected element was present");
}
</code></pre>