[352148] JSP Validator will not allow use of default namespace
diff --git a/bundles/org.eclipse.jst.jsp.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.jst.jsp.core/META-INF/MANIFEST.MF
index 98a565c..69ba8ba 100644
--- a/bundles/org.eclipse.jst.jsp.core/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.jst.jsp.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jst.jsp.core; singleton:=true
-Bundle-Version: 1.2.127.qualifier
+Bundle-Version: 1.2.128.qualifier
 Bundle-Activator: org.eclipse.jst.jsp.core.internal.JSPCorePlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/validation/JSPContentValidator.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/validation/JSPContentValidator.java
index eb30903..523db2b 100644
--- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/validation/JSPContentValidator.java
+++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/validation/JSPContentValidator.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2011 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -28,12 +28,16 @@
 import org.eclipse.wst.xml.core.internal.document.DocumentTypeAdapter;
 import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
 import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.w3c.dom.Element;
 
 /**
  * This validator validates the contents of the content type of the JSP, like
  * the HTML regions in a JSP with content type="text/html"
  */
 public class JSPContentValidator extends JSPValidator {
+	private static final String HTTP_JAVA_SUN_COM_JSP_PAGE = "http://java.sun.com/JSP/Page"; //$NON-NLS-1$
+	private static final String XMLNS = "xmlns"; //$NON-NLS-1$
+	private static final String XMLNS_JSP = "xmlns:jsp"; //$NON-NLS-1$
 	private IContentType fJSPFContentType;
 
 	/*
@@ -46,6 +50,11 @@
 		return adapter.hasFeature(HTMLDocumentTypeConstants.HTML);
 	}
 
+	private boolean isXMLJSP(IDOMDocument document) {
+		Element root = document.getDocumentElement();
+		return root != null && (root.hasAttribute(XMLNS_JSP) || HTTP_JAVA_SUN_COM_JSP_PAGE.equals(root.getAttribute(XMLNS)));
+	}
+
 	/**
 	 * Returns JSP fragment content type
 	 * 
@@ -88,7 +97,7 @@
 
 		// This validator currently only handles validating HTML content in
 		// JSP
-		if (hasHTMLFeature(document)) {
+		if (hasHTMLFeature(document) && !isXMLJSP(document)) {
 			INodeAdapterFactory factory = HTMLValidationAdapterFactory.getInstance();
 			ValidationAdapter adapter = (ValidationAdapter) factory.adapt(document);
 			if (adapter == null)
diff --git a/bundles/org.eclipse.jst.jsp.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.jst.jsp.ui/META-INF/MANIFEST.MF
index 76a98c7..c2f857a 100644
--- a/bundles/org.eclipse.jst.jsp.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.jst.jsp.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jst.jsp.ui; singleton:=true
-Bundle-Version: 1.1.317.qualifier
+Bundle-Version: 1.1.318.qualifier
 Bundle-Activator: org.eclipse.jst.jsp.ui.internal.JSPUIPlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/validation/JSPContentSourceValidator.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/validation/JSPContentSourceValidator.java
index 6f6dbcc..8d450ea 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/validation/JSPContentSourceValidator.java
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/validation/JSPContentSourceValidator.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2007, 2011 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -107,28 +107,6 @@
 		fDocument = null;
 	}
 
-	protected void validate(IReporter reporter, IFile file, IDOMModel model) {
-		if (file == null || model == null)
-			return; // error
-		IDOMDocument document = model.getDocument();
-		if (document == null)
-			return; // error
-
-		// This validator currently only handles validating HTML content in
-		// JSP
-		if (hasHTMLFeature(document)) {
-			INodeAdapterFactory factory = HTMLValidationAdapterFactory.getInstance();
-			ValidationAdapter adapter = (ValidationAdapter) factory.adapt(document);
-			if (adapter == null)
-				return; // error
-
-			HTMLValidationReporter rep = getReporter(reporter, file, model);
-			rep.clear();
-			adapter.setReporter(rep);
-			adapter.validate(document);
-		}
-	}
-
 	/**
 	 * This validate call is for the ISourceValidator partial document
 	 * validation approach
diff --git a/bundles/org.eclipse.wst.xml.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.xml.core/META-INF/MANIFEST.MF
index 7053a0c..e9b7c4b 100644
--- a/bundles/org.eclipse.wst.xml.core/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.wst.xml.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.wst.xml.core; singleton:=true
-Bundle-Version: 1.1.313.qualifier
+Bundle-Version: 1.1.314.qualifier
 Bundle-Activator: org.eclipse.wst.xml.core.internal.XMLCorePlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/XMLModelParser.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/XMLModelParser.java
index 9d81dfe..40ece0a 100644
--- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/XMLModelParser.java
+++ b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/XMLModelParser.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2001, 2010 IBM Corporation and others.
+ * Copyright (c) 2001, 2011 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -1291,15 +1291,24 @@
 			Node parent = this.context.getParentNode();
 			if(parent != null) {
 				Node next = this.context.getNextNode();
-				ModelParserAdapter parserAdapter = getParserAdapter();
-				if (parserAdapter != null && parserAdapter instanceof ModelParserAdapterExtension) {
-					ModelParserAdapterExtension adapter = (ModelParserAdapterExtension) parserAdapter;
-					// Make sure to check that parent is an Element
-					while (parent.getNodeType() == Node.ELEMENT_NODE && !parserAdapter.canContain( (Element) parent, node) && adapter.isEndTagOmissible((Element) parent)) {
+				// Reset parents which are closed container elements; should not be parents
+				if(parent.getNodeType() == Node.ELEMENT_NODE) {
+					String type = ((ElementImpl)parent).getStartStructuredDocumentRegion().getLastRegion().getType();
+					if(((ElementImpl)parent).isContainer() && type == DOMRegionContext.XML_EMPTY_TAG_CLOSE) {
 						next = parent.getNextSibling();
 						parent = parent.getParentNode();
 					}
-				}
+					else {
+						ModelParserAdapter parserAdapter = getParserAdapter();
+						if (parserAdapter instanceof ModelParserAdapterExtension) {
+							ModelParserAdapterExtension adapter = (ModelParserAdapterExtension) parserAdapter;
+							while (parent.getNodeType() == Node.ELEMENT_NODE && !parserAdapter.canContain( (Element) parent, node) && adapter.isEndTagOmissible((Element) parent)) {
+								next = parent.getNextSibling();
+								parent = parent.getParentNode();
+							}
+						}
+					}
+				}	
 				insertNode(parent, node, next);
 				next = node.getNextSibling();
 				if (next != null) {
diff --git a/features/org.eclipse.wst.xml_core.feature.patch/buildnotes_org.eclipse.wst.xml_core.feature.patch.html b/features/org.eclipse.wst.xml_core.feature.patch/buildnotes_org.eclipse.wst.xml_core.feature.patch.html
index 6a9fb2a..b4c695c 100644
--- a/features/org.eclipse.wst.xml_core.feature.patch/buildnotes_org.eclipse.wst.xml_core.feature.patch.html
+++ b/features/org.eclipse.wst.xml_core.feature.patch/buildnotes_org.eclipse.wst.xml_core.feature.patch.html
@@ -36,5 +36,6 @@
 <p>Bug <a href='https://bugs.eclipse.org/335340'>335340</a>. ModelManager deadlock due to exception while loading filebuffer</p>
 <p>Bug <a href='https://bugs.eclipse.org/340582'>340582</a>. Add http://schemas.xmlsoap.org/soap/envelope/ to XML catalog</p>
 <p>Bug <a href='https://bugs.eclipse.org/345217'>345217</a>. Add soap envelop schema as schemaLocation to XML catalog</p>
+<p>Bug <a href='https://bugs.eclipse.org/352148'>352148</a>. XML JSP can create unbalanced DOM.</p>
 </body>
 </head>
\ No newline at end of file
diff --git a/features/org.eclipse.wst.xml_core.feature.patch/feature.properties b/features/org.eclipse.wst.xml_core.feature.patch/feature.properties
index 1dd2514..8517414 100644
--- a/features/org.eclipse.wst.xml_core.feature.patch/feature.properties
+++ b/features/org.eclipse.wst.xml_core.feature.patch/feature.properties
@@ -54,6 +54,7 @@
 Bug https://bugs.eclipse.org/335340 ModelManager deadlock due to exception while loading filebuffer \n\
 Bug https://bugs.eclipse.org/340582 Add http://schemas.xmlsoap.org/soap/envelope/ to XML catalog\n\
 Bug https://bugs.eclipse.org/345217 Add soap envelop schema as schemaLocation to XML catalog\n\
+Bug https://bugs.eclipse.org/352148 XML JSP can create unbalanced DOM.\n\
 \n\
 
 # "copyright" property - text of the "Feature Update Copyright"