[566183] Update to DTDParser for Xerces 2.12.1
diff --git a/web/tests/org.eclipse.jst.jsp.ui.tests/src/org/eclipse/jst/jsp/ui/tests/contentassist/TestJSPContentAssistComputers.java b/web/tests/org.eclipse.jst.jsp.ui.tests/src/org/eclipse/jst/jsp/ui/tests/contentassist/TestJSPContentAssistComputers.java
index 8b783efa..0cfe7db 100644
--- a/web/tests/org.eclipse.jst.jsp.ui.tests/src/org/eclipse/jst/jsp/ui/tests/contentassist/TestJSPContentAssistComputers.java
+++ b/web/tests/org.eclipse.jst.jsp.ui.tests/src/org/eclipse/jst/jsp/ui/tests/contentassist/TestJSPContentAssistComputers.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010, 2018 IBM Corporation and others.
+ * Copyright (c) 2010, 2021 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
  * which accompanies this distribution, and is available at
@@ -53,7 +53,8 @@
 	/** The name of the project that all of these tests will use */
 	private static final String PROJECT_NAME = "TestJSPContentAssistComputers";
 	
-	private static final String CONTENT_DIR = "WebContent";
+	// org.eclipse.wst.project.facet.ProductManager.WEB_CONTENT_FOLDER, except, these test projects are static
+	private static final String CONTENT_DIR = "WebContent"; //$NON-NLS-1$
 	
 	/** The project that all of the tests use */
 	private static IProject fProject;
@@ -62,7 +63,7 @@
 	 * Used to keep track of the already open editors so that the tests don't go through
 	 * the trouble of opening the same editors over and over again
 	 */
