[123911] Added extension mechanism to the XML validator for error customizers.
Contributed an initial J2EE error customizer that provides a 'nicer' message for empty application projects.
Added unit tests for error customizer extension.
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 5752afe..e4488b8 100644
--- a/bundles/org.eclipse.wst.xml.core/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.wst.xml.core/META-INF/MANIFEST.MF
@@ -26,6 +26,7 @@
  org.eclipse.wst.xml.core.internal.contentmodel.util,
  org.eclipse.wst.xml.core.internal.contenttype,
  org.eclipse.wst.xml.core.internal.document,
+ org.eclipse.wst.xml.core.internal.emf2xml,
  org.eclipse.wst.xml.core.internal.encoding,
  org.eclipse.wst.xml.core.internal.modelhandler,
  org.eclipse.wst.xml.core.internal.modelquery,
@@ -48,11 +49,11 @@
  org.eclipse.wst.xml.core.internal.validation,
  org.eclipse.wst.xml.core.internal.validation.core,
  org.eclipse.wst.xml.core.internal.validation.core.logging,
+ org.eclipse.wst.xml.core.internal.validation.eclipse,
+ org.eclipse.wst.xml.core.internal.validation.errorcustomization,
  org.w3c.dom,
  org.w3c.dom.ranges,
- org.w3c.dom.traversal,
- org.eclipse.wst.xml.core.internal.emf2xml
- 
+ org.w3c.dom.traversal
 Require-Bundle: org.apache.xerces;visibility:=reexport,
  org.eclipse.wst.sse.core,
  org.eclipse.core.resources,
diff --git a/bundles/org.eclipse.wst.xml.core/plugin.properties b/bundles/org.eclipse.wst.xml.core/plugin.properties
index e1cdf41..837cda4 100644
--- a/bundles/org.eclipse.wst.xml.core/plugin.properties
+++ b/bundles/org.eclipse.wst.xml.core/plugin.properties
@@ -22,4 +22,5 @@
 XML_Catalog_Contributions_Extension_Point.name=XML Catalog Contributions Extension Point
 XML_Catalog_Contributor_Extension_Point.name=XML Catalog Contributor Extension Point
 XSL_Content_Type_Extension_Element.name=XSL
-XMI_Content_Type=XMI
\ No newline at end of file
+XMI_Content_Type=XMI
+XML_Validation_Error_Customizer.name=XML Validator Error Customizer Extension Point
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xml.core/plugin.xml b/bundles/org.eclipse.wst.xml.core/plugin.xml
index d721dbe..4a8f4c4 100644
--- a/bundles/org.eclipse.wst.xml.core/plugin.xml
+++ b/bundles/org.eclipse.wst.xml.core/plugin.xml
@@ -2,6 +2,10 @@
 <?eclipse version="3.0"?>
 <plugin>
 
+   <!-- An extension for contributing a XML validation error customizer. -->
+   <extension-point id="errorCustomizer" name="%XML_Validation_Error_Customizer.name" schema="schema/errorCustomizer.exsd"/>
+
+
 	<extension point="org.eclipse.wst.sse.core.modelHandler">
 		<modelHandler
 			default="true"
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidator.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidator.java
index 5a8a307..103f874 100644
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidator.java
+++ b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidator.java
@@ -24,7 +24,6 @@
 import java.util.ArrayList;
 import java.util.Hashtable;
 import java.util.List;
-
 import org.apache.xerces.impl.XMLErrorReporter;
 import org.apache.xerces.parsers.StandardParserConfiguration;
 import org.apache.xerces.xni.NamespaceContext;
@@ -37,11 +36,14 @@
 import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver;
 import org.eclipse.wst.xml.core.internal.validation.core.LazyURLInputStream;
 import org.eclipse.wst.xml.core.internal.validation.core.logging.LoggerFactory;
