title: DTD. Where did i make a mistake?
body: <p>I try to parse this xml file with DOM parser and My code return me correct result but in runtime, ErrorHandler call "error" method which print me "error" it mean that I I somewhere made a mistake. I think that my mistake in DTD, but I don't know where.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE configuration[
  &lt;!ELEMENT configuration (font, window, display)+&gt;
  &lt;!ELEMENT display (font, window)&gt;
  &lt;!ATTLIST display id ID #REQUIRED&gt;
  &lt;!ELEMENT font (name, size)&gt;
   &lt;!ELEMENT name (#PCDATA)&gt;
   &lt;!ELEMENT size (#PCDATA)&gt;
   &lt;!ELEMENT window (height, width)&gt;
   &lt;!ELEMENT height (#PCDATA)&gt;
   &lt;!ELEMENT width (#PCDATA)&gt;
  ]&gt;
  &lt;configuration&gt;
   &lt;display id="112"&gt;
    &lt;font&gt;
     &lt;name&gt;Arial&lt;/name&gt;
     &lt;size&gt;48&lt;/size&gt;
    &lt;/font&gt;
    &lt;window&gt;
     &lt;height&gt;1080&lt;/height&gt;
     &lt;width&gt;1920&lt;/width&gt;
    &lt;/window&gt; 
   &lt;/display&gt;
   &lt;display id="2893"&gt;
    &lt;font&gt;
     &lt;name&gt;ArialBlack&lt;/name&gt;
     &lt;size&gt;25&lt;/size&gt;
    &lt;/font&gt;
    &lt;window&gt;
     &lt;height&gt;480&lt;/height&gt;
     &lt;width&gt;640&lt;/width&gt;
    &lt;/window&gt; 
   &lt;/display&gt; 
  &lt;/configuration&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <pre><code>public class DisplayConfig {
  
  private static String path;
  
  private String fontName;
  private int fontSize;
  private int height;
  private int width;
  
  
  
  public static void setPath(String path) {
      DisplayConfig.path = path;
  }
  
  public DisplayConfig(){
  
  }
  
  
  public DisplayConfig(String fontName, int fontSize, int width, int height) {
      this.fontName = fontName;
      this.fontSize = fontSize;
      this.height = height;
      this.width = width;
  }
  
  @Override
  public String toString() {
      return "[Resolution:" + this.width + "x" + this.height + ", Font:" + this.fontName + ", Font size:" + this.fontSize + "]";
  }
  
  
  
  public static DisplayConfig getDisplayConfig(int id) throws ParserConfigurationException, SAXException, IOException{
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      factory.setValidating(true);
      factory.setIgnoringElementContentWhitespace(true);
  
      DocumentBuilder builder = factory.newDocumentBuilder();
      builder.setErrorHandler(new ErrorHandler() {
  
          @Override
          public void warning(SAXParseException exception) throws SAXException {
              System.out.println("warning");
  
          }
  
          @Override
          public void fatalError(SAXParseException exception) throws SAXException {
              System.out.println("fatal error");
          }
  
          @Override
          public void error(SAXParseException exception) throws SAXException {
              System.out.println("error");
  
          }
      });
  
      Document document = builder.parse(path);
  
      Element root = document.getDocumentElement();
  
      NodeList displays = root.getElementsByTagName("display");
  
      Element display = null;
  
      for(int i = 0; i&lt;displays.getLength(); i++){
          Element d = (Element) displays.item(i);
          if(Integer.parseInt(d.getAttribute("id")) == id){
              display = d;
              break;
          }
      }
  
      Element font = (Element) display.getElementsByTagName("font").item(0);
      String fontName = font.getElementsByTagName("name").item(0).getTextContent();
      int fontSize = Integer.parseInt(font.getElementsByTagName("size").item(0).getTextContent());
  
      Element window = (Element) display.getElementsByTagName("window").item(0);
      int width = Integer.parseInt(window.getElementsByTagName("width").item(0).getTextContent());
      int height = Integer.parseInt(window.getElementsByTagName("height").item(0).getTextContent());
  
      return new DisplayConfig(fontName, fontSize, width, height);
  
  
  }
  </code></pre>
  
  <p>}</p>