-	private static Map fFileToEditorMap = new HashMap();
+	private static Map<IFile, IEditorPart> fFileToEditorMap = new HashMap<>();
 	
 	/**
 	 * <p>Default constructor<p>
@@ -436,9 +437,9 @@
 		 */
 		public void tearDown() throws Exception {
 			//close out the editors
-			Iterator iter = fFileToEditorMap.values().iterator();
+			Iterator<IEditorPart> iter = fFileToEditorMap.values().iterator();
 			while(iter.hasNext()) {
-				StructuredTextEditor editor = (StructuredTextEditor)iter.next();
+				IEditorPart editor = iter.next();
 				editor.getSite().getPage().saveEditor(editor, false);
 				editor.getSite().getPage().closeEditor(editor, false);
 			}
diff --git a/web/tests/org.eclipse.wst.sse.unittests/.settings/JUnit Workspace.launch b/web/tests/org.eclipse.wst.sse.unittests/.settings/JUnit Workspace.launch
index f2a1040..876edb6 100644
--- a/web/tests/org.eclipse.wst.sse.unittests/.settings/JUnit Workspace.launch
+++ b/web/tests/org.eclipse.wst.sse.unittests/.settings/JUnit Workspace.launch
@@ -1,30 +1,30 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>

-<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench">

-    <booleanAttribute key="append.args" value="true"/>

-    <booleanAttribute key="askclear" value="true"/>

-    <booleanAttribute key="automaticAdd" value="true"/>

-    <booleanAttribute key="automaticValidate" value="false"/>

-    <stringAttribute key="bootstrap" value=""/>

-    <stringAttribute key="checked" value="[NONE]"/>

-    <booleanAttribute key="clearConfig" value="true"/>

-    <booleanAttribute key="clearws" value="false"/>

-    <booleanAttribute key="clearwslog" value="false"/>

-    <stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/JUnit Workspace"/>

-    <booleanAttribute key="default" value="true"/>

-    <booleanAttribute key="includeOptional" value="true"/>

-    <stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>

-    <stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>

-    <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -showLocation -consoleLog"/>

-    <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>

-    <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx800M -XX:MaxPermSize=160M"/>

-    <stringAttribute key="pde.version" value="3.3"/>

-    <stringAttribute key="product" value="org.eclipse.sdk.ide"/>

-    <booleanAttribute key="show_selected_only" value="false"/>

-    <stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>

-    <booleanAttribute key="tracing" value="false"/>

-    <booleanAttribute key="useCustomFeatures" value="false"/>

-    <booleanAttribute key="useDefaultConfig" value="true"/>

-    <booleanAttribute key="useDefaultConfigArea" value="true"/>

-    <booleanAttribute key="useProduct" value="true"/>

-    <booleanAttribute key="usefeatures" value="false"/>

-</launchConfiguration>

+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench">
+    <booleanAttribute key="append.args" value="true"/>
+    <booleanAttribute key="askclear" value="true"/>
+    <booleanAttribute key="automaticAdd" value="true"/>
+    <booleanAttribute key="automaticValidate" value="false"/>
+    <stringAttribute key="bootstrap" value=""/>
+    <stringAttribute key="checked" value="[NONE]"/>
+    <booleanAttribute key="clearConfig" value="true"/>
+    <booleanAttribute key="clearws" value="false"/>
+    <booleanAttribute key="clearwslog" value="false"/>
+    <stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/JUnit Workspace"/>
+    <booleanAttribute key="default" value="true"/>
+    <booleanAttribute key="includeOptional" value="true"/>
+    <stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+    <stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
+    <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -showLocation -consoleLog"/>
+    <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+    <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx1000M"/>
+    <stringAttribute key="pde.version" value="3.3"/>
+    <stringAttribute key="product" value="org.eclipse.sdk.ide"/>
+    <booleanAttribute key="show_selected_only" value="false"/>
+    <stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
+    <booleanAttribute key="tracing" value="false"/>
+    <booleanAttribute key="useCustomFeatures" value="false"/>
+    <booleanAttribute key="useDefaultConfig" value="true"/>
+    <booleanAttribute key="useDefaultConfigArea" value="true"/>
+    <booleanAttribute key="useProduct" value="true"/>
+    <booleanAttribute key="usefeatures" value="false"/>
+</launchConfiguration>
diff --git a/xml/bundles/org.eclipse.wst.dtd.core/META-INF/MANIFEST.MF b/xml/bundles/org.eclipse.wst.dtd.core/META-INF/MANIFEST.MF
index 810388d..77d7706 100644
--- a/xml/bundles/org.eclipse.wst.dtd.core/META-INF/MANIFEST.MF
+++ b/xml/bundles/org.eclipse.wst.dtd.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.wst.dtd.core; singleton:=true
-Bundle-Version: 1.2.100.qualifier
+Bundle-Version: 1.2.200.qualifier
 Bundle-Activator: org.eclipse.wst.dtd.core.internal.DTDCorePlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/xml/bundles/org.eclipse.wst.dtd.core/pom.xml b/xml/bundles/org.eclipse.wst.dtd.core/pom.xml
index f47acde..67a6cbd 100644
--- a/xml/bundles/org.eclipse.wst.dtd.core/pom.xml
+++ b/xml/bundles/org.eclipse.wst.dtd.core/pom.xml
@@ -21,7 +21,7 @@
 
   <groupId>org.eclipse.webtools.sourceediting</groupId>
   <artifactId>org.eclipse.wst.dtd.core</artifactId>
-  <version>1.2.100-SNAPSHOT</version>
+  <version>1.2.200-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
   <build>
diff --git a/xml/bundles/org.eclipse.wst.dtd.core/saxparser/org/eclipse/wst/dtd/core/internal/saxparser/DTDParser.java b/xml/bundles/org.eclipse.wst.dtd.core/saxparser/org/eclipse/wst/dtd/core/internal/saxparser/DTDParser.java
index 1d09a55..8fd6a8c 100644
--- a/xml/bundles/org.eclipse.wst.dtd.core/saxparser/org/eclipse/wst/dtd/core/internal/saxparser/DTDParser.java
+++ b/xml/bundles/org.eclipse.wst.dtd.core/saxparser/org/eclipse/wst/dtd/core/internal/saxparser/DTDParser.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2001, 2020 IBM Corporation and others.
+ * Copyright (c) 2001, 2021 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
  * which accompanies this distribution, and is available at
@@ -28,6 +28,7 @@
 import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver;
 import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin;
 import org.eclipse.wst.common.uriresolver.internal.util.URIHelper;
+import org.eclipse.wst.dtd.core.internal.Logger;
 import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
 import org.eclipse.wst.xml.core.internal.preferences.XMLCorePreferenceNames;
 import org.eclipse.wst.xml.core.internal.validation.core.LazyURLInputStream;
@@ -37,6 +38,8 @@
 import org.xml.sax.InputSource;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.ext.DeclHandler;
@@ -57,7 +60,7 @@
 	// private Vector declElements;
 	private String comment = null;
 	private ErrorMessage errorMessage = null;
-	private List errorMessages = new ArrayList();
+	private List<ErrorMessage> errorMessages = new ArrayList();
 	private DeclNode previousDeclNode = null;
 	private DeclNode currentDeclNode = null;
 	private BaseNode lastBaseNode = null;
@@ -66,15 +69,15 @@
 	private int lineNumber;
 
 	private DTD currentDTD = null;
-	private Vector dtdList = new Vector();
+	private Vector<DTD> dtdList = new Vector();
 
-	private Stack dtdStack = new Stack();
-	private Stack peRefStack = new Stack();
-	private Stack parsingPERefStack = new Stack();
+	private Stack<DTD> dtdStack = new Stack();
+	private Stack<String> peRefStack = new Stack();
+	private Stack<Boolean> parsingPERefStack = new Stack();
 
 	private EntityPool entityPool = new EntityPool();
 	private String expandedEntityValue = null;
-	private Hashtable elementPool = new Hashtable();
+	private Hashtable<String, BaseNode> elementPool = new Hashtable<>();
 
 	boolean parsingExternalPEReference = false;
 	protected boolean expandEntityReferences = true;
@@ -100,6 +103,7 @@
 
 		this.canonical = canonical;
 		try {
+//			SAXParser sparser = SAXParserFactory.newInstance("org.apache.xerces.jaxp.SAXParserFactoryImpl", null).newSAXParser();
 			SAXParser sparser = SAXParserFactory.newInstance().newSAXParser();
 			reader = sparser.getXMLReader();
 			reader.setProperty("http://xml.org/sax/properties/declaration-handler", this); //$NON-NLS-1$
@@ -141,6 +145,7 @@
 				currentDTD.setIsExceptionDuringParse(true);
 		}
 		catch (Exception e) {
+			Logger.logException(e);
 			if (currentDTD != null)
 				currentDTD.setIsExceptionDuringParse(true);
 		}
@@ -151,7 +156,19 @@
 	 * @deprecated Entity references are always expanded.
 	 */
 	public void setExpandEntityReferences(boolean expandEntityReferences) {
-		this.expandEntityReferences = true;
+		try {
+			this.expandEntityReferences = expandEntityReferences;
+			reader.setFeature("http://xml.org/sax/features/external-general-entities", expandEntityReferences); //$NON-NLS-1$
+			reader.setFeature("http://xml.org/sax/features/external-parameter-entities", expandEntityReferences); //$NON-NLS-1$
+		}
+		catch (SAXNotRecognizedException | SAXNotSupportedException se) {
+			if (currentDTD != null)
+				currentDTD.setIsExceptionDuringParse(false);
+		}
+		catch (Exception e) {
+			if (currentDTD != null)
+				currentDTD.setIsExceptionDuringParse(false);
+		}
 	}
 
 	/*
@@ -414,13 +431,13 @@
 
 	protected boolean parseExternalPEReference(String name) {
 		if (!peRefStack.empty()) {
-			if (((String) peRefStack.peek()).equals(name)) {
+			if (peRefStack.peek().equals(name)) {
 				peRefStack.pop();
 				if (parsingExternalPEReference) {
-					currentDTD = (DTD) dtdStack.pop();
+					currentDTD = dtdStack.pop();
 					addPEReferenceNode(name);
 				}
-				parsingExternalPEReference = ((Boolean) parsingPERefStack.pop()).booleanValue();
+				parsingExternalPEReference = parsingPERefStack.pop().booleanValue();
 				return true;
 			}
 		}
@@ -561,8 +578,7 @@
 					break;
 				}
 				case DeclNode.EXTERNAL_ENTITY : {
-					boolean resolveExternalEntities = InstanceScope.INSTANCE.getNode(XMLCorePlugin.getDefault().getBundle().getSymbolicName()).getBoolean(XMLCorePreferenceNames.RESOLVE_EXTERNAL_ENTITIES, false);
-					if (!resolveExternalEntities) {
+					if (!this.expandEntityReferences) {
 						break;
 					}
 				}