docs: public Document getJspDocument() throws JspCoreException {
          Document document = null;
          /* The isXmlSpecified flag should only be set for top level jsps. */
          /* statically included jsps and tag files will alway have this set to false */
          if (jspInputSource.isXmlDocument()) {
              document = new JspDocumentConverter(jspInputSource,
                                                  resolvedRelativeURL,
                                                  context,
                                                  directoryStack,
                                                  jspConfiguration,
                                                  jspOptions,
                                                  dependencyStack,
                                                  dependencyList,
                                                  cdataJspIdMap,
                                                  implicitTagLibMap).convert();
              jspConfiguration.setIsXml(true);                                                    
          }
          else {
          	getSyntaxAndEncoding();
              if ((isXml && isEncodingSpecifiedInProlog)){	// removed || isBomPresent check since that is now covered in getSyntaxAndEncoding()
                  /*
                   * Make sure the encoding explicitly specified in the XML
                   * prolog (if any) matches that in the JSP config element
                   * (if any).
                   */
                  if (jspConfiguration.getPageEncoding() != null && !jspConfiguration.getPageEncoding().equalsIgnoreCase(sourceEnc)
                      && (!jspConfiguration.getPageEncoding().toUpperCase().startsWith("UTF-16") || !sourceEnc.toUpperCase().startsWith("UTF-16"))) {	// see http://unicode.org/faq/utf_bom.html#36 for info on UTF-16
                      throw new JspCoreException("jsp.error.prolog_config_encoding_mismatch", new Object[] { sourceEnc,jspConfiguration.getPageEncoding()});
                  }
              }
               
              if(!isDefaultPageEncoding && !isXml){
              	jspConfiguration.setResponseEncoding(sourceEnc);
              }
              
              if (isXml) {
                  document = parseToDom();	            	
              }
              else {
                  document = getJspDocumentAsJspPage();
              }
          }
          directoryStack.pop();
          return (document);
      }