+import org.eclipse.wst.xml.core.internal.validation.errorcustomization.ErrorCustomizationManager;
+import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.ext.DeclHandler;
+import org.xml.sax.helpers.DefaultHandler;
 
 /**
  * This class performs validation using a xerces sax parser.  
@@ -53,6 +55,7 @@
 {
   protected URIResolver uriResolver = null;
   //protected MyEntityResolver entityResolver = null;
+  protected ErrorCustomizationManager errorCustomizationManager;
   protected Hashtable ingoredErrorKeyTable = new Hashtable();
 
   protected static final String IGNORE_ALWAYS = "IGNORE_ALWAYS"; //$NON-NLS-1$
@@ -116,6 +119,25 @@
       reader.setFeature("http://xml.org/sax/features/namespaces", valinfo.isNamespaceEncountered());               //$NON-NLS-1$
       reader.setFeature("http://xml.org/sax/features/validation", valinfo.isGrammarEncountered());  //$NON-NLS-1$
       reader.setFeature("http://apache.org/xml/features/validation/schema", valinfo.isGrammarEncountered()); //$NON-NLS-1$
+      reader.setContentHandler(new DefaultHandler()
+      {
+        public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+          
+          if (errorCustomizationManager == null)
+          {
+            errorCustomizationManager = new ErrorCustomizationManager();
+//            if (errorCustomizationManager.isDocumentNamespaceApplicable(uri))
+//            {
+//              errorCustomizationManager.setActive(true);
+//            }  
+          }
+          errorCustomizationManager.startElement(uri, localName);                    
+        }
+        
+        public void endElement(String uri, String localName, String qName) throws SAXException {
+          errorCustomizationManager.endElement(uri, localName);
+        }
+      });      
       
       // MH make sure validation works even when a customer entityResolver is note set (i.e. via setURIResolver())
       if (entityResolver != null)
@@ -544,6 +566,7 @@
 		      if (reportError)
 		      {
 		        super.reportError(domain, key, arguments, severity);
+		        errorCustomizationManager.considerReportedError(valinfo, key, arguments);
 		      }
 		    }
 		};
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/ValidationMessage.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/ValidationMessage.java
index 807ea9a..d364d24 100644
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/ValidationMessage.java
+++ b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/ValidationMessage.java
@@ -191,5 +191,11 @@
   {
 	  return this.messageArguments;
   }
+  
+
+  public void setMessage(String message)
+  {
+    this.message = message;
+  }  
                                      
 }
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/ErrorCustomizationPluginRegistryReader.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/ErrorCustomizationPluginRegistryReader.java
index 27e9674..ab6c170 100644
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/ErrorCustomizationPluginRegistryReader.java
+++ b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/ErrorCustomizationPluginRegistryReader.java
@@ -68,7 +68,7 @@
 	      {
 	        try
 	        {
-	          Bundle pluginBundle = Platform.getBundle(element.getDeclaringExtension().getContributor().getName());
+	          Bundle pluginBundle = Platform.getBundle(element.getDeclaringExtension().getNamespace());
 	          ErrorMessageCustomizerDelegate delegate = new ErrorMessageCustomizerDelegate(pluginBundle, errorCustomizerClass);
 	          ErrorCustomizationRegistry.getInstance().addErrorMessageCustomizer(namespace, delegate);
 	        }
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/ElementInformation.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/ElementInformation.java
index 649c99e..eb1cca2 100644
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/ElementInformation.java
+++ b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/ElementInformation.java
@@ -69,4 +69,4 @@
   {
 	return children;
   }
-}
\ No newline at end of file
+}
diff --git a/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF
index a2bcfb9..8c3d7af 100644
--- a/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.wst.xml.ui; singleton:=true
-Bundle-Version: 1.0.1.qualifier
+Bundle-Version: 1.0.2.qualifier
 Bundle-Activator: org.eclipse.wst.xml.ui.internal.XMLUIPlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/XMLValidator.java b/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/XMLValidator.java
index 0f67568..1f3cb21 100644
--- a/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/XMLValidator.java
+++ b/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/XMLValidator.java
@@ -15,6 +15,7 @@
 
 import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin;
 import org.eclipse.wst.xml.core.internal.validation.XMLValidationReport;
+import org.eclipse.wst.xml.core.internal.validation.eclipse.ErrorCustomizationPluginRegistryReader;
 
 /**
  * An XML validator specific to Eclipse. This validator will wrap the internal
@@ -50,6 +51,7 @@
   {
     validator = new org.eclipse.wst.xml.core.internal.validation.XMLValidator();
     validator.setURIResolver(URIResolverPlugin.createResolver());
+    new ErrorCustomizationPluginRegistryReader().readRegistry();
   }
   /**
    * Validate the file at the given URI.