title: C#/.NET XML Schema Validation - MSXML strange behavior: ENTITY referenced but not declared
body: <p>I´m trying to validate some XML documents with a xml schema (xsd).</p>
  
  <p>sample code:</p>
  
  <pre><code>private static void validateXml(string file, string schema)
  {
      if (!File.Exists(schema))
      {
          Console.WriteLine("File not found.");
          return;
      }
          XmlReaderSettings settings = new XmlReaderSettings();
          settings.DtdProcessing = DtdProcessing.Parse;
          settings.ValidationType = ValidationType.Schema;
          settings.ValidationFlags |= XmlSchemaValidationFlags.ProcessInlineSchema;
          settings.ValidationFlags |= XmlSchemaValidationFlags.ProcessSchemaLocation;
          settings.ValidationFlags |= XmlSchemaValidationFlags.ReportValidationWarnings;
          settings.ValidationEventHandler += new ValidationEventHandler(ValidationCallBack);
          settings.Schemas.Add(null, schema);
  
          using (XmlReader reader = XmlReader.Create(file, settings))
              while (reader.Read()) ;
  }
  
  private static void ValidationCallBack(object sender, ValidationEventArgs args)
  {
      Console.WriteLine("Error: " + args.Message);
  }
  </code></pre>
  
  <p>sample xml:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;!--PUBLIC "-//AECMA//DTD AECMA 1000D AirCrew 20010401//EN"--&gt;
  &lt;!DOCTYPE dmodule SYSTEM "dm_aecma_avee_c_190.dtd"[    
  &lt;!ENTITY entity1 SYSTEM "entity1.CGM" NDATA CGM&gt;  
  ]&gt;
  &lt;dmodule&gt;
      &lt;content&gt;
          &lt;refs&gt;
              &lt;norefs/&gt;
          &lt;/refs&gt;
          &lt;acrw&gt;
              &lt;descacrw&gt;
                  &lt;para0&gt;
                      &lt;title&gt;Text&lt;/title&gt;
                      &lt;drill drilltyp="Text" ordered="Text"&gt;
                          &lt;step id="Text" memorize="Text" dotline="Text" ordered="Text"&gt;
                              &lt;procd&gt;
                                  &lt;para&gt;
                                      &lt;xref xrefid="fi0001-hot2" xidtype="hotspot"&gt;Text&lt;/para&gt;
                              &lt;/procd&gt;
                          &lt;/step&gt;
                          &lt;step id="Text" memorize="Text" dotline="Text" ordered="Text"&gt;
                              &lt;procd&gt;
                                  &lt;para&gt;Text&lt;xref xrefid="fi0001-hot3" xidtype="hotspot"&gt;Text&lt;/xref&gt;Text&lt;/para&gt;
                              &lt;/procd&gt;
                          &lt;/step&gt;
                          &lt;figure id="fi0001"&gt;
                              &lt;title&gt;Text&lt;/title&gt;
                              &lt;graphic boardno="entity1"&gt;
                                  &lt;hotspot id="fi0001-hot1" apsname="1" type="POS" title="Text"/&gt;
                                  &lt;hotspot id="fi0001-hot2" apsname="2" type="POS" title="Text"/&gt;
                                  &lt;hotspot id="fi0001-hot3" apsname="3" type="POS" title="Text"/&gt;
                              &lt;/graphic&gt;
                              &lt;legend&gt;
                                  &lt;deflist&gt;
                                      &lt;term&gt;1&lt;/term&gt;
                                      &lt;def&gt;
                                          &lt;xref xrefid="fi0001-hot1" xidtype="hotspot"&gt;Text&lt;/xref&gt;
                                      &lt;/def&gt;
                                      &lt;term&gt;2&lt;/term&gt;
                                      &lt;def&gt;
                                          &lt;xref xrefid="fi0001-hot2" xidtype="hotspot"&gt;Text&lt;/xref&gt;
                                      &lt;/def&gt;
                                      &lt;term&gt;3&lt;/term&gt;
                                      &lt;def&gt;
                                          &lt;xref xrefid="fi0001-hot3" xidtype="hotspot"&gt;Text&lt;/xref&gt;
                                      &lt;/def&gt;
                                  &lt;/deflist&gt;
                              &lt;/legend&gt;
                          &lt;/figure&gt;
                      &lt;/drill&gt;
                  &lt;/para0&gt;
              &lt;/descacrw&gt;
          &lt;/acrw&gt;
      &lt;/content&gt;
  &lt;/dmodule&gt; 
  </code></pre>
  
  <p>sample xsd:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"&gt;
      &lt;xs:element name="dmodule"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="idstatus"/&gt;
                  &lt;xs:element ref="content"/&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="modelic" type="modelicType"/&gt;
      &lt;xs:element name="supeqvc" type="supeqvcType"/&gt;
      &lt;xs:element name="ecscs" type="ecscsType"/&gt;
      &lt;xs:element name="eidc" type="eidcType"/&gt;
      &lt;xs:element name="cidc" type="cidcType"/&gt;
      &lt;xs:element name="discode" type="discodeType"/&gt;
      &lt;xs:element name="discodev" type="discodevType"/&gt;
      &lt;xs:element name="incode" type="incodeType"/&gt;
      &lt;xs:element name="incodev" type="incodevType"/&gt;
      &lt;xs:element name="itemloc" type="itemlocType"/&gt;
  
      &lt;xs:element name="techname" type="xs:string"/&gt;
      &lt;xs:element name="infoname" type="xs:string"/&gt;
  
      &lt;xs:element name="issno"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:attribute name="issno" type="issnovalueType" use="required"/&gt;
              &lt;xs:attribute name="type" type="issnotypeType" default="new"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="issdate"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:attribute name="year" type="YEAR" use="required"/&gt;
              &lt;xs:attribute name="month" type="MONTH" use="required"/&gt;
              &lt;xs:attribute name="day" type="DAY" use="required"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="language"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:attribute name="language" type="languagetypeType" use="required"/&gt;
              &lt;xs:attribute name="country" type="countryType"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="security"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:attribute ref="class" use="required"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="rpc"&gt;
          &lt;xs:complexType mixed="true"&gt;
              &lt;xs:attribute name="rpcname" type="xs:string"/&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="orig"&gt;
          &lt;xs:complexType mixed="true"&gt;
              &lt;xs:attribute name="origname" type="xs:string"/&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="applic"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="type" minOccurs="0"/&gt;
                  &lt;xs:element ref="model" minOccurs="0"/&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
              &lt;xs:attribute name="level" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute name="mark" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute ref="change"/&gt;
              &lt;xs:attribute name="rfc" type="xs:string"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="type" type="xs:string"/&gt;
  
      &lt;xs:element name="model"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="version" minOccurs="0" maxOccurs="unbounded"/&gt;
                  &lt;xs:element ref="mfc" minOccurs="0"/&gt;
                  &lt;xs:element ref="batchno" minOccurs="0"/&gt;
                  &lt;xs:element ref="moduleno" minOccurs="0" maxOccurs="unbounded"/&gt;
                  &lt;xs:element ref="serialno" minOccurs="0"/&gt;
                  &lt;xs:element ref="pnr" minOccurs="0" maxOccurs="unbounded"/&gt;
                  &lt;xs:element ref="nsn" minOccurs="0"/&gt;
                  &lt;xs:element ref="customer" minOccurs="0"/&gt;
                  &lt;xs:element ref="softprog" minOccurs="0"/&gt;
                  &lt;xs:element ref="config" minOccurs="0"/&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="model" type="xs:string" use="required"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="version"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="versrank" minOccurs="0" maxOccurs="unbounded"/&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="version" type="xs:string" use="required"/&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="unverif"&gt;
          &lt;xs:complexType/&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="firstver"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:attribute name="type" type="firstvertypeType" use="required"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="sbc"&gt;
          &lt;xs:complexType mixed="true"&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="content"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="refs"/&gt;
                  &lt;xs:element ref="acrw"/&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="refs"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:choice&gt;
                  &lt;xs:element ref="norefs"/&gt;
                  &lt;xs:element ref="rdandrt"/&gt;
                  &lt;xs:element ref="refdms"/&gt;
                  &lt;xs:element ref="reftp"/&gt;
              &lt;/xs:choice&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="refdms"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="refdm" maxOccurs="unbounded"/&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="refdm"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="applic" minOccurs="0"/&gt;
                  &lt;xs:choice&gt;
                      &lt;xs:element ref="age"/&gt;
                      &lt;xs:element ref="avee"/&gt;
                  &lt;/xs:choice&gt;
                  &lt;xs:element ref="issno" minOccurs="0"/&gt;
                  &lt;xs:element ref="dmtitle" minOccurs="0"/&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="target" type="xs:string"/&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
              &lt;xs:attribute name="level" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute name="mark" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute ref="change"/&gt;
              &lt;xs:attribute name="rfc" type="xs:string"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="xref"&gt;
          &lt;xs:complexType mixed="true"&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="applic" minOccurs="0"/&gt;
                  &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
                      &lt;xs:element ref="subscrpt"/&gt;
                      &lt;xs:element ref="supscrpt"/&gt;
                  &lt;/xs:choice&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="xrefid" type="xs:IDREF"/&gt;
              &lt;xs:attribute ref="xidtype"/&gt;
              &lt;xs:attribute name="target" type="xs:string"/&gt;
              &lt;xs:attribute name="destitle" type="xs:string"/&gt;
              &lt;xs:attribute name="pretext" type="xs:string"/&gt;
              &lt;xs:attribute name="posttext" type="xs:string"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="symbol"&gt;
          &lt;xs:complexType mixed="true"&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="applic" minOccurs="0"/&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="boardno" type="xs:ENTITY" use="required"/&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="acrw"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:choice&gt;
                  &lt;xs:element ref="frc"/&gt;
                  &lt;xs:element ref="descacrw"/&gt;
              &lt;/xs:choice&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
              &lt;xs:attribute ref="class"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="title"&gt;
          &lt;xs:complexType mixed="true"&gt;
              &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
  
                  &lt;xs:element ref="xref"/&gt;
                  &lt;xs:element ref="indxflag"/&gt;
                  &lt;xs:element ref="change"/&gt;
                  &lt;xs:element ref="emphasis"/&gt;
                  &lt;xs:element ref="symbol"/&gt;
                  &lt;xs:element ref="subscrpt"/&gt;
                  &lt;xs:element ref="supscrpt"/&gt;
                  &lt;xs:element ref="refdm"/&gt;
                  &lt;xs:element ref="reftp"/&gt;
                  &lt;xs:element ref="capgrp"/&gt;
                  &lt;xs:element ref="caption"/&gt;
              &lt;/xs:choice&gt;
              &lt;xs:attribute ref="class"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="graphic"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="hotspot" minOccurs="0" maxOccurs="unbounded"/&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="boardno" type="xs:ENTITY" use="required"/&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="hotspot"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="applic" minOccurs="0"/&gt;
                  &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
                      &lt;xs:element ref="hotspot"/&gt;
                      &lt;xs:element ref="xref"/&gt;
                  &lt;/xs:choice&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
              &lt;xs:attribute name="apsid" type="xs:string"/&gt;
              &lt;xs:attribute name="apsname" type="xs:string"/&gt;
              &lt;xs:attribute name="type" type="xs:string"/&gt;
              &lt;xs:attribute name="title" type="xs:string"/&gt;
              &lt;xs:attribute name="descript" type="xs:string"/&gt;
              &lt;xs:attribute name="coords" type="xs:string"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="para"&gt;
          &lt;xs:complexType mixed="true"&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="applic" minOccurs="0"/&gt;
                  &lt;xs:choice maxOccurs="unbounded"&gt;
                      &lt;xs:choice minOccurs="0"&gt;
  
                          &lt;xs:element ref="xref"/&gt;
                          &lt;xs:element ref="indxflag"/&gt;
                          &lt;xs:element ref="change"/&gt;
                          &lt;xs:element ref="emphasis"/&gt;
                          &lt;xs:element ref="symbol"/&gt;
                          &lt;xs:element ref="subscrpt"/&gt;
                          &lt;xs:element ref="supscrpt"/&gt;
                          &lt;xs:element ref="refdm"/&gt;
                          &lt;xs:element ref="reftp"/&gt;
                          &lt;xs:element ref="capgrp"/&gt;
                          &lt;xs:element ref="caption"/&gt;
                      &lt;/xs:choice&gt;
                      &lt;xs:choice&gt;
                          &lt;xs:element ref="seqlist"/&gt;
                          &lt;xs:element ref="randlist"/&gt;
                          &lt;xs:element ref="deflist"/&gt;
                      &lt;/xs:choice&gt;
                  &lt;/xs:choice&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
              &lt;xs:attribute name="level" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute name="mark" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute ref="change"/&gt;
              &lt;xs:attribute name="rfc" type="xs:string"/&gt;
              &lt;xs:attribute ref="class"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="item"&gt;
          &lt;xs:complexType mixed="true"&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="applic" minOccurs="0"/&gt;
                  &lt;xs:choice maxOccurs="unbounded"&gt;
                      &lt;xs:element ref="para"/&gt;
                      &lt;xs:choice maxOccurs="unbounded"&gt;
                          &lt;xs:choice minOccurs="0"&gt;
  
                              &lt;xs:element ref="xref"/&gt;
                              &lt;xs:element ref="indxflag"/&gt;
                              &lt;xs:element ref="change"/&gt;
                              &lt;xs:element ref="emphasis"/&gt;
                              &lt;xs:element ref="symbol"/&gt;
                              &lt;xs:element ref="subscrpt"/&gt;
                              &lt;xs:element ref="supscrpt"/&gt;
                              &lt;xs:element ref="refdm"/&gt;
                              &lt;xs:element ref="reftp"/&gt;
                              &lt;xs:element ref="capgrp"/&gt;
                              &lt;xs:element ref="caption"/&gt;
                          &lt;/xs:choice&gt;
                          &lt;xs:choice&gt;
                              &lt;xs:element ref="seqlist"/&gt;
                              &lt;xs:element ref="randlist"/&gt;
                              &lt;xs:element ref="deflist"/&gt;
                          &lt;/xs:choice&gt;
                      &lt;/xs:choice&gt;
                  &lt;/xs:choice&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
              &lt;xs:attribute name="level" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute name="mark" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute ref="change"/&gt;
              &lt;xs:attribute name="rfc" type="xs:string"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="deflist"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:sequence minOccurs="0"&gt;
                      &lt;xs:element ref="applic" minOccurs="0"/&gt;
                      &lt;xs:element ref="title"/&gt;
                  &lt;/xs:sequence&gt;
                  &lt;xs:sequence maxOccurs="unbounded"&gt;
                      &lt;xs:element ref="term"/&gt;
                      &lt;xs:element ref="def"/&gt;
                  &lt;/xs:sequence&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
              &lt;xs:attribute name="level" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute name="mark" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute ref="change"/&gt;
              &lt;xs:attribute name="rfc" type="xs:string"/&gt;
              &lt;xs:attribute ref="class"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="term"&gt;
          &lt;xs:complexType mixed="true"&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="applic" minOccurs="0"/&gt;
                  &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
  
                      &lt;xs:element ref="xref"/&gt;
                      &lt;xs:element ref="indxflag"/&gt;
                      &lt;xs:element ref="change"/&gt;
                      &lt;xs:element ref="emphasis"/&gt;
                      &lt;xs:element ref="symbol"/&gt;
                      &lt;xs:element ref="subscrpt"/&gt;
                      &lt;xs:element ref="supscrpt"/&gt;
                      &lt;xs:element ref="refdm"/&gt;
                      &lt;xs:element ref="reftp"/&gt;
                      &lt;xs:element ref="capgrp"/&gt;
                      &lt;xs:element ref="caption"/&gt;
                  &lt;/xs:choice&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
              &lt;xs:attribute name="level" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute name="mark" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute ref="change"/&gt;
              &lt;xs:attribute name="rfc" type="xs:string"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="def"&gt;
          &lt;xs:complexType mixed="true"&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="applic" minOccurs="0"/&gt;
                  &lt;xs:choice maxOccurs="unbounded"&gt;
                      &lt;xs:element ref="para"/&gt;
                      &lt;xs:choice maxOccurs="unbounded"&gt;
                          &lt;xs:choice minOccurs="0"&gt;
  
                              &lt;xs:element ref="xref"/&gt;
                              &lt;xs:element ref="indxflag"/&gt;
                              &lt;xs:element ref="change"/&gt;
                              &lt;xs:element ref="emphasis"/&gt;
                              &lt;xs:element ref="symbol"/&gt;
                              &lt;xs:element ref="subscrpt"/&gt;
                              &lt;xs:element ref="supscrpt"/&gt;
                              &lt;xs:element ref="refdm"/&gt;
                              &lt;xs:element ref="reftp"/&gt;
                              &lt;xs:element ref="capgrp"/&gt;
                              &lt;xs:element ref="caption"/&gt;
                          &lt;/xs:choice&gt;
                          &lt;xs:choice&gt;
                              &lt;xs:element ref="seqlist"/&gt;
                              &lt;xs:element ref="randlist"/&gt;
                              &lt;xs:element ref="deflist"/&gt;
                          &lt;/xs:choice&gt;
                      &lt;/xs:choice&gt;
                  &lt;/xs:choice&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
              &lt;xs:attribute name="level" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute name="mark" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute ref="change"/&gt;
              &lt;xs:attribute name="rfc" type="xs:string"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="drill"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:sequence&gt;
                      &lt;xs:element ref="applic" minOccurs="0"/&gt;
                      &lt;xs:element ref="title" minOccurs="0"/&gt;
                      &lt;xs:element ref="tabtitle" minOccurs="0"/&gt;
                      &lt;xs:sequence&gt;
                          &lt;xs:element ref="warning" minOccurs="0" maxOccurs="unbounded"/&gt;
                          &lt;xs:element ref="caution" minOccurs="0" maxOccurs="unbounded"/&gt;
                          &lt;xs:element ref="note" minOccurs="0" maxOccurs="unbounded"/&gt;
                      &lt;/xs:sequence&gt;
                      &lt;xs:element ref="crew" minOccurs="0" maxOccurs="unbounded"/&gt;
                      &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
                          &lt;xs:element ref="para"/&gt;
                          &lt;xs:choice&gt;
                              &lt;xs:element ref="figure"/&gt;
                              &lt;xs:element ref="table"/&gt;
                              &lt;xs:element ref="foldout"/&gt;
                          &lt;/xs:choice&gt;
                      &lt;/xs:choice&gt;
                  &lt;/xs:sequence&gt;
                  &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
                      &lt;xs:choice maxOccurs="unbounded"&gt;
                          &lt;xs:element ref="step"/&gt;
                          &lt;xs:choice&gt;
                              &lt;xs:sequence&gt;
                                  &lt;xs:element ref="if"/&gt;
                                  &lt;xs:element ref="elseif" minOccurs="0" maxOccurs="unbounded"/&gt;
                              &lt;/xs:sequence&gt;
                              &lt;xs:element ref="case"/&gt;
                          &lt;/xs:choice&gt;
                      &lt;/xs:choice&gt;
                      &lt;xs:element ref="subdrill" minOccurs="0" maxOccurs="unbounded"/&gt;
                  &lt;/xs:choice&gt;
                  &lt;xs:element ref="endmattr" minOccurs="0"/&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute ref="drilltyp" default="none"/&gt;
              &lt;xs:attribute ref="ordered" default="on"/&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
              &lt;xs:attribute name="level" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute name="mark" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute ref="change"/&gt;
              &lt;xs:attribute name="rfc" type="xs:string"/&gt;
              &lt;xs:attribute ref="class"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="step"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:sequence&gt;
                      &lt;xs:element ref="applic" minOccurs="0"/&gt;
                      &lt;xs:sequence&gt;
                          &lt;xs:element ref="warning" minOccurs="0" maxOccurs="unbounded"/&gt;
                          &lt;xs:element ref="caution" minOccurs="0" maxOccurs="unbounded"/&gt;
                          &lt;xs:element ref="note" minOccurs="0" maxOccurs="unbounded"/&gt;
                      &lt;/xs:sequence&gt;
                      &lt;xs:sequence minOccurs="0" maxOccurs="unbounded"&gt;
                          &lt;xs:element ref="para"/&gt;
                          &lt;xs:element ref="note" minOccurs="0" maxOccurs="unbounded"/&gt;
                          &lt;xs:choice minOccurs="0"&gt;
                              &lt;xs:element ref="figure"/&gt;
                              &lt;xs:element ref="table"/&gt;
                              &lt;xs:element ref="foldout"/&gt;
                          &lt;/xs:choice&gt;
                      &lt;/xs:sequence&gt;
                      &lt;xs:choice&gt;
                          &lt;xs:sequence&gt;
                              &lt;xs:element ref="crew" minOccurs="0" maxOccurs="unbounded"/&gt;
                              &lt;xs:element ref="procd"/&gt;
                              &lt;xs:choice minOccurs="0"&gt;
                                  &lt;xs:element ref="figure"/&gt;
                                  &lt;xs:element ref="table"/&gt;
                                  &lt;xs:element ref="foldout"/&gt;
                              &lt;/xs:choice&gt;
                          &lt;/xs:sequence&gt;
                          &lt;xs:sequence&gt;
                              &lt;xs:element ref="challeng"/&gt;
                              &lt;xs:sequence maxOccurs="unbounded"&gt;
                                  &lt;xs:element ref="crew" minOccurs="0" maxOccurs="unbounded"/&gt;
                                  &lt;xs:element ref="response"/&gt;
                              &lt;/xs:sequence&gt;
                          &lt;/xs:sequence&gt;
                      &lt;/xs:choice&gt;
                      &lt;xs:element ref="note" minOccurs="0" maxOccurs="unbounded"/&gt;
                  &lt;/xs:sequence&gt;
                  &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
                      &lt;xs:element ref="step"/&gt;
                      &lt;xs:choice&gt;
                          &lt;xs:sequence&gt;
                              &lt;xs:element ref="if"/&gt;
                              &lt;xs:element ref="elseif" minOccurs="0" maxOccurs="unbounded"/&gt;
                          &lt;/xs:sequence&gt;
                          &lt;xs:element ref="case"/&gt;
                      &lt;/xs:choice&gt;
                  &lt;/xs:choice&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="label" type="xs:string"/&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
              &lt;xs:attribute name="level" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute name="mark" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute ref="change"/&gt;
              &lt;xs:attribute name="rfc" type="xs:string"/&gt;
              &lt;xs:attribute ref="memorize" default="no"/&gt;
              &lt;xs:attribute ref="dotline" default="dot"/&gt;
              &lt;xs:attribute ref="ordered" default="on"/&gt;
              &lt;xs:attribute ref="class"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="procd"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="applic" minOccurs="0"/&gt;
                  &lt;xs:element ref="para"/&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="figure"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:sequence&gt;
                      &lt;xs:element ref="applic" minOccurs="0"/&gt;
                      &lt;xs:element ref="title"/&gt;
                  &lt;/xs:sequence&gt;
                  &lt;xs:choice&gt;
                      &lt;xs:sequence&gt;
                          &lt;xs:element ref="graphic"/&gt;
                          &lt;xs:element ref="rfa" minOccurs="0" maxOccurs="unbounded"/&gt;
                      &lt;/xs:sequence&gt;
                      &lt;xs:sequence maxOccurs="unbounded"&gt;
                          &lt;xs:element ref="sheet"/&gt;
                          &lt;xs:element ref="graphic"/&gt;
                          &lt;xs:element ref="rfa" minOccurs="0" maxOccurs="unbounded"/&gt;
                      &lt;/xs:sequence&gt;
                  &lt;/xs:choice&gt;
                  &lt;xs:element ref="legend" minOccurs="0"/&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
              &lt;xs:attribute name="level" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute name="mark" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute ref="change"/&gt;
              &lt;xs:attribute name="rfc" type="xs:string"/&gt;
              &lt;xs:attribute ref="class"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="legend"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="deflist"/&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="descacrw"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
                  &lt;xs:sequence&gt;
                      &lt;xs:sequence&gt;
                          &lt;xs:element ref="warning" minOccurs="0" maxOccurs="unbounded"/&gt;
                          &lt;xs:element ref="caution" minOccurs="0" maxOccurs="unbounded"/&gt;
                          &lt;xs:element ref="note" minOccurs="0" maxOccurs="unbounded"/&gt;
                      &lt;/xs:sequence&gt;
                      &lt;xs:element ref="para0" minOccurs="0" maxOccurs="unbounded"/&gt;
                  &lt;/xs:sequence&gt;
                  &lt;xs:choice&gt;
                      &lt;xs:element ref="figure"/&gt;
                      &lt;xs:element ref="table"/&gt;
                      &lt;xs:element ref="foldout"/&gt;
                  &lt;/xs:choice&gt;
              &lt;/xs:choice&gt;
              &lt;xs:attribute ref="class"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:element name="para0"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:sequence&gt;
                      &lt;xs:sequence&gt;
                          &lt;xs:element ref="applic" minOccurs="0"/&gt;
                          &lt;xs:element ref="title" minOccurs="0"/&gt;
                      &lt;/xs:sequence&gt;
                      &lt;xs:sequence&gt;
                          &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
                              &lt;xs:element ref="specpara"/&gt;
                              &lt;xs:element ref="para"/&gt;
                              &lt;xs:choice minOccurs="0"&gt;
                                  &lt;xs:element ref="figure"/&gt;
                                  &lt;xs:element ref="table"/&gt;
                                  &lt;xs:element ref="foldout"/&gt;
                              &lt;/xs:choice&gt;
                          &lt;/xs:choice&gt;
                          &lt;xs:element ref="drill" minOccurs="0"/&gt;
                      &lt;/xs:sequence&gt;
                  &lt;/xs:sequence&gt;
                  &lt;xs:element ref="subpara1" minOccurs="0" maxOccurs="unbounded"/&gt;
              &lt;/xs:sequence&gt;
              &lt;xs:attribute name="id" type="xs:ID"/&gt;
              &lt;xs:attribute name="level" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute name="mark" type="xs:NMTOKEN"/&gt;
              &lt;xs:attribute ref="change"/&gt;
              &lt;xs:attribute name="rfc" type="xs:string"/&gt;
              &lt;xs:attribute ref="class"/&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
  
      &lt;xs:simpleType name="modelicType"&gt;
          &lt;xs:restriction base="xs:string"&gt;
              &lt;xs:pattern value="[A-Za-z0-9]{2,14}"/&gt;
          &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
      &lt;xs:simpleType name="discodeType"&gt;
          &lt;xs:restriction base="xs:string"&gt;
              &lt;xs:pattern value="[A-Za-z0-9]{2}"/&gt;
          &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
      &lt;xs:simpleType name="discodevType"&gt;
          &lt;xs:restriction base="xs:string"&gt;
              &lt;xs:pattern value="[A-Za-z0-9]{1,3}"/&gt;
          &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
      &lt;xs:simpleType name="incodeType"&gt;
          &lt;xs:restriction base="xs:string"&gt;
              &lt;xs:pattern value="[A-Za-z0-9]{3}"/&gt;
          &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
      &lt;xs:simpleType name="incodevType"&gt;
          &lt;xs:restriction base="xs:string"&gt;
              &lt;xs:pattern value="[A-Za-z0-9]{1}"/&gt;
          &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
      &lt;xs:simpleType name="itemlocType"&gt;
          &lt;xs:restriction base="xs:string"&gt;
              &lt;xs:pattern value="[A-Za-z0-9]{1}"/&gt;
          &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
      &lt;xs:simpleType name="sdcType"&gt;
          &lt;xs:restriction base="xs:string"&gt;
              &lt;xs:pattern value="[A-Za-z0-9]{1,4}"/&gt;
          &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
      &lt;xs:simpleType name="issnovalueType"&gt;
          &lt;xs:restriction base="xs:nonNegativeInteger"&gt;
              &lt;xs:pattern value="\d{3}"/&gt;
          &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
      &lt;xs:attribute name="xidtype"&gt;
          &lt;xs:simpleType&gt;
              &lt;xs:restriction base="xs:token"&gt;
                  &lt;xs:enumeration value="figure"/&gt;
                  &lt;xs:enumeration value="table"/&gt;
                  &lt;xs:enumeration value="supply"/&gt;
                  &lt;xs:enumeration value="supequip"/&gt;
                  &lt;xs:enumeration value="spares"/&gt;
                  &lt;xs:enumeration value="para"/&gt;
                  &lt;xs:enumeration value="step"/&gt;
                  &lt;xs:enumeration value="sheet"/&gt;
                  &lt;xs:enumeration value="hotspot"/&gt;
                  &lt;xs:enumeration value="other"/&gt;
              &lt;/xs:restriction&gt;
          &lt;/xs:simpleType&gt;
      &lt;/xs:attribute&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>I am not the author from the xsd file, so I cannot change it.
  When I use Oxygen to validate the xml file, it validates successfully, which is right. But if I use Oxygen with the MSXML engine or my C# program, it does not validates, the error says: ENTITIY 'name' referenced but not declared.</p>
  
  <p>Does anyone knows why the .NET parser did not "know" the ENTITIES?</p>
  
  <p>UPDATE: </p>
  
  <p>I added a better example. The original XSD file is about 5.000 lines long, so I tried to just copy the important part. So, the xml file is valid and Oxygen validates it correctly using default engine, xerces and saxon. BUT, with the MSXML .NET or MSXML 4.0 engine, the parser throws the same error as my program:</p>
  
  <pre><code>Programname: MSXML.NET
  description: Verweis auf eine nicht deklarierte ID ist 'fi0001-hot3'.
  line: 73 position: 34 (&lt;para&gt;Text&lt;xref xrefid="fi0001-hot3" xidtype="hotspot"&gt;)
  
  Programname: MSXML.NET
  description: Verweis auf eine nicht deklarierte ID ist 'fi0001-hot2'.
  line: 68 position: 16 (&lt;xref xrefid="fi0001-hot2" xidtype="hotspot"&gt;Text&lt;/xref&gt;)
  </code></pre>
  
  <p>And sometimes it even throws the error:</p>
  
  <pre><code>Programname: MSXML.NET
  description: Verweis auf eine nicht deklarierte ENTITY ist 'entity1'.
  </code></pre>
  
  <p>But only the MSXML parser, the others working correctly.</p>
  
  <p>So why has the MSXML parser a problem with ENTITIES and ID declarations?</p>