Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal')
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/ValidatorHelper.java361
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLNestedValidatorContext.java55
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationConfiguration.java120
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationInfo.java199
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationMessages.java36
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationReport.java44
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidator.java808
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/AbstractNestedValidator.java514
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/Helper.java259
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/LazyURLInputStream.java161
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/NestedValidatorContext.java22
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/ValidationInfo.java286
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/ValidationMessage.java201
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/ValidationReport.java45
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/logging/CommandLineLogger.java32
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/logging/EclipseLogger.java34
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/logging/ILogger.java35
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/logging/LoggerFactory.java102
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/ErrorCustomizationPluginRegistryReader.java81
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/Validator.java151
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/XMLMessageInfoHelper.java112
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/XMLValidator.java49
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/ElementInformation.java72
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/ErrorCustomizationManager.java110
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/ErrorCustomizationRegistry.java97
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/ErrorMessageCustomizerDelegate.java72
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/IErrorMessageCustomizer.java34
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/xmlvalidation.properties32
28 files changed, 0 insertions, 4124 deletions
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/ValidatorHelper.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/ValidatorHelper.java
deleted file mode 100644
index 57cae082d0..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/ValidatorHelper.java
+++ /dev/null
@@ -1,361 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xml.core.internal.validation;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.net.URL;
-import java.util.List;
-import java.util.Vector;
-
-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.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.LexicalHandler;
-
-import com.ibm.icu.util.StringTokenizer;
-
-/**
- * A helper class for the XML validator.
- *
- * @author Craig Salter, IBM
- * @author Lawrence Mandel, IBM
- */
-public class ValidatorHelper
-{
- public List namespaceURIList = new Vector();
- public boolean isGrammarEncountered = false;
- public boolean isDTDEncountered = false;
- public boolean isNamespaceEncountered = false;
- public String schemaLocationString = ""; //$NON-NLS-1$
- public int numDTDElements = 0;
-
- /**
- * Constructor.
- */
- public ValidatorHelper()
- {
- }
-
- /**
- * Create an XML Reader.
- *
- * @return An XML Reader if one can be created or null.
- * @throws Exception
- */
- protected XMLReader createXMLReader(String uri) throws Exception
- {
- XMLReader reader = null;
-
- reader = new org.apache.xerces.parsers.SAXParser();
- reader.setFeature("http://apache.org/xml/features/continue-after-fatal-error", false); //$NON-NLS-1$
- reader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); //$NON-NLS-1$
- reader.setFeature("http://xml.org/sax/features/namespaces", false); //$NON-NLS-1$
- reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); //$NON-NLS-1$
- reader.setContentHandler(new MyContentHandler(uri));
- reader.setErrorHandler(new InternalErrorHandler());
-
- LexicalHandler lexicalHandler = new LexicalHandler()
- {
- public void startDTD (String name, String publicId, String systemId)
- {
- isGrammarEncountered = true;
- isDTDEncountered = true;
- }
-
- public void endDTD() throws SAXException
- {
- }
-
- public void startEntity(String name) throws SAXException
- {
- }
-
- public void endEntity(String name) throws SAXException
- {
- }
-
- public void startCDATA() throws SAXException
- {
- }
-
- public void endCDATA() throws SAXException
- {
- }
-
- public void comment (char ch[], int start, int length) throws SAXException
- {
- }
- };
- reader.setProperty("http://xml.org/sax/properties/lexical-handler", lexicalHandler); //$NON-NLS-1$
-
- return reader;
- }
-
- /**
- * An error handler to suppress error and warning information.
- */
- private class InternalErrorHandler implements org.xml.sax.ErrorHandler
- {
- public InternalErrorHandler()
- {
- super();
- }
-
- public void error(SAXParseException exception) throws SAXException
- {
- }
-
- public void fatalError(SAXParseException exception) throws SAXException
- {
- }
-
- public void warning(SAXParseException exception) throws SAXException
- {
- }
- }
-
-
- /**
- * Figures out the information needed for validation.
- *
- * @param uri The uri of the file to validate.
- * @param uriResolver A helper to resolve locations.
- */
- public void computeValidationInformation(String uri, Reader characterStream, URIResolver uriResolver)
- {
- try
- {
- XMLReader reader = createXMLReader(uri);
- InputSource inputSource = new InputSource(uri);
- inputSource.setCharacterStream(characterStream);
- reader.parse(inputSource);
- }
- catch (Exception e)
- {
- //System.out.println(e);
- }
- }
-
-
-
- /**
- * Handle the content while parsing the file.
- */
- class MyContentHandler extends org.xml.sax.helpers.DefaultHandler
- {
- /* (non-Javadoc)
- * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException)
- */
- boolean isRootElement = true;
- String baseURI;
-
- MyContentHandler(String uri)
- {
- this.baseURI = uri;
- }
-
- public void error(SAXParseException e) throws SAXException
- {
- }
- /* (non-Javadoc)
- * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
- */
- public void fatalError(SAXParseException e) throws SAXException
- {
- }
- /* (non-Javadoc)
- * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException)
- */
- public void warning(SAXParseException e) throws SAXException
- {
- }
- public String getPrefix(String name)
- {
- String prefix = null;
- int index = name.indexOf(":"); //$NON-NLS-1$
- if (index != -1)
- {
- prefix = name.substring(0, index);
- }
- return prefix;
- }
-
- public String getUnprefixedName(String name)
- {
- int index = name.indexOf(":"); //$NON-NLS-1$
- if (index != -1)
- {
- name = name.substring(index + 1);
- }
- return name;
- }
-
- public String getPrefixedName(String prefix, String localName)
- {
- return prefix != null && prefix.length() > 0 ? prefix + ":" + localName : localName; //$NON-NLS-1$
- }
-
- public void startElement(String namespaceURI, String localName, String rawName, Attributes atts)
- {
- //String explicitLocation = null;
- if (isRootElement)
- {
-
- isRootElement = false;
- int nAtts = atts.getLength();
- String schemaInstancePrefix = null;
- for (int i =0; i < nAtts; i++)
- {
- String attributeName = atts.getQName(i);
- if (attributeName.equals("xmlns") || attributeName.startsWith("xmlns:")) //$NON-NLS-1$ //$NON-NLS-2$
- {
- isNamespaceEncountered = true;
- String value = atts.getValue(i);
- if (value.startsWith("http://www.w3.org/") && value.endsWith("/XMLSchema-instance")) //$NON-NLS-1$ //$NON-NLS-2$
- {
- schemaInstancePrefix = attributeName.equals("xmlns") ? "" : getUnprefixedName(attributeName); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- }
-
- String prefix = getPrefix(rawName);
- String rootElementNamespaceDeclarationName = (prefix != null && prefix.length() > 0) ? "xmlns:" + prefix : "xmlns"; //$NON-NLS-1$ //$NON-NLS-2$
- String rootElementNamespace = rootElementNamespaceDeclarationName != null ? atts.getValue(rootElementNamespaceDeclarationName) : null;
-
- String location = null;
-
- // first we use any 'xsi:schemaLocation' or 'xsi:noNamespaceSchemaLocation' attribute
- // to determine a location
- if (schemaInstancePrefix != null)
- {
- location = atts.getValue(getPrefixedName(schemaInstancePrefix, "noNamespaceSchemaLocation")); //$NON-NLS-1$
- if (location == null)
- {
- String schemaLoc = atts.getValue(getPrefixedName(schemaInstancePrefix, "schemaLocation")); //$NON-NLS-1$
- location = getSchemaLocationForNamespace(schemaLoc, rootElementNamespace);
- }
- }
- if (rootElementNamespace == null)
- {
- rootElementNamespace = "";
- }
-
- location = URIResolverPlugin.createResolver().resolve(baseURI, rootElementNamespace, location);
- location = URIResolverPlugin.createResolver().resolvePhysicalLocation(baseURI, rootElementNamespace, location);
- if (location != null)
- {
- location = URIHelper.addImpliedFileProtocol(location);
- }
-
- schemaLocationString = location;
-
- if (location != null)
- {
- InputStream is = null;
- try
- {
- URL url = new URL(location);
- is = url.openStream();
- isGrammarEncountered = true;
- }
- catch(Exception e)
- {
- // Do nothing.
- }
- finally
- {
- if(is != null)
- {
- try
- {
- is.close();
- }
- catch(Exception e)
- {
- // Do nothing.
- }
- }
- }
- }
- }
- }
- /* (non-Javadoc)
- * @see org.xml.sax.ext.DeclHandler#elementDecl(java.lang.String, java.lang.String)
- */
- public void elementDecl(String name, String model)
- {
- numDTDElements++;
- }
-
- // The xsiSchemaLocationValue is a list of namespace/location pairs that are separated by whitespace
- // this method walks the list of pairs looking for the specified namespace and returns the associated
- // location.
- //
- protected String getSchemaLocationForNamespace(String xsiSchemaLocationValue, String namespace)
- {
- String result = null;
- if (xsiSchemaLocationValue != null && namespace != null)
- {
-
- StringTokenizer st = new StringTokenizer(xsiSchemaLocationValue);
- while(st.hasMoreTokens())
- {
- if(st.nextToken().equals(namespace))
- {
- if(st.hasMoreTokens())
- {
- result = st.nextToken();
- }
- }
- else
- {
- if(st.hasMoreTokens())
- {
- st.nextToken();
- }
- }
- }
- }
- return result;
- }
- }
-
-
- /**
- * Replace all instances in the string of the old pattern with the new pattern.
- *
- * @param string The string to replace the patterns in.
- * @param oldPattern The old pattern to replace.
- * @param newPattern The pattern used for replacement.
- * @return The modified string with all occurrances of oldPattern replaced by new Pattern.
- */
- protected static String replace(String string, String oldPattern, String newPattern)
- {
- int index = 0;
- while (index != -1)
- {
- index = string.indexOf(oldPattern, index);
- if (index != -1)
- {
- string = string.substring(0, index) + newPattern + string.substring(index + oldPattern.length());
- index = index + oldPattern.length();
- }
- }
- return string;
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLNestedValidatorContext.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLNestedValidatorContext.java
deleted file mode 100644
index 29c5e7e3f9..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLNestedValidatorContext.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.validation;
-
-
-import java.util.HashSet;
-
-import org.eclipse.wst.xml.core.internal.validation.core.NestedValidatorContext;
-
-
-/**
- * XMLNestedValidatorContext is used to store state data needed during an XML
- * validation session.
- */
-public class XMLNestedValidatorContext extends NestedValidatorContext
-{
- /**
- * A set of inaccessible locations URIs (String).
- */
- private HashSet inaccessibleLocationURIs = new HashSet();
-
- /**
- * Determines if a location URI was marked as inaccessible.
- *
- * @param locationURI
- * the location URI to test. Must not be null.
- * @return true if a location URI was marked as inaccessible, false otherwise.
- */
- public boolean isURIMarkedInaccessible(String locationURI)
- {
- return locationURI != null && inaccessibleLocationURIs.contains(locationURI);
- }
-
- /**
- * Marks the given location URI as inaccessible.
- *
- * @param locationURI
- * the location URI to mark as inaccessible. Must not be null.
- */
- public void markURIInaccessible(String locationURI)
- {
- if (locationURI != null)
- {
- inaccessibleLocationURIs.add(locationURI);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationConfiguration.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationConfiguration.java
deleted file mode 100644
index c4208ee2e9..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationConfiguration.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.validation;
-
-/**
- * An XML validation configuration allows setting specific configuration
- * information for a WTP XML validation run. Any features and properties
- * set on this configuration should not be confused with those from
- * parsers such as Xerces. (This object does not by default wrap features
- * and properties from specific parsers.)
- */
-public class XMLValidationConfiguration
-{
- /**
- * @deprecated
- */
- public static String WARN_NO_GRAMMAR = "WARN_NO_GRAMMAR"; //$NON-NLS-1$
- public static String INDICATE_NO_GRAMMAR = "INDICATE_NO_GRAMMAR"; //$NON-NLS-1$
- public static String USE_XINCLUDE = "USE_XINCLUDE"; //$NON-NLS-1$
- public static String HONOUR_ALL_SCHEMA_LOCATIONS = "HONOUR_ALL_SCHEMA_LOCATIONS"; //$NON-NLS-1$
-
- private boolean warn_no_grammar_value = false;
- private int indicate_no_grammar_value = 1;
- private boolean use_xinclude = false;
- private boolean honour_all_schema_locations_value = false;
-
- /**
- * Set a feature of this configuration.
- *
- * @param feature
- * The feature to set.
- * @param value
- * The value to set for the feature.
- * @throws
- * An exception is thrown if the feature is not recognized.
- */
- public void setFeature(String feature, boolean value) throws Exception
- {
- if(WARN_NO_GRAMMAR.equals(feature))
- warn_no_grammar_value = value;
- else if(USE_XINCLUDE.equals(feature))
- use_xinclude = value;
- else if(HONOUR_ALL_SCHEMA_LOCATIONS.equals(feature))
- honour_all_schema_locations_value = value;
- else
- throw new Exception("Feature not recognized."); //$NON-NLS-1$
-
- }
-
- /**
- * Set a feature of this configuration.
- *
- * @param feature
- * The feature to set.
- * @param value
- * The value to set for the feature.
- * @throws
- * An exception is thrown if the feature is not recognized.
- */
- public void setFeature(String feature, int value) throws Exception
- {
- if(INDICATE_NO_GRAMMAR.equals(feature))
- indicate_no_grammar_value = value;
- else
- throw new IllegalArgumentException("Feature not recognized."); //$NON-NLS-1$
-
- }
-
-
- /**
- * Get the value for a given feature. If the feature is not defined
- * this method will throw an exception.
- *
- * @param feature
- * The feature for which to retrieve the value.
- * @return
- * The feature's value, true or false.
- * @throws
- * An exception is thrown if the feature is not recognized.
- */
- public boolean getFeature(String feature) throws Exception
- {
- if(WARN_NO_GRAMMAR.equals(feature))
- return warn_no_grammar_value;
- else if(USE_XINCLUDE.equals(feature))
- return use_xinclude;
- if(HONOUR_ALL_SCHEMA_LOCATIONS.equals(feature))
- return honour_all_schema_locations_value;
-
- throw new Exception("Feature not recognized."); //$NON-NLS-1$
- }
-
- /**
- * Get the value for a given feature. If the feature is not defined
- * this method will throw an exception.
- *
- * @param feature
- * The feature for which to retrieve the value.
- * @return
- * The feature's value, true or false.
- * @throws
- * An exception is thrown if the feature is not recognized.
- */
- public int getIntFeature(String feature) throws Exception
- {
- if(INDICATE_NO_GRAMMAR.equals(feature))
- return indicate_no_grammar_value;
-
- throw new IllegalArgumentException("Feature not recognized."); //$NON-NLS-1$
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationInfo.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationInfo.java
deleted file mode 100644
index 1113eb9e1d..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationInfo.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * David Carver - STAR - [205989] - [validation] validate XML after XInclude resolution
- *******************************************************************************/
-
-package org.eclipse.wst.xml.core.internal.validation;
-
-import java.util.Stack;
-
-import org.apache.xerces.xni.XMLLocator;
-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.ValidationInfo;
-import org.eclipse.wst.xml.core.internal.validation.errorcustomization.ErrorCustomizationManager;
-
-
-/**
- * A validation information object specific to XML validators.
- */
-public class XMLValidationInfo extends ValidationInfo implements XMLValidationReport
-{
- protected boolean grammarEncountered = false;
- protected boolean dtdEncountered = false;
- protected boolean namespaceEncountered = false;
- protected int elementDeclCount = 0;
- protected String currentErrorKey;
- protected Object messageArguments[] = null;
- protected XMLLocator locator = null;
- protected ErrorCustomizationManager errorCustomizationManager = null;
-
- /**
- * A stack of start tag locations, used to move errors
- * reported at the close tag to be reported at the start tag.
- */
- protected Stack startElementLocations = new Stack();
-
- /**
- * Constructor.
- *
- * @param uri The URI of the file this report describes.
- */
- public XMLValidationInfo(String uri)
- {
- super(uri);
- }
-
- public boolean isGrammarEncountered()
- {
- return grammarEncountered;
- }
-
- /**
- * Set whether a grammar has been encountered or not.
- *
- * @param grammarEncountered Set true if a grammar has been encountered, false otherwise.
- */
- public void setGrammarEncountered(boolean grammarEncountered)
- {
- this.grammarEncountered = grammarEncountered;
- }
-
- public boolean isDTDWithoutElementDeclarationEncountered()
- {
- return dtdEncountered && elementDeclCount == 0;
- }
-
- /**
- * Set whether a DTD without an element declaration was encountered.
- *
- * @param dtdWithoutElementDeclarationEncountered Set true if a DTD without an
- * element declaration was encountered, false otherwise.
- */
- public void setDTDEncountered(boolean dtdEncountered)
- {
- this.dtdEncountered = dtdEncountered;
- }
-
- public boolean isNamespaceEncountered()
- {
- return namespaceEncountered;
- }
-
- /**
- * Set whether a namespace was encountered.
- *
- * @param namespaceEncountered Set true if a namespace was encountered, false otherwise.
- */
- public void setNamespaceEncountered(boolean namespaceEncountered)
- {
- this.namespaceEncountered = namespaceEncountered;
- }
-
- /**
- * Increase the element declaration count for DTD elements by one.
- */
- public void increaseElementDeclarationCount()
- {
- this.elementDeclCount++;
- }
-
- /**
- * Set the number of DTD elements encountered.
- *
- * @param count The number of DTD elements encountered.
- */
- public void setElementDeclarationCount(int count)
- {
- elementDeclCount = count;
- }
-
- /**
- * Get the XML locator if one has been specified.
- *
- * @return The XML locator if one has been specified or null.
- */
- public XMLLocator getXMLLocator()
- {
- return locator;
- }
-
- /**
- * Set the XMLLocator.
- *
- * @param locator The XMLLocator to set.
- */
- public void setXMLLocator(XMLLocator locator)
- {
- this.locator = locator;
- }
-
- /**
- * Get the current error key.
- *
- * @return Returns the currentErrorKey.
- */
- public String getCurrentErrorKey()
- {
- return currentErrorKey;
- }
-
- /**
- * Set the current error key.
- *
- * @param currentErrorKey The currentErrorKey to set.
- */
- public void setCurrentErrorKey(String currentErrorKey)
- {
- this.currentErrorKey = currentErrorKey;
- }
-
-public Object[] getMessageArguments() {
- return messageArguments;
-}
-
-
-public void setMessageArguments(Object[] messageArguments) {
- this.messageArguments = messageArguments;
-}
-
- /**
- * Get the start elements locations.
- *
- * @return
- * A stack containing the start element locations.
- */
- protected Stack getStartElementLocations()
- {
- return startElementLocations;
- }
-
- /**
- * Get the error customization manager for this validation run.
- *
- * @return
- * The error customization manager for this validation run.
- */
- protected ErrorCustomizationManager getErrorCustomizationManager()
- {
- if(errorCustomizationManager == null)
- {
- errorCustomizationManager = new ErrorCustomizationManager();
- }
- return errorCustomizationManager;
- }
-
- /**
- * @deprecated Use {@link XMLValidationConfiguration} instead.
- */
- public boolean isUseXInclude() {
- return XMLCorePlugin.getDefault().getPluginPreferences().getBoolean(XMLCorePreferenceNames.USE_XINCLUDE);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationMessages.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationMessages.java
deleted file mode 100644
index 7cd08da343..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationMessages.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.validation;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Strings used by XML Validation
- */
-public class XMLValidationMessages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.wst.xml.core.internal.validation.xmlvalidation";//$NON-NLS-1$
-
- public static String _UI_PROBLEMS_VALIDATING_UNKNOWN_HOST;
- public static String _UI_PROBLEMS_VALIDATING_FILE_NOT_FOUND;
- public static String _UI_PROBLEMS_CONNECTION_REFUSED;
- public static String _UI_REF_FILE_ERROR_MESSAGE;
- public static String _WARN_NO_GRAMMAR;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, XMLValidationMessages.class);
- }
-
- private XMLValidationMessages() {
- // cannot create new instance
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationReport.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationReport.java
deleted file mode 100644
index 5a4f1f641c..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidationReport.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xml.core.internal.validation;
-
-import org.eclipse.wst.xml.core.internal.validation.core.ValidationReport;
-
-/**
- * An interface represention a validation report for XML validation.
- *
- * @author Lawrence Mandel, IBM
- */
-public interface XMLValidationReport extends ValidationReport
-{
-
- /**
- * Returns whether a grammar was encountered during the validation.
- *
- * @return True if a grammar was encountered, false otherwise.
- */
- public boolean isGrammarEncountered();
-
- /**
- * Returns whether a namespace was encountered.
- *
- * @return True if a namespace was encountered, false otherwise.
- */
- public boolean isNamespaceEncountered();
-
- /**
- * Returns whether a DTD without element declarations was encountered.
- *
- * @return True if a DTD without element declarations was encountered.
- */
- public boolean isDTDWithoutElementDeclarationEncountered();
-}
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
deleted file mode 100644
index ad698885c0..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/XMLValidator.java
+++ /dev/null
@@ -1,808 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * David Carver - STAR - [205989] - [validation] validate XML after XInclude resolution
- *******************************************************************************/
-
-package org.eclipse.wst.xml.core.internal.validation;
-
-import java.io.BufferedReader;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.StringReader;
-import java.net.ConnectException;
-import java.net.URL;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.apache.xerces.impl.XMLErrorReporter;
-import org.apache.xerces.impl.msg.XMLMessageFormatter;
-import org.apache.xerces.parsers.XIncludeAwareParserConfiguration;
-import org.apache.xerces.xni.Augmentations;
-import org.apache.xerces.xni.NamespaceContext;
-import org.apache.xerces.xni.QName;
-import org.apache.xerces.xni.XMLAttributes;
-import org.apache.xerces.xni.XMLLocator;
-import org.apache.xerces.xni.XMLResourceIdentifier;
-import org.apache.xerces.xni.XNIException;
-import org.apache.xerces.xni.parser.XMLEntityResolver;
-import org.apache.xerces.xni.parser.XMLInputSource;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver;
-import org.eclipse.wst.common.uriresolver.internal.util.URIHelper;
-import org.eclipse.wst.validation.ValidationResult;
-import org.eclipse.wst.xml.core.internal.Logger;
-import org.eclipse.wst.xml.core.internal.validation.core.LazyURLInputStream;
-import org.eclipse.wst.xml.core.internal.validation.core.NestedValidatorContext;
-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.
- * Here's a quick overview of the details :
- * - an ErrorHandler is used to collect errors into a list (so they may be displayed by the UI)
- * - an EntityResolver is used along with the xerces "external-schemaLocation" property to implement XML Catalog support
- */
-public class XMLValidator
-{
- protected URIResolver uriResolver = null;
- protected Hashtable ingoredErrorKeyTable = new Hashtable();
- protected Set adjustLocationErrorKeySet = new TreeSet();
-
- protected static final String IGNORE_ALWAYS = "IGNORE_ALWAYS"; //$NON-NLS-1$
- protected static final String IGNORE_IF_DTD_WITHOUT_ELEMENT_DECL = "IGNORE_IF_DTD_WITHOUT_ELEMENT_DECL"; //$NON-NLS-1$
- protected static final String PREMATURE_EOF = "PrematureEOF"; //$NON-NLS-1$
- protected static final String ROOT_ELEMENT_TYPE_MUST_MATCH_DOCTYPEDECL = "RootElementTypeMustMatchDoctypedecl"; //$NON-NLS-1$
- protected static final String MSG_ELEMENT_NOT_DECLARED = "MSG_ELEMENT_NOT_DECLARED"; //$NON-NLS-1$
-
- // WTP XML validator specific key.
- protected static final String NO_GRAMMAR_FOUND = "NO_GRAMMAR_FOUND"; //$NON-NLS-1$
-
- private static final String FILE_NOT_FOUND_KEY = "FILE_NOT_FOUND"; //$NON-NLS-1$
-
- /**
- * Constructor.
- */
- public XMLValidator()
- {
- // Here we add some error keys that we need to filter out when we're validation
- // against a DTD without any element declarations.
- ingoredErrorKeyTable.put(PREMATURE_EOF, IGNORE_ALWAYS);
- ingoredErrorKeyTable.put(ROOT_ELEMENT_TYPE_MUST_MATCH_DOCTYPEDECL, IGNORE_IF_DTD_WITHOUT_ELEMENT_DECL);
- ingoredErrorKeyTable.put(MSG_ELEMENT_NOT_DECLARED, IGNORE_IF_DTD_WITHOUT_ELEMENT_DECL);
-
- // Here we add some error keys that we need to adjust the location information for.
- // The location information will be adjusted to place the message on the line of the starting
- // element instead of on the line of the closing element.
- adjustLocationErrorKeySet.add("MSG_CONTENT_INVALID");
- adjustLocationErrorKeySet.add("MSG_CONTENT_INCOMPLETE");
- adjustLocationErrorKeySet.add("cvc-complex-type.2.4.b");
- adjustLocationErrorKeySet.add("cvc-complex-type.2.3");
- }
-
- /**
- * Set the URI Resolver to use.
- *
- * @param uriResolver The URI Resolver to use.
- */
- public void setURIResolver(URIResolver uriResolver)
- {
- this.uriResolver = uriResolver;
- //entityResolver = new MyEntityResolver(uriResolver);
- }
-
-
- /**
- * Create an XML Reader.
- *
- * @return The newly created XML reader or null if unsuccessful.
- * @throws Exception
- */
- protected XMLReader createXMLReader(final XMLValidationInfo valinfo, XMLEntityResolver entityResolver) throws Exception
- {
- XMLReader reader = null;
- // move to Xerces-2... add the contextClassLoader stuff
- ClassLoader prevClassLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
- MyStandardParserConfiguration configuration = new MyStandardParserConfiguration(valinfo);
- reader = new org.apache.xerces.parsers.SAXParser(configuration)
- {
- private XMLLocator locator = null;
-
- /* (non-Javadoc)
- * @see org.apache.xerces.parsers.AbstractSAXParser#startDocument(org.apache.xerces.xni.XMLLocator, java.lang.String, org.apache.xerces.xni.NamespaceContext, org.apache.xerces.xni.Augmentations)
- */
- public void startDocument(org.apache.xerces.xni.XMLLocator theLocator, java.lang.String encoding, NamespaceContext nscontext, org.apache.xerces.xni.Augmentations augs)
- {
- locator = theLocator;
- valinfo.setXMLLocator(theLocator);
- super.startDocument(theLocator, encoding, nscontext, augs);
- }
-
- /* (non-Javadoc)
- * @see org.apache.xerces.parsers.AbstractSAXParser#startElement(org.apache.xerces.xni.QName, org.apache.xerces.xni.XMLAttributes, org.apache.xerces.xni.Augmentations)
- */
- public void startElement(QName arg0, XMLAttributes arg1, Augmentations arg2) throws XNIException
- {
- valinfo.getStartElementLocations().push(new LocationCoordinate(locator.getLineNumber(), locator.getColumnNumber()));
- super.startElement(arg0, arg1, arg2);
- }
-
- /* (non-Javadoc)
- * @see org.apache.xerces.parsers.AbstractSAXParser#endElement(org.apache.xerces.xni.QName, org.apache.xerces.xni.Augmentations)
- */
- public void endElement(QName arg0, Augmentations arg1) throws XNIException {
- super.endElement(arg0, arg1);
- valinfo.getStartElementLocations().pop();
- }
- };
-
- reader.setFeature("http://apache.org/xml/features/continue-after-fatal-error", false); //$NON-NLS-1$
- reader.setFeature("http://xml.org/sax/features/namespace-prefixes", valinfo.isNamespaceEncountered()); //$NON-NLS-1$
- 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 {
- valinfo.getErrorCustomizationManager().startElement(uri, localName);
- }
-
- public void endElement(String uri, String localName, String qName) throws SAXException {
- valinfo.getErrorCustomizationManager().endElement(uri, localName);
- }
- });
-
- // MH make sure validation works even when a customer entityResolver is note set (i.e. via setURIResolver())
- if (entityResolver != null)
- {
- reader.setProperty("http://apache.org/xml/properties/internal/entity-resolver", entityResolver); //$NON-NLS-1$
- }
- reader.setProperty("http://xml.org/sax/properties/declaration-handler", new MyDeclHandler()); //$NON-NLS-1$
- }
- catch(Exception e)
- {
- Logger.logException(e);
- //e.printStackTrace();
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(prevClassLoader);
- }
- return reader;
- }
-
- /**
- * Validate the file located at the given URI.
- *
- * @param uri The URI of the file to validate.
- * @return Returns an XML validation report.
- */
- public XMLValidationReport validate(String uri)
- {
- return validate(uri, null, new XMLValidationConfiguration());
- }
-
- final String createStringForInputStream(InputStream inputStream)
- {
- // Here we are reading the file and storing to a stringbuffer.
- StringBuffer fileString = new StringBuffer();
- try
- {
- InputStreamReader inputReader = new InputStreamReader(inputStream, "UTF-8");
- BufferedReader reader = new BufferedReader(inputReader);
- char[] chars = new char[1024];
- int numberRead = reader.read(chars);
- while (numberRead != -1)
- {
- fileString.append(chars, 0, numberRead);
- numberRead = reader.read(chars);
- }
- }
- catch (Exception e)
- {
- //TODO: log error message
- //e.printStackTrace();
- }
- return fileString.toString();
- }
- /**
- * Validate the inputStream
- *
- * @param uri The URI of the file to validate.
- * @param the inputStream of the file to validate
- * @return Returns an XML validation report.
- */
- public XMLValidationReport validate(String uri, InputStream inputStream)
- {
- return validate(uri, inputStream, new XMLValidationConfiguration());
- }
- /**
- * Validate the inputStream
- *
- * @param uri
- * The URI of the file to validate.
- * @param inputstream
- * The inputStream of the file to validate
- * @param configuration
- * A configuration for this validation session.
- * @return
- * Returns an XML validation report.
- */
- public XMLValidationReport validate(String uri, InputStream inputStream, XMLValidationConfiguration configuration)
- {
- return validate(uri, inputStream, configuration, null);
- }
-
- /**
- * Validate the inputStream
- *
- * @param uri
- * The URI of the file to validate.
- * @param inputstream
- * The inputStream of the file to validate
- * @param configuration
- * A configuration for this validation session.
- * @param result
- * The validation result
- * @return
- * Returns an XML validation report.
- */
- public XMLValidationReport validate(String uri, InputStream inputStream, XMLValidationConfiguration configuration, ValidationResult result)
- {
- return validate(uri, inputStream, configuration, null, null);
- }
-
- /**
- * Validate the inputStream
- *
- * @param uri
- * The URI of the file to validate.
- * @param inputstream
- * The inputStream of the file to validate
- * @param configuration
- * A configuration for this validation session.
- * @param result
- * The validation result
- * @param context
- * The validation context
- * @return
- * Returns an XML validation report.
- */
- public XMLValidationReport validate(String uri, InputStream inputStream, XMLValidationConfiguration configuration, ValidationResult result, NestedValidatorContext context)
- {
- String grammarFile = "";
- Reader reader1 = null; // Used for the preparse.
- Reader reader2 = null; // Used for validation parse.
-
- if (inputStream != null)
- {
- String string = createStringForInputStream(inputStream);
- reader1 = new StringReader(string);
- reader2 = new StringReader(string);
- }
-
- XMLValidationInfo valinfo = new XMLValidationInfo(uri);
- MyEntityResolver entityResolver = new MyEntityResolver(uriResolver, context);
- ValidatorHelper helper = new ValidatorHelper();
- try
- {
- helper.computeValidationInformation(uri, reader1, uriResolver);
- valinfo.setDTDEncountered(helper.isDTDEncountered);
- valinfo.setElementDeclarationCount(helper.numDTDElements);
- valinfo.setNamespaceEncountered(helper.isNamespaceEncountered);
- valinfo.setGrammarEncountered(helper.isGrammarEncountered);
-
- XMLReader reader = createXMLReader(valinfo, entityResolver);
- // Set the configuration option
- if (configuration.getFeature(XMLValidationConfiguration.HONOUR_ALL_SCHEMA_LOCATIONS))
- {
- reader.setFeature("http://apache.org/xml/features/honour-all-schemaLocations", true); //$NON-NLS-1$
- }
- if (configuration.getFeature(XMLValidationConfiguration.USE_XINCLUDE))
- {
- reader.setFeature("http://apache.org/xml/features/xinclude", true); //$NON-NLS-1$
- }
- XMLErrorHandler errorhandler = new XMLErrorHandler(valinfo);
- reader.setErrorHandler(errorhandler);
-
- InputSource inputSource = new InputSource(uri);
- inputSource.setCharacterStream(reader2);
- reader.parse(inputSource);
- if(configuration.getIntFeature(XMLValidationConfiguration.INDICATE_NO_GRAMMAR) > 0 &&
- valinfo.isValid() && !helper.isGrammarEncountered)
- {
- if(configuration.getIntFeature(XMLValidationConfiguration.INDICATE_NO_GRAMMAR) == 1)
- valinfo.addWarning(XMLValidationMessages._WARN_NO_GRAMMAR, 1, 0, uri, NO_GRAMMAR_FOUND, null);
- else // 2
- valinfo.addError(XMLValidationMessages._WARN_NO_GRAMMAR, 1, 0, uri, NO_GRAMMAR_FOUND, null);
- }
-
- if (helper.isDTDEncountered)
- grammarFile = entityResolver.getLocation();
- else
- grammarFile = helper.schemaLocationString;
- }
- catch (SAXParseException saxParseException)
- {
- // These errors are caught by the error handler.
- //addValidationMessage(valinfo, saxParseException);
- }
- catch (IOException ioException)
- {
- addValidationMessage(valinfo, ioException);
- }
- catch (Exception exception)
- {
- Logger.logException(exception.getLocalizedMessage(), exception);
- }
-
- // Now set up the dependencies
- // Wrap with try catch so that if something wrong happens, validation can
- // still proceed as before
- if (result != null)
- {
- try
- {
- IResource resource = getWorkspaceFileFromLocation(grammarFile);
- ArrayList resources = new ArrayList();
- if (resource != null)
- resources.add(resource);
- result.setDependsOn((IResource [])resources.toArray(new IResource [0]));
- }
- catch (Exception e)
- {
- Logger.logException(e.getLocalizedMessage(), e);
- }
- }
-
- return valinfo;
-
- }
-
- /**
- * Add a validation message to the specified list.
- *
- * @param valinfo The validation info object to add the error to.
- * @param exception The exception that contains the validation information.
- */
- protected void addValidationMessage(XMLValidationInfo valinfo, IOException exception)
- {
- String validationMessageStr = exception.getMessage();
- Throwable cause = exception.getCause() != null ? exception.getCause() : exception;
- while(validationMessageStr == null && cause != null){
- String localizedMessage = cause.getLocalizedMessage();
- cause = cause.getCause();
- if(cause == null && localizedMessage != null )
- {
- validationMessageStr = localizedMessage;
- }
- }
-
- if (validationMessageStr != null)
- {
- if (cause instanceof FileNotFoundException)
- {
- validationMessageStr = NLS.bind(XMLValidationMessages._UI_PROBLEMS_VALIDATING_FILE_NOT_FOUND, new Object [] { validationMessageStr });
- }
- else if (cause instanceof UnknownHostException)
- {
- validationMessageStr = NLS.bind(XMLValidationMessages._UI_PROBLEMS_VALIDATING_UNKNOWN_HOST, new Object [] { validationMessageStr });
- }
- else if(cause instanceof ConnectException)
- {
- validationMessageStr = XMLValidationMessages._UI_PROBLEMS_CONNECTION_REFUSED;
- }
- }
-
- if (validationMessageStr != null)
- {
- XMLLocator locator = valinfo.getXMLLocator();
- valinfo.addWarning(validationMessageStr, locator != null ? locator.getLineNumber() : 1, locator != null ? locator.getColumnNumber() : 0, valinfo.getFileURI(), FILE_NOT_FOUND_KEY, null);
- }
- }
-
- /**
- * Add a validation message to the specified list.
- *
- * @param valinfo The validation info object to add the error to.
- * @param exception The exception that contains the validation information.
- */
- protected void addValidationMessage(XMLValidationInfo valinfo, SAXParseException exception)
- {
- if (exception.getMessage() != null)
- {
- valinfo.addError(exception.getLocalizedMessage(), exception.getLineNumber(), exception.getColumnNumber(), exception.getSystemId());
- }
- }
-
-
- /**
- * A custom entity resolver that uses the URI resolver specified to resolve entities.
- */
- protected class MyEntityResolver implements XMLEntityResolver
- {
- private URIResolver uriResolver;
- private String resolvedDTDLocation;
- private NestedValidatorContext context;
-
- /**
- * Constructor.
- *
- * @param uriResolver The URI resolver to use with this entity resolver.
- * @param context The XML validator context.
- */
- public MyEntityResolver(URIResolver uriResolver, NestedValidatorContext context)
- {
- this.uriResolver = uriResolver;
- this.context = context;
- }
-
- /* (non-Javadoc)
- * @see org.apache.xerces.xni.parser.XMLEntityResolver#resolveEntity(org.apache.xerces.xni.XMLResourceIdentifier)
- */
- public XMLInputSource resolveEntity(XMLResourceIdentifier rid) throws XNIException, IOException
- {
- XMLInputSource inputSource = _internalResolveEntity(uriResolver, rid, context);
- if (inputSource != null)
- {
- resolvedDTDLocation = inputSource.getSystemId();
- }
- return inputSource;
- }
-
- public String getLocation()
- {
- return resolvedDTDLocation;
- }
- }
-
- // cs : I've refactored the common SAX based resolution code into this method for use by other validators
- // (i.e. XML Schema, WSDL etc). The other approach is maintain a copy for each validator that has
- // identical code. In any case we should strive to ensure that the validators perform resolution consistently.
- public static XMLInputSource _internalResolveEntity(URIResolver uriResolver, XMLResourceIdentifier rid) throws IOException
- {
- return _internalResolveEntity(uriResolver, rid, null);
- }
-
- public static XMLInputSource _internalResolveEntity(URIResolver uriResolver, XMLResourceIdentifier rid, NestedValidatorContext context) throws IOException
- {
- XMLInputSource is = null;
-
- if (uriResolver != null)
- {
- String id = rid.getPublicId();
- if(id == null)
- {
- id = rid.getNamespace();
- }
-
- String location = null;
- if (id != null || rid.getLiteralSystemId() != null)
- {
- location = uriResolver.resolve(rid.getBaseSystemId(), id, rid.getLiteralSystemId());
- }
-
- if (location != null)
- {
- String physical = uriResolver.resolvePhysicalLocation(rid.getBaseSystemId(), id, location);
-
- // if physical is already a known bad uri, just go ahead and throw an exception
- if (context instanceof XMLNestedValidatorContext)
- {
- XMLNestedValidatorContext xmlContext = ((XMLNestedValidatorContext)context);
-
- if (xmlContext.isURIMarkedInaccessible(physical))
- {
- throw new FileNotFoundException(physical);
- }
- }
-
- is = new XMLInputSource(rid.getPublicId(), location, location);
-
- // This block checks that the file exists. If it doesn't we need to throw
- // an exception so Xerces will report an error. note: This may not be
- // necessary with all versions of Xerces but has specifically been
- // experienced with the version included in IBM's 1.4.2 JDK.
- InputStream isTemp = null;
- try
- {
- isTemp = new URL(physical).openStream();
- }
- catch (IOException e)
- {
- // physical was a bad url, so cache it so we know next time
- if (context instanceof XMLNestedValidatorContext)
- {
- XMLNestedValidatorContext xmlContext = ((XMLNestedValidatorContext)context);
- xmlContext.markURIInaccessible(physical);
- }
- throw e;
- }
- finally
- {
- if(isTemp != null)
- {
- isTemp.close();
- }
- }
- is.setByteStream(new LazyURLInputStream(physical));
- }
- }
- return is;
- }
-
- /**
- * An error handler to catch errors encountered while parsing the XML document.
- */
- protected class XMLErrorHandler implements org.xml.sax.ErrorHandler
- {
-
- private final int ERROR = 0;
- private final int WARNING = 1;
- private XMLValidationInfo valinfo;
-
- /**
- * Constructor.
- *
- * @param valinfo The XML validation info object that will hold the validation messages.
- */
- public XMLErrorHandler(XMLValidationInfo valinfo)
- {
- this.valinfo = valinfo;
- }
-
- /**
- * Add a validation message with the given severity.
- *
- * @param exception The exception that contains the message.
- * @param severity The severity of the message.
- */
-
- protected void addValidationMessage(SAXParseException exception, int severity)
- {
- if(exception.getSystemId() != null)
- {
- int lineNumber = exception.getLineNumber();
- int columnNumber = exception.getColumnNumber();
-
- // For the following three errors the line number will be modified to use that of the start
- // tag instead of the end tag.
- String currentErrorKey = valinfo.currentErrorKey;
- if (currentErrorKey != null && adjustLocationErrorKeySet.contains(currentErrorKey))
- {
- LocationCoordinate adjustedCoordinates = (LocationCoordinate)valinfo.getStartElementLocations().peek();
- lineNumber = adjustedCoordinates.getLineNumber();
- columnNumber = adjustedCoordinates.getColumnNumner();
- }
-
- if(severity == WARNING)
- {
- valinfo.addWarning(exception.getLocalizedMessage(), lineNumber, columnNumber, exception.getSystemId());
- }
- else
- {
- valinfo.addError(exception.getLocalizedMessage(), lineNumber, columnNumber, exception.getSystemId(), valinfo.getCurrentErrorKey(), valinfo.getMessageArguments());
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException)
- */
- public void error(SAXParseException exception) throws SAXException
- {
- addValidationMessage(exception, ERROR);
- }
-
- /* (non-Javadoc)
- * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
- */
- public void fatalError(SAXParseException exception) throws SAXException
- {
- addValidationMessage(exception, ERROR);
- }
-
- /* (non-Javadoc)
- * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException)
- */
- public void warning(SAXParseException exception) throws SAXException
- {
- addValidationMessage(exception, WARNING);
- }
- }
-
- /**
- * This class is used to count the elementDecls that are encountered in a DTD.
- */
- protected class MyDeclHandler implements DeclHandler
- {
-
- /**
- * Constructor.
- *
- * @param valinfo The XMLValidationInfo object that will count the declarations.
- */
- public MyDeclHandler()
- {
- }
-
- /* (non-Javadoc)
- * @see org.xml.sax.ext.DeclHandler#attributeDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
- */
- public void attributeDecl(String eName, String aName, String type, String valueDefault, String value)
- {
- }
-
- /* (non-Javadoc)
- * @see org.xml.sax.ext.DeclHandler#elementDecl(java.lang.String, java.lang.String)
- */
- public void elementDecl(String name, String model)
- {
- //valinfo.increaseElementDeclarationCount();
- }
-
- /* (non-Javadoc)
- * @see org.xml.sax.ext.DeclHandler#externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
- */
- public void externalEntityDecl(String name, String publicId, String systemId)
- {
- }
-
- /* (non-Javadoc)
- * @see org.xml.sax.ext.DeclHandler#internalEntityDecl(java.lang.String, java.lang.String)
- */
- public void internalEntityDecl(String name, String value)
- {
- }
- }
-
- /**
- * A XIncludeAwareParserConfiguration that creates an error reporter which can ignore
- * DTD error messages for DTD's with no elements defined.
- */
-
- protected class MyStandardParserConfiguration extends XIncludeAwareParserConfiguration
- {
- XMLValidationInfo valinfo = null;
- List reportedExceptions = new ArrayList();
-
- /**
- * Constructor.
- *
- * @param valinfo The XMLValidationInfo object to use.
- */
- public MyStandardParserConfiguration(XMLValidationInfo valinfo)
- {
- this.valinfo = valinfo;
-
- XMLErrorReporter errorReporter = createErrorReporter();
- if (errorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
- XMLMessageFormatter xmft = new XMLMessageFormatter();
- errorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
- errorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
- }
- fErrorReporter = errorReporter;
- setProperty(ERROR_REPORTER, errorReporter);
- fCommonComponents.remove(fErrorReporter);
- fCommonComponents.add(fErrorReporter);
- }
-
- /* (non-Javadoc)
- * @see org.apache.xerces.parsers.DTDConfiguration#createErrorReporter()
- */
- protected XMLErrorReporter createErrorReporter()
- {
- return new XMLErrorReporter()
- {
- /* (non-Javadoc)
- * @see org.apache.xerces.impl.XMLErrorReporter#reportError(java.lang.String, java.lang.String, java.lang.Object[], short)
- */
- public void reportError(String domain, String key, Object[] arguments, short severity) throws XNIException
- {
- boolean reportError = true;
- valinfo.setCurrentErrorKey(key);
- valinfo.setMessageArguments(arguments);
- String ignoreCondition = (String)ingoredErrorKeyTable.get(key);
- if (ignoreCondition != null)
- {
- if (ignoreCondition.equals(XMLValidator.IGNORE_IF_DTD_WITHOUT_ELEMENT_DECL))
- {
- boolean isDTDWithoutElementDeclarationEncountered = valinfo.isDTDWithoutElementDeclarationEncountered();
- reportError = !isDTDWithoutElementDeclarationEncountered;
- }
- else
- {
- reportError = false;
- }
- }
- if ("schema_reference.4".equals(key) && arguments.length > 0) //$NON-NLS-1$
- {
- Object location = arguments[0];
- if (location != null)
- {
- if(reportedExceptions.contains(location))
- {
- reportError = false;
- }
- else
- {
- reportedExceptions.add(location);
- }
- }
- }
- if (reportError)
- {
- super.reportError(domain, key, arguments, severity);
- valinfo.getErrorCustomizationManager().considerReportedError(valinfo, key, arguments);
- }
- }
- };
- }
- }
-
- /**
- * A line and column number coordinate.
- */
- protected class LocationCoordinate
- {
- private int lineNo = -1;
- private int columnNo = -1;
-
- public LocationCoordinate(int lineNumber, int columnNumber)
- {
- this.lineNo = lineNumber;
- this.columnNo = columnNumber;
- }
-
- public int getLineNumber()
- {
- return this.lineNo;
- }
-
- public int getColumnNumner()
- {
- return this.columnNo;
- }
- }
-
- protected IResource getWorkspaceFileFromLocation(String location)
- {
- if (location == null) return null;
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- // To canonicalize the EMF URI
- IPath canonicalForm = new Path(location);
- // Need to convert to absolute location...
- IPath pathLocation = new Path(URIHelper.removeProtocol(canonicalForm.toString()));
- // ...to find the resource file that is in the workspace
- IResource resourceFile = workspace.getRoot().getFileForLocation(pathLocation);
- // If the resource is resolved to a file from http, or a file outside
- // the workspace, then we will just ignore it.
- return resourceFile;
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/AbstractNestedValidator.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/AbstractNestedValidator.java
deleted file mode 100644
index 5e2dfa47d6..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/AbstractNestedValidator.java
+++ /dev/null
@@ -1,514 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xml.core.internal.validation.core;
-
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.wst.validation.AbstractValidator;
-import org.eclipse.wst.validation.ValidationResult;
-import org.eclipse.wst.validation.ValidationState;
-import org.eclipse.wst.validation.internal.core.Message;
-import org.eclipse.wst.validation.internal.core.ValidationException;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
-import org.eclipse.wst.validation.internal.provisional.core.IValidator;
-import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
-
-/**
- * An abstract validator that assists validators in running and contributing
- * nested messages in the validation results.
- * *note: Subclasses do not need to contribute nested messages in order to
- * benefit from the use of this class. This class takes care of iterating
- * through results for validators that use the standard context.
- */
-public abstract class AbstractNestedValidator extends AbstractValidator implements IValidatorJob
-{
- // Locally used, non-UI strings.
- private static final String REFERENCED_FILE_ERROR_OPEN = "referencedFileError("; //$NON-NLS-1$
- private static final String REFERENCED_FILE_ERROR_CLOSE = ")"; //$NON-NLS-1$
- private static final String FILE_PROTOCOL_NO_SLASH = "file:"; //$NON-NLS-1$
- private static final String FILE_PROTOCOL = "file:///"; //$NON-NLS-1$
- private final String GET_FILE = "getFile"; //$NON-NLS-1$
- private final String GET_PROJECT_FILES = "getAllFiles"; //$NON-NLS-1$
- private final String GET_INPUTSTREAM = "inputStream"; //$NON-NLS-1$
-
- // Internal strings. These strings are common addition information types.
- protected static final String COLUMN_NUMBER_ATTRIBUTE = "columnNumber"; //$NON-NLS-1$
- protected static final String SQUIGGLE_SELECTION_STRATEGY_ATTRIBUTE = "squiggleSelectionStrategy"; //$NON-NLS-1$
- protected static final String SQUIGGLE_NAME_OR_VALUE_ATTRIBUTE = "squiggleNameOrValue"; //$NON-NLS-1$
-
- /**
- * Perform the validation using version 2 of the validation framework.
- */
- public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor){
- ValidationResult result = new ValidationResult();
- IReporter reporter = result.getReporter(monitor);
- IFile file = null;
- if (resource instanceof IFile)file = (IFile)resource;
- if (file != null)
- {
- NestedValidatorContext nestedcontext = getNestedContext(state, false);
- boolean teardownRequired = false;
- if (nestedcontext == null)
- {
- // validationstart was not called, so manually setup and tear down
- nestedcontext = getNestedContext(state, true);
- setupValidation(nestedcontext);
- teardownRequired = true;
- }
-
- validate(file, null, result, reporter, nestedcontext);
-
- if (teardownRequired)
- teardownValidation(nestedcontext);
- }
- return result;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.validation.internal.provisional.core.IValidatorJob#validateInJob(org.eclipse.wst.validation.internal.provisional.core.IValidationContext, org.eclipse.wst.validation.internal.provisional.core.IReporter)
- */
- public IStatus validateInJob(IValidationContext context, IReporter reporter) throws ValidationException
- {
- NestedValidatorContext nestedcontext = new NestedValidatorContext();
- setupValidation(nestedcontext);
- String[] fileURIs = context.getURIs();
- if (fileURIs != null && fileURIs.length > 0)
- {
- int numFiles = fileURIs.length;
- for (int i = 0; i < numFiles && !reporter.isCancelled(); i++)
- {
- String fileName = fileURIs[i];
- if (fileName != null)
- {
- Object []parms = {fileName};
-
- IFile file = (IFile) context.loadModel(GET_FILE, parms);
- if (file != null && shouldValidate(file))
- {
- // The helper may not have a file stored in it but may have an InputStream if being
- // called from a source other than the validation framework such as an editor.
- if (context.loadModel(GET_INPUTSTREAM) instanceof InputStream) //$NON-NLS-1$
- {
- validate(file, (InputStream)context.loadModel(GET_INPUTSTREAM), null, reporter, nestedcontext); //do we need the fileName? what is int ruleGroup? //$NON-NLS-1$
- }
- else
- {
- validate(file, null, null, reporter, nestedcontext);
- }
- }
- }
- }
- }
- // TODO: Is this needed? Shouldn't the framework pass the complete list?
- // Should I know that I'm validating a project as opposed to files?
- else
- {
- Object []parms = {getValidatorID()};
- Collection files = (Collection) context.loadModel(GET_PROJECT_FILES, parms);
- Iterator iter = files.iterator();
- while (iter.hasNext() && !reporter.isCancelled())
- {
- IFile file = (IFile) iter.next();
- if(shouldValidate(file))
- {
- validate(file, null, null, reporter, nestedcontext);
- }
- }
- }
-
- teardownValidation(nestedcontext);
- if(reporter.isCancelled())
- return Status.CANCEL_STATUS;
- return Status.OK_STATUS;
- }
-
- /**
- * Provides the id of this validator. The ID is used by the validation
- * framework. It usually is the fully qualified class name of the class
- * implementing the IValidator interface.
- *
- * @return a String with the ID of this validator.
- */
- protected String getValidatorID()
- {
- return this.getClass().getName();
- }
-
- /**
- * Perform set up before validation runs. Subclasses may implement this
- * method to perform validation specific set up.
- *
- * @param context
- * The context of the current validation.
- */
- protected void setupValidation(NestedValidatorContext context)
- {
- // Default implementation does nothing.
- }
-
- /**
- * Perform tear down after validation runs. Subclasses may implement this
- * method to perform validation specific tear down.
- *
- * @param context
- * The context of the current validation.
- */
- protected void teardownValidation(NestedValidatorContext context)
- {
- // Default implementation does nothing.
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.validation.internal.provisional.core.IValidatorJob#getSchedulingRule(org.eclipse.wst.validation.internal.provisional.core.IValidationContext)
- */
- public ISchedulingRule getSchedulingRule(IValidationContext arg0)
- {
- // TODO review whether returning a null rule is correct. Gary had a suggestion in the bug report.
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.validation.internal.provisional.core.IValidator#cleanup(org.eclipse.wst.validation.internal.provisional.core.IReporter)
- */
- public void cleanup(IReporter arg0)
- {
- // No cleanup to perform. Subclasses are free to implement this method.
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.validation.internal.provisional.core.IValidator#validate(org.eclipse.wst.validation.internal.provisional.core.IValidationContext, org.eclipse.wst.validation.internal.provisional.core.IReporter)
- */
- public void validate(IValidationContext context, IReporter reporter) throws ValidationException
- {
- validateInJob(context, reporter);
- }
-
-
- /**
- * Determine if a given file should be validated.
- *
- * @param file The file that may be validated.
- * @return True if the file should be validated, false otherwise.
- */
- private static boolean shouldValidate(IFile file)
- {
- IResource resource = file;
- do
- {
- if (resource.isDerived() || resource.isTeamPrivateMember() ||
- !resource.isAccessible() || resource.getName().charAt(0) == '.')
- {
- return false;
- }
- resource = resource.getParent();
- }while ((resource.getType() & IResource.PROJECT) == 0);
-
- return true;
- }
-
- /**
- * Validate the given file and use the reporter for the validation messages.
- * This method does not perform the validation logic but rather delegates
- * to the validate method in subclasses to validate. This method is responsible
- * for reporting the messages that result from validation.
- *
- * @param file
- * An IFile to validate.
- * @param inputstream
- * An InputStream that represents the file. The InputStream may be null
- * in which case the files should be validated from the IFile.
- * @param result - The validation result
- * @param reporter
- * The reporter with which to report validation messages.
- * @param context
- * The context of the current validation.
- */
- private void validate(IFile file, InputStream inputstream, ValidationResult result, IReporter reporter, NestedValidatorContext context)
- {
- Message message = new LocalizedMessage(IMessage.LOW_SEVERITY, file.getFullPath().toString());
- reporter.displaySubtask(this, message);
-
- String locationString = null;
- if (file.getLocation() != null) {
- locationString = file.getLocation().toString();
- }
- if (locationString == null && file.getLocationURI() != null) {
- locationString = file.getLocationURI().toString();
- }
- if (locationString == null) {
- locationString = file.getFullPath().toString();
- }
- String uri = createURIForFilePath(locationString);
-
- clearMarkers(file, this, reporter);
-
- ValidationReport valreport = null;
- if (result == null)
- valreport = validate(uri, inputstream, context);
- else
- valreport = validate(uri, inputstream, context, result);
-
- createMarkers(file, valreport.getValidationMessages(), reporter);
-
- try
- {
- file.setSessionProperty(ValidationMessage.ERROR_MESSAGE_MAP_QUALIFIED_NAME, valreport.getNestedMessages());
- }
- catch(CoreException e)
- {
- System.out.println("Unable to set nested messages property."); //$NON-NLS-1$
- }
- }
-
- /**
- * Validate the given file and use the reporter for the validation messages.
- * Clients must implement this method with their specific validation logic.
- *
- * @param uri
- * The URI of the file to validate.
- * @param inputstream
- * An InputStream that represents the file. The InputStream may be null
- * in which case the files should be validated from the IFile.
- * @param context
- * The context of the current validation.
- * @return
- * A validation report summarizing the validation.
- */
- public abstract ValidationReport validate(String uri, InputStream inputstream, NestedValidatorContext context);
-
- /**
- * Validate the given file and use the reporter for the validation messages.
- * Clients should override this method with their specific validation logic.
- * This method should now be used instead of the abstract version.
- * Design decision to not make this abstract.
- *
- * @param uri
- * @param inputstream
- * @param context
- * @param result
- * @return
- */
- public ValidationReport validate(String uri, InputStream inputstream, NestedValidatorContext context, ValidationResult result)
- {
- return validate(uri, inputstream, context);
- }
-
- /**
- * This method clears all the markers on the given IFile for a specified
- * validator.
- * This is a convenience method for subclasses.
- *
- * @param iFile
- * The IFile from which to clear the markers.
- * @param validator
- * The validator for which to remove the markers.
- * @param reporter
- * The reporter that can remove the markers.
- */
- private void clearMarkers(IFile iFile, IValidator validator, IReporter reporter)
- {
- if (fileIsAccessible(iFile))
- {
- reporter.removeAllMessages(validator, iFile);
- }
- }
-
- /**
- * Test whether the given file is accessible and may be used for validation. A file is
- * available if
- * 1. It is not null.
- * 2. It exists.
- * 3. The project containing the file is accessible.
- *
- * @param file
- * The file to check to ensure it is accessible.
- * @return
- * True if the file is accessible, false otherwise.
- */
- private boolean fileIsAccessible(IFile file)
- {
- if (file != null && file.exists() && file.getProject().isAccessible())
- {
- return true;
- }
- return false;
- }
-
- /**
- * Format a file name into a correct URI.
- * This is a convenience method for subclasses.
- *
- * @param filename
- * The file name to format.
- * @return
- *
- * The formatted URI.
- */
- private String createURIForFilePath(String filename)
- {
- if(!filename.startsWith(FILE_PROTOCOL_NO_SLASH))
- {
- while(filename.startsWith("/")) //$NON-NLS-1$
- {
- filename = filename.substring(1);
- }
- filename = FILE_PROTOCOL + filename;
- }
- return filename;
- }
-
- /**
- * Create markers for the valiation messages generated from the validation.
- *
- * @param iFile
- * The resource to create the markers on.
- * @param valmessages
- * The array of validation messages.
- */
- public void createMarkers(IFile iFile, ValidationMessage[] valmessages, IReporter reporter)
- {
- if (!fileIsAccessible(iFile))
- {
- return;
- }
- int nummessages = valmessages.length;
- for (int i = 0; i < nummessages; i++)
- {
- ValidationMessage validationMessage = valmessages[i];
- String uri = validationMessage.getUri();
-
- LocalizedMessage message;
- if (validationMessage.getSeverity() == ValidationMessage.SEV_LOW)
- {
- message = new LocalizedMessage(IMessage.NORMAL_SEVERITY,
- validationMessage.getMessage(), iFile);
- }
- else
- {
- message = new LocalizedMessage(IMessage.HIGH_SEVERITY, validationMessage.getMessage(), iFile);
- }
-
- message.setLineNo(validationMessage.getLineNumber());
- addInfoToMessage(validationMessage, message);
-
- List nestederrors = validationMessage.getNestedMessages();
- if (nestederrors != null && !nestederrors.isEmpty())
- {
- message.setGroupName(REFERENCED_FILE_ERROR_OPEN + uri + REFERENCED_FILE_ERROR_CLOSE);
- }
-
- reporter.addMessage(this, message);
-
- }
- }
-
- /**
- * This method allows the addition of information to the validation message
- * @param validationmessage
- * The ValidationMessage to retrieve the information from.
- * @param message
- * The IMessage to add the information to.
- */
- protected void addInfoToMessage (ValidationMessage validationmessage, IMessage message)
- {
- // This method may be overridden by subclasses
- }
-
- /**
- * Get the nested validation context.
- *
- * @param state
- * the validation state.
- * @param create
- * when true, a new context will be created if one is not found
- * @return the nested validation context.
- */
- protected NestedValidatorContext getNestedContext(ValidationState state, boolean create)
- {
- NestedValidatorContext context = null;
- if (create)
- {
- context = new NestedValidatorContext();
- }
- return context;
- }
-
- /**
- * A localized message is a specialized type of IMessage that allows setting
- * and using a localized message string for a message.
- */
- class LocalizedMessage extends Message
- {
- private String _message = null;
-
- public LocalizedMessage(int severity, String messageText)
- {
- this(severity, messageText, null);
- }
-
- public LocalizedMessage(int severity, String messageText, IResource targetObject)
- {
- this(severity, messageText, (Object) targetObject);
- }
-
- public LocalizedMessage(int severity, String messageText, Object targetObject)
- {
- super(null, severity, null);
- setLocalizedMessage(messageText);
- setTargetObject(targetObject);
- }
-
- public void setLocalizedMessage(String message)
- {
- _message = message;
- }
-
- public String getLocalizedMessage()
- {
- return _message;
- }
-
- public String getText()
- {
- return getLocalizedMessage();
- }
-
- public String getText(ClassLoader cl)
- {
- return getLocalizedMessage();
- }
-
- public String getText(Locale l)
- {
- return getLocalizedMessage();
- }
-
- public String getText(Locale l, ClassLoader cl)
- {
- return getLocalizedMessage();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/Helper.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/Helper.java
deleted file mode 100644
index d9497af689..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/Helper.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xml.core.internal.validation.core;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.validation.internal.operations.ValidatorManager;
-import org.eclipse.wst.validation.internal.operations.WorkbenchContext;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-
-/**
- * A helper class for validation in the validation framework.
- *
- * @author Ernest Mah (ernest@ca.ibm.com)
- * @author Lawrence Mandel, IBM
- */
-public class Helper extends WorkbenchContext
-{
- public static final String GET_PROJECT_FILES = "getAllFiles"; //$NON-NLS-1$
- public static final String GET_FILE = "getFile"; //$NON-NLS-1$
- //dw private static final IContainer[] NO_CONTAINERS = new IContainer[0];
- public static final String VALIDATION_MARKER = "org.eclipse.wst.validation.problemmarker"; //$NON-NLS-1$
- public static final String VALIDATION_MARKER_OWNER = "owner"; //$NON-NLS-1$
-
- /**
- * Constructor.
- */
- public Helper()
- {
- super();
-
- // the following will register the helper's symbolic methods
- Class [] args = new Class[1] ;
- args[0] = String.class ; // a string argument denoting a specific JSP.
-
- registerModel(GET_FILE, "getFile", args);//$NON-NLS-1$
- registerModel(GET_PROJECT_FILES, "getFiles", args);//$NON-NLS-1$
- }
-
- /**
- * Get the IFile for the given filename.
- *
- * @param filename The name of the file to retrieve.
- * @return An IFile representing the file specified or null if it can't be resolved.
- */
- public IFile getFile(String filename)
- {
- // System.out.println("file name = " + filename);
- IResource res = getProject().findMember(filename, true); // true means include phantom resources
- if (res instanceof IFile)
- {
- return (IFile) res;
- }
- return null;
- }
-
- /**
- * Get the collection of files from the project that are relevant for the
- * validator with the given class name.
- *
- * @param validatorClassName The name of the validator class.
- * @return The collection of files relevant for the validator class specified.
- */
- public Collection getFiles(String validatorClassName)
- {
- IProject project = getProject();
- List files = new ArrayList();
- getFiles(files, project, validatorClassName);
- return files;
- }
-
- /**
- * Get the collection of files from the project that are relevant for the
- * validator with the given class name.
- *
- * @param files The files relevant for the class name.
- * @param resource The resource to look for files in.
- * @param validatorClassName The name of the validator class.
- */
- protected void getFiles(Collection files, IContainer resource, String validatorClassName)
- {
- try
- {
- IResource [] resourceArray = resource.members(false);
- for (int i=0; i<resourceArray.length; i++)
- {
- if (ValidatorManager.getManager().isApplicableTo(validatorClassName, resourceArray[i]))
- {
- if (resourceArray[i] instanceof IFile)
- {
- files.add(resourceArray[i]);
- }
- }
- if (resourceArray[i].getType() == IResource.FOLDER)
- getFiles(files,(IContainer)resourceArray[i], validatorClassName) ;
- }
- }
- catch (Exception e) {}
- }
-
-
-/**
- * Return the name of the resource, without the project-specific information
- * in front.
- *
- * This method is used by ValidationOperation to calculate the non-environment
- * specific names of the files. Only the IWorkbenchContext implementation knows how
- * much information to strip off of the IResource name. For example, if there is
- * an EJB Project named "MyEJBProject", and it uses the default names for the
- * source and output folders, "source" and "ejbModule", respectively, then the
- * current implementation of EJB Helper knows how much of that structure is
- * eclipse-specific.
- *
- * Since the "source" folder contains Java source files, a portable name would
- * be the fully-qualified name of the Java class, without the eclipse-specific
- * project and folder names in front of the file name. The EJBHelper knows that
- * everything up to the "source" folder, for example, can be removed, because,
- * according to the definition of the EJB Project, everything contained
- * in the source folder is java source code. So if there is an IResource in an
- * EJB Project named "/MyEJBProject/source/com/ibm/myclasses/MyJavaFile.java",
- * this method would make this name portable by stripping off the
- * "/MyEJBProject/source", and returning "com/ibm/myclasses/MyJavaFile.java".
- *
- * The output of this method is used by the ValidationOperation, when it
- * is calculating the list of added/changed/deleted file names for incremental
- * validation. If getPortableName(IResource) returns null, that means
- * that the IWorkbenchContext's implementation does not support that particular
- * type of resource, and the resource should not be included in the array of
- * IFileDelta objects in the IValidator's "validate" method.
- *
- * @param resource The resource to get the name from.
- * @return The portable name of the resource.
- */
-public String getPortableName(IResource resource)
- {
- // System.out.println("get portablename for " + resource);
- return resource.getProjectRelativePath().toString();
- }
-
-/**
- * When an IValidator associates a target object with an IMessage,
- * the WorkbenchReporter eventually resolves that target object
- * with an IResource. Sometimes more than one target object resolves
- * to the same IResource (usually the IProject, which is the default
- * IResource when an IFile cannot be found). This method is called,
- * by the WorkbenchReporter, so that the WorkbenchReporter can
- * distinguish between the IMessages which are on the same IResource,
- * but refer to different target objects. This is needed for the
- * removeAllMessages(IValidator, Object) method, so that when one
- * target object removes all of its messages, that it doesn't remove
- * another target object's messages.
- *
- * This method may return null only if object is null. Otherwise, an
- * id which can uniquely identify a particular object must be returned.
- * The id needs to be unique only within one particular IValidator.
- *
- * @param object The object from which to get the name.
- * @return The name of the object or null if the object is null.
- */
-public String getTargetObjectName(Object object)
- {
- if (object == null)
- {
- return null;
- }
-
- // System.out.println("get targetname for " + object);
- return object.toString();
- }
-
- /**
- * Delete the markers of the specified type from the specified resource.
- *
- * @param resource The resource to delete the markers from.
- * @param markerType The type of markers to delete from the resource.
- * @param attributeName The name of the attribute which the markers must have to be deleted.
- * @param attributeValue The value of the attribute corresponding to attributeName which the markers must have to be deleted.
- * @throws CoreException
- */
- public static void deleteMarkers(IResource resource, String markerType, final String attributeName, final Object attributeValue) throws CoreException
- {
- final IMarker[] v400Markers = resource.findMarkers(IMarker.PROBLEM, false, IResource.DEPTH_INFINITE);
- final IMarker[] markers = resource.findMarkers(markerType, true, IResource.DEPTH_INFINITE);
- IWorkspaceRunnable op = new IWorkspaceRunnable()
- {
- public void run(IProgressMonitor progressMonitor) throws CoreException
- {
- // this fixes defect 193406
- // here we remove markers that may have been added by the v400 code
- // hopefully the '.markers' metadata files will be removed for the V5 install
- // and this kludge will not be needed there
- for (int i = 0; i < v400Markers.length; i++)
- {
- IMarker marker = markers[i];
- marker.delete();
- }
-
- for (int i = 0; i < markers.length; i++)
- {
- IMarker marker = markers[i];
-
- Object value = marker.getAttribute(attributeName);
- if (value != null &&
- value.equals(attributeValue))
- {
- marker.delete();
- }
- }
- }
- };
-
- try
- {
- ResourcesPlugin.getWorkspace().run(op, null);
- }
- catch (Exception e) { }
- }
-
- /**
- * Get the validation framework severity for the given severity.
- *
- * @param severity The severity to convert to validation framework severity.
- * @return The validation framework severity for the given severity.
- */
- static public int getValidationFrameworkSeverity(int severity)
- {
- switch (severity)
- {
- case IMarker.SEVERITY_ERROR:
- return IMessage.HIGH_SEVERITY;
- case IMarker.SEVERITY_WARNING:
- return IMessage.NORMAL_SEVERITY;
- case IMarker.SEVERITY_INFO:
- return IMessage.LOW_SEVERITY;
- }
- return IMessage.LOW_SEVERITY;
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/LazyURLInputStream.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/LazyURLInputStream.java
deleted file mode 100644
index 834cb0b23a..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/LazyURLInputStream.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xml.core.internal.validation.core;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-
-/**
- * This class allows InputStreams to be created and returned to xerces without
- * actually opening file handles or network connections until it is absolutely
- * neccessary.
- */
-public class LazyURLInputStream extends InputStream
-{
- private static int debugTotalOpenStreamCount = 0;
- protected InputStream inner;
- protected String url;
- protected boolean error;
- boolean hasMarks;
- boolean pretendFileIsStillOpen;
-
- public LazyURLInputStream(String url)
- {
- this.url = url;
- inner = null;
- pretendFileIsStillOpen = false;
- }
-
- private void createInnerStreamIfRequired() throws IOException
- {
- if (inner == null && !error)
- {
- debugTotalOpenStreamCount++;
-
- try
- {
- inner = new URL(url).openStream();
- pretendFileIsStillOpen = false;
- hasMarks = false;
- }
- finally
- {
- if (inner == null)
- {
- error = true;
- }
- }
- }
- }
-
- protected void closeStream() throws IOException {
- if (inner != null && !pretendFileIsStillOpen) {
- inner.close();
- pretendFileIsStillOpen = true;
- }
- }
-
- public int available() throws IOException
- {
- if (pretendFileIsStillOpen) return 0;
- createInnerStreamIfRequired();
- if (inner == null) throw new IOException("Stream not available"); //$NON-NLS-1$
- return inner.available();
- }
-
- public void close() throws IOException
- {
- if (pretendFileIsStillOpen) {
- // Stop behaving as if the stream were still open.
- pretendFileIsStillOpen = false;
- } else {
- if (inner != null) {
- debugTotalOpenStreamCount--;
- inner.close();
- }
- }
- }
-
- public void mark(int readlimit)
- {
- if (pretendFileIsStillOpen) return;
- hasMarks = true;
- try {
- createInnerStreamIfRequired();
- inner.mark(readlimit);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- public boolean markSupported()
- {
- if (pretendFileIsStillOpen) return false;
- try {
- createInnerStreamIfRequired();
- if (inner == null) return false;
- return inner.markSupported();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return false;
- }
-
- public int read() throws IOException
- {
- if (pretendFileIsStillOpen) return -1;
- createInnerStreamIfRequired();
- if (inner == null) throw new IOException("Stream not available"); //$NON-NLS-1$
- int bytesRead = inner.read();
- if (bytesRead == -1 && !hasMarks) closeStream();
- return bytesRead;
- }
-
-
- public int read(byte[] b) throws IOException {
- if (pretendFileIsStillOpen) return -1;
- createInnerStreamIfRequired();
- if (inner == null) throw new IOException("Stream not available"); //$NON-NLS-1$
- int bytesRead = inner.read(b);
- if (bytesRead == -1 && !hasMarks) closeStream();
- return bytesRead;
- }
-
- public int read(byte[] b, int off, int len) throws IOException
- {
- if (pretendFileIsStillOpen) return -1;
- createInnerStreamIfRequired();
- if (inner == null) throw new IOException("Stream not available"); //$NON-NLS-1$
- int bytesRead = inner.read(b, off, len);
- if (bytesRead == -1 && !hasMarks) closeStream();
- return bytesRead;
- }
-
- public void reset() throws IOException
- {
- if (pretendFileIsStillOpen) return;
- createInnerStreamIfRequired();
- if (inner == null) throw new IOException("Stream not available"); //$NON-NLS-1$
- inner.reset();
- }
-
- public long skip(long n) throws IOException
- {
- if (pretendFileIsStillOpen) return 0;
- createInnerStreamIfRequired();
- if (inner == null) throw new IOException("Stream not available"); //$NON-NLS-1$
- return inner.skip(n);
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/NestedValidatorContext.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/NestedValidatorContext.java
deleted file mode 100644
index 3c2710ad42..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/NestedValidatorContext.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xml.core.internal.validation.core;
-
-
-/**
- * A context class for validators to be able to determine the context of
- * given validation session. Currently this class is only used to identify
- * the unique context.
- */
-public class NestedValidatorContext
-{
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/ValidationInfo.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/ValidationInfo.java
deleted file mode 100644
index fa2e1a597f..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/ValidationInfo.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.validation.core;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.xml.core.internal.validation.XMLValidationMessages;
-
-/**
- * This class handles messages from a validator. This class can handle
- *
- * @author Lawrence Mandel, IBM
- */
-public class ValidationInfo implements ValidationReport
-{
- private boolean WRAPPER_ERROR_SUPPORT_ENABLED = true;
- public static int SEV_ERROR = 0;
- public static int SEV_WARNING = 1;
-
- private String validating_file_uri = null;
- private URL validating_file_url = null;
- private boolean valid = true;
- private List messages = new ArrayList();
- private HashMap nestedMessages = new HashMap();
-
- /**
- * Constructor.
- *
- * @param uri
- * The URI of the file for the validation.
- */
- public ValidationInfo(String uri)
- {
- if(uri != null)
- {
- this.validating_file_uri = uri;
- try
- {
- this.validating_file_url = new URL(uri);
- } catch (MalformedURLException e)
- {
- }
- }
- }
-
- public String getFileURI()
- {
- return validating_file_uri;
- }
-
- public boolean isValid()
- {
- return valid;
- }
-
- /**
- * Add an error message.
- *
- * @param message The message to add.
- * @param line The line location of the message.
- * @param column The column location of the message.
- * @param uri The URI of the file that contains the message.
- */
- public void addError(String message, int line, int column, String uri)
- {
- addError(message, line, column, uri, null, null);
- }
-
- /**
- *
- * Add an error message.
- *
- * @param message The message to add.
- * @param line The line location of the message.
- * @param column The column location of the message.
- * @param uri The URI of the file that contains the message.
- * @param key The key for the message.
- * @param messageArguments more information about the error
- */
- public void addError(String message, int line, int column, String uri, String key, Object[] messageArguments)
- {
- if(addMessage(message, line, column, uri, SEV_ERROR, key, messageArguments))
- {
- valid = false;
- }
- }
-
- /**
- * Add a warning message.
- *
- * @param message The string message of the warning.
- * @param line The line location of the warning.
- * @param column The column location of the warning.
- * @param uri The URI of the file that contains the warning.
- */
- public void addWarning(String message, int line, int column, String uri)
- {
- addWarning(message, line, column, uri, null, null);
- }
-
- /**
- *
- * Add an error message.
- *
- * @param message The message to add.
- * @param line The line location of the message.
- * @param column The column location of the message.
- * @param uri The URI of the file that contains the message.
- * @param key The key for the message.
- * @param messageArguments more information about the error
- */
- public void addWarning(String message, int line, int column, String uri, String key, Object[] messageArguments)
- {
- addMessage(message, line, column, uri, SEV_WARNING, key, messageArguments);
- }
-
- /**
- * Add a message to the list. Return true if successful, false otherwise.
- *
- * @param message The message to add to the list.
- * @param line The line location of the message.
- * @param column The column location of the message.
- * @param uri The URI of the file that contains the message.
- * @param severity The severity of the message.
- * @param key the Xerces error key for this error
- * @param messageArguments more information on the error
- * @return True if the message was successfully added, false otherwise.
- */
- private boolean addMessage(String message, int line, int column, String uri, int severity, String key, Object[] messageArguments)
- {
- boolean successfullyAdded = false;
- // If the message if null there is nothing to add.
- if(message == null)
- {
- return successfullyAdded;
- }
- String errorURI = normalize(uri);
- URL errorURL = null;
- if (errorURI != null)
- {
- try
- {
- errorURL = new URL(errorURI);
- } catch (MalformedURLException e)
- {
- }
- //errorURI = normalizeURI(errorURI);
- }
- //boolean doDialog = true;
- if (errorURL != null)
- {
- successfullyAdded = true;
- // Add to the appropriate list if nested error support is off or
- // this message is for the current file.
- if (!WRAPPER_ERROR_SUPPORT_ENABLED || validating_file_url.sameFile(errorURL))
- {
-
- ValidationMessage valmes = new ValidationMessage(message, line,
- column, validating_file_uri, key, messageArguments);
- if (severity == SEV_ERROR)
- {
- valmes.setSeverity(ValidationMessage.SEV_NORMAL);
- } else if (severity == SEV_WARNING)
- {
- valmes.setSeverity(ValidationMessage.SEV_LOW);
- }
- messages.add(valmes);
- }
- // If nested error support is enabled create a nested error.
- else if (WRAPPER_ERROR_SUPPORT_ENABLED)
- {
- String nesteduri = errorURL.toExternalForm();
- ValidationMessage nestedmess = new ValidationMessage(message, line,
- column, nesteduri, key, messageArguments);
- if(severity == SEV_WARNING)
- {
- nestedmess.setSeverity(ValidationMessage.SEV_LOW);
- }
- else
- {
- nestedmess.setSeverity(ValidationMessage.SEV_NORMAL);
- }
-
- ValidationMessage container = (ValidationMessage) nestedMessages.get(nesteduri);
- if(container == null)
- {
- container = new ValidationMessage(NLS.bind(XMLValidationMessages._UI_REF_FILE_ERROR_MESSAGE, new Object [] { nesteduri }), 1, 0, nesteduri);
-
- // Initially set the nested error to a warning. This will automatically be changed
- // to an error if a nested message has a severity of error.
- container.setSeverity(ValidationMessage.SEV_LOW);
- nestedMessages.put(nesteduri, container);
- messages.add(container);
- }
- container.addNestedMessage(nestedmess);
- }
- }
- return successfullyAdded;
- }
-
-
- /**
- * Add a nested message to the validation information.
- *
- * @param message The string message of the validation message.
- * @param line The line location of the validation message.
- * @param column The column location of the validation message.
- * @param uri The URI of the validation message.
- * @param severity The severity of the validation message.
- */
-// public void addNestedMessage(String message, int line, int column, String uri, int severity)
-// {
-// ValidationMessage nestedmess = new ValidationMessage(message, line, column, uri);
-// if(severity == SEV_WARNING)
-// {
-// nestedmess.setSeverity(ValidationMessage.SEV_LOW);
-// }
-// else
-// {
-// nestedmess.setSeverity(ValidationMessage.SEV_NORMAL);
-// }
-// ValidationMessage container = (ValidationMessage)nestedMessages.get(uri);
-// if(container == null)
-// {
-// container = new ValidationMessage(XMLCoreValidationPlugin.getResourceString(_UI_REF_FILE_ERROR_MESSAGE, uri), 1, 0, validating_file_uri);
-// // Initially set the nested error to a warning. This will automatically be changed
-// // to an error if a nested message has a severity of error.
-// container.setSeverity(ValidationMessage.SEV_LOW);
-// nestedMessages.put(uri, container);
-// messages.add(container);
-// }
-// container.addNestedMessage(nestedmess);
-// }
-
- /**
- * @see org.eclipse.wsdl.validate.ValidationReport#getValidationMessages()
- */
- public ValidationMessage[] getValidationMessages()
- {
- return (ValidationMessage[])messages.toArray(new ValidationMessage[messages.size()]);
- }
-
- public HashMap getNestedMessages()
- {
- return nestedMessages;
- }
-
- /**
- * Put the URI in a standard format.
- *
- * @param uri The URI to put into a standard format.
- * @return The standard format of the URI.
- */
- private String normalize(String uri)
- {
-// if(uri.startsWith("platform:"))
-// {
-// try
-// {
-// uri = Platform.resolve(new URL(uri)).toString();
-// }
-// catch(Exception e)
-// {
-// }
-// }
- uri = uri.replaceAll("%20"," "); //$NON-NLS-1$ //$NON-NLS-2$
- uri = uri.replaceAll("%5E", "^"); //$NON-NLS-1$ //$NON-NLS-2$
- uri = uri.replace('\\','/');
-
- return uri;
- }
-
-}
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
deleted file mode 100644
index 5e1dcf7456..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/ValidationMessage.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xml.core.internal.validation.core;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-/**
- * A class for holding validation message information. Holds the message and the
- * message location.
- */
-public class ValidationMessage
-{
- public static final QualifiedName ERROR_MESSAGE_MAP_QUALIFIED_NAME = new QualifiedName("org.eclipse.wst.xml.validation", "errorMessageMap"); //$NON-NLS-1$ //$NON-NLS-2$
- protected String message;
- protected int lineNumber;
- protected int columnNumber;
- protected String uri;
- protected List nestedErrors;
- protected String key;
- protected Object[] messageArguments;
- protected int startOffset;
- protected int severity = IMessage.NORMAL_SEVERITY;
- public static int SEV_HIGH = IMessage.HIGH_SEVERITY;
- public static int SEV_NORMAL = IMessage.NORMAL_SEVERITY;
- public static int SEV_LOW = IMessage.LOW_SEVERITY;
-
- /**
- * Constructor.
- *
- * @param message The message for the validation message.
- * @param lineNumber The line location of the message.
- * @param columnNumber The column location of the message.
- */
- public ValidationMessage(String message, int lineNumber, int columnNumber)
- {
- this(message, lineNumber, columnNumber, null);
- }
-
- /**
- * Constructor.
- *
- * @param message The message for the validation message.
- * @param lineNumber The line location of the message.
- * @param columnNumber The column location of the message.
- * @param uri The uri of the file the message is for.
- */
- public ValidationMessage(String message, int lineNumber, int columnNumber, String uri)
- {
- this(message, lineNumber, columnNumber, uri, null, null);
- }
-
- /**
- * Constructor.
- *
- * @param message The message for the validation message.
- * @param lineNumber The line location of the message.
- * @param columnNumber The column location of the message.
- * @param uri The uri of the file the message is for.
- * @param key a unique string representing the error
- * @param messageArguments the arguments Xerces uses to create the message
- */
- public ValidationMessage(String message, int lineNumber, int columnNumber, String uri, String key, Object[] messageArguments)
- {
- this.message = message;
- this.lineNumber = lineNumber;
- this.columnNumber = columnNumber;
- this.uri = uri;
- this.key = key;
- this.messageArguments = messageArguments;
- this.startOffset = 0;
- }
-
-
- /**
- * Get the message for this valiation message.
- *
- * @return The message for this validation message.
- */
- public String getMessage()
- {
- return message;
- }
-
- /**
- * Get the column location.
- *
- * @return The column number.
- */
- public int getColumnNumber()
- {
- return columnNumber;
- }
-
- /**
- * Get the line location.
- *
- * @return The line number.
- */
- public int getLineNumber()
- {
- return lineNumber;
- }
-
- /**
- * Get the uri for the file that contains the message.
- *
- * @return The uri of the file that contains the message.
- */
- public String getUri()
- {
- return uri;
- }
-
- /**
- * Add a nested validation message to this validation message.
- *
- * @param validationMessage The validation message to add as a nested message.
- */
- public void addNestedMessage(ValidationMessage validationMessage)
- {
- if (nestedErrors == null)
- {
- nestedErrors = new ArrayList();
- }
- nestedErrors.add(validationMessage);
- int validaitonmessageSeverity = validationMessage.getSeverity();
- if(validaitonmessageSeverity == SEV_NORMAL || validaitonmessageSeverity == SEV_HIGH)
- {
- setSeverity(SEV_NORMAL);
- }
- }
-
- /**
- * Get the list of nested validation messages.
- *
- * @return The list of nested validation messages.
- */
- public List getNestedMessages()
- {
- return nestedErrors != null ? nestedErrors : Collections.EMPTY_LIST;
- }
-
- /**
- * Get the severity of the defect.
- *
- * @return The severity of the defect.
- */
- public int getSeverity()
- {
- return severity;
- }
-
- /**
- * Set the severity of the message.
- *
- * @param sev The severity to set.
- */
- public void setSeverity(int sev)
- {
- severity = sev;
- }
-
- public void setStartOffset(int offset)
- {
- this.startOffset = offset;
- }
-
- /**
- * @return Returns the key.
- */
- public String getKey()
- {
- return key;
- }
-
- public Object[] getMessageArguments()
- {
- 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/core/ValidationReport.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/ValidationReport.java
deleted file mode 100644
index dbb1570553..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/ValidationReport.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.validation.core;
-
-import java.util.HashMap;
-
-/**
- * An interface for a validation report.
- *
- * @author Lawrence Mandel, IBM
- */
-public interface ValidationReport
-{
- /**
- * Returns the URI for the file the report refers to.
- *
- * @return The URI for the file the report refers to.
- */
- public String getFileURI();
-
- /**
- * Returns whether the file is valid. The file may have warnings associated with it.
- *
- * @return True if the file is valid, false otherwise.
- */
- public boolean isValid();
-
- /**
- * Returns an array of validation messages.
- *
- * @return An array of validation messages.
- */
- public ValidationMessage[] getValidationMessages();
-
- public HashMap getNestedMessages();
-
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/logging/CommandLineLogger.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/logging/CommandLineLogger.java
deleted file mode 100644
index 0d38f38817..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/logging/CommandLineLogger.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xml.core.internal.validation.core.logging;
-
-/**
- * A logger that will print log info to System.out.
- *
- * @author Lawrence Mandel, IBM
- */
-public class CommandLineLogger implements ILogger
-{
- public void logError(String error, Throwable exception)
- {
- System.out.println(error);
- System.out.println(exception.toString());
- }
-
- public void logWarning(String warning, Throwable exception)
- {
- System.out.println(warning);
- System.out.println(exception.toString());
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/logging/EclipseLogger.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/logging/EclipseLogger.java
deleted file mode 100644
index 573cf2de9c..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/logging/EclipseLogger.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xml.core.internal.validation.core.logging;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
-
-
-/**
- * A logger that will log to the log file in the eclipse metadata directory.
- */
-public class EclipseLogger implements ILogger
-{
-
- public void logError(String error, Throwable exception)
- {
- XMLCorePlugin.getDefault().getLog().log(new Status(IStatus.ERROR, XMLCorePlugin.getDefault().getBundle().getSymbolicName(), IStatus.ERROR, error, exception));
- }
-
- public void logWarning(String warning, Throwable exception)
- {
- XMLCorePlugin.getDefault().getLog().log(new Status(IStatus.WARNING, XMLCorePlugin.getDefault().getBundle().getSymbolicName(), IStatus.WARNING, warning, exception));
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/logging/ILogger.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/logging/ILogger.java
deleted file mode 100644
index e81a410bc8..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/logging/ILogger.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.validation.core.logging;
-
-/**
- * The interface for a standard logger. Allows for logging errors and warnings.
- *
- * @author Lawrence Mandel, IBM
- */
-public interface ILogger
-{
- /**
- * Log an error message.
- *
- * @param error The error message to log.
- * @param exception The exception to log.
- */
- public void logError(String error, Throwable exception);
-
- /**
- * Log a warning message.
- *
- * @param warning The warning message to log.
- * @param exception The exception to log.
- */
- public void logWarning(String warning, Throwable exception);
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/logging/LoggerFactory.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/logging/LoggerFactory.java
deleted file mode 100644
index 81549e3e9d..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/logging/LoggerFactory.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.validation.core.logging;
-
-/**
- * The logger factory allows for simple use of whatever logging mechanism is in
- * place. The tool can specify a custom logging class and can request the
- * logger from this class.
- *
- * @author Lawrence Mandel, IBM
- *
- * @deprecated - not used in WTP or by any adopters as of 9/12/2007
- */
-public class LoggerFactory
-{
- private static ILogger logger = null;
- private static ClassLoader classloader = null;
- private static String loggerClass = null;
- private static final String commandlinelogger = "org.eclipse.wst.xml.validation.internal.core.logging.CommandLineLogger"; //$NON-NLS-1$
- private static final String eclipselogger = "org.eclipse.wst.xml.validation.internal.core.logging.EclipseLogger"; //$NON-NLS-1$
- private static String defaultlogger = commandlinelogger;
-
- /**
- * Get the one and only instance of the logger.
- *
- * @return The one and only instance of the logger.
- */
- public static ILogger getLoggerInstance()
- {
- if(logger == null)
- {
- if(loggerClass != null)
- {
- if(classloader != null)
- {
- try
- {
- Class lc = classloader.loadClass(loggerClass);
- logger = (ILogger) lc.newInstance();
- }
- catch (Exception e)
- {
- }
- }
- if(logger == null)
- {
- try
- {
- Class lc = LoggerFactory.class.getClassLoader().loadClass(loggerClass);
- logger = (ILogger) lc.newInstance();
- }
- catch (Exception e)
- {
- }
- }
- }
- if(logger == null)
- {
- try
- {
- Class lc = LoggerFactory.class.getClassLoader().loadClass(defaultlogger);
- logger = (ILogger) lc.newInstance();
- }
- catch (Exception e)
- {
- }
- }
- }
- return logger;
- }
-
- /**
- * Specify the logger implementation to be used.
- *
- * @param classname
- * The name of the logger class.
- * @param loggerclassloader
- * The classloader to use to load the logger. If null, the default
- * classloader will be used.
- */
- public static void specifyLogger(String classname, ClassLoader loggerclassloader)
- {
- loggerClass = classname;
- classloader = loggerclassloader;
- }
-
- /**
- * Set the default logger to the eclipse logger.
- */
- public static void useEclipseLogger()
- {
- defaultlogger = eclipselogger;
- }
-}
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
deleted file mode 100644
index 44a6481ad2..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/ErrorCustomizationPluginRegistryReader.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.validation.eclipse;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.wst.xml.core.internal.validation.errorcustomization.ErrorCustomizationRegistry;
-import org.eclipse.wst.xml.core.internal.validation.errorcustomization.ErrorMessageCustomizerDelegate;
-import org.osgi.framework.Bundle;
-/**
- * This class reads the plug-in manifests and registers each extension
- * error customizer with the ErrorCustomizationRegistry.
- */
-public class ErrorCustomizationPluginRegistryReader {
-
- protected static final String PLUGIN_ID = "org.eclipse.wst.xml.core"; //$NON-NLS-1$
- protected static final String ATT_CLASS = "class"; //$NON-NLS-1$
- protected static final String ATT_NAMESPACE = "namespace"; //$NON-NLS-1$
- protected static final String EXTENSION_POINT_ID = "errorCustomizer"; //$NON-NLS-1$
- protected static final String tagName = EXTENSION_POINT_ID;
-
- /**
- * Read from plugin registry for the errorcustomizer extension.
- */
- public void readRegistry()
- {
- IExtensionRegistry pluginRegistry = Platform.getExtensionRegistry();
- IExtensionPoint point = pluginRegistry.getExtensionPoint(PLUGIN_ID, EXTENSION_POINT_ID);
- if (point != null)
- {
- IConfigurationElement[] elements = point.getConfigurationElements();
- for (int i = 0; i < elements.length; i++)
- {
- readElement(elements[i]);
- }
- }
- }
-
- /**
- * readElement() - parse and deal with an extension like:
- *
- * <extension point="org.eclipse.wst.xml.core.errorCustomizer"
- * id="specificErrorCustomizer"
- * name="Specific Error Customizer">
- * <errorCustomizer
- * namespace="http://specificnamespace"
- * class="org.eclipse.wst.xml.core.MySpecificErrorCustomizer/>
- * </extension>
- */
- protected void readElement(IConfigurationElement element)
- {
- if (element.getName().equals(tagName))
- {
- String errorCustomizerClass = element.getAttribute(ATT_CLASS);
- String namespace = element.getAttribute(ATT_NAMESPACE);
-
- if (errorCustomizerClass != null)
- {
- try
- {
- Bundle pluginBundle = Platform.getBundle(element.getDeclaringExtension().getContributor().getName());
- ErrorMessageCustomizerDelegate delegate = new ErrorMessageCustomizerDelegate(pluginBundle, errorCustomizerClass);
- ErrorCustomizationRegistry.getInstance().addErrorMessageCustomizer(namespace, delegate);
- }
- catch (Exception e)
- {
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/Validator.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/Validator.java
deleted file mode 100644
index 4aae8745c2..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/Validator.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xml.core.internal.validation.eclipse;
-
-import java.io.InputStream;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.wst.validation.ValidationResult;
-import org.eclipse.wst.validation.ValidationState;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-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.XMLNestedValidatorContext;
-import org.eclipse.wst.xml.core.internal.validation.XMLValidationConfiguration;
-import org.eclipse.wst.xml.core.internal.validation.XMLValidationReport;
-import org.eclipse.wst.xml.core.internal.validation.core.AbstractNestedValidator;
-import org.eclipse.wst.xml.core.internal.validation.core.NestedValidatorContext;
-import org.eclipse.wst.xml.core.internal.validation.core.ValidationMessage;
-import org.eclipse.wst.xml.core.internal.validation.core.ValidationReport;
-
-public class Validator extends AbstractNestedValidator
-{
- private static final String XML_VALIDATOR_CONTEXT = "org.eclipse.wst.xml.core.validatorContext"; //$NON-NLS-1$
- protected int indicateNoGrammar = 0;
-
- /**
- * Set any preferences for XML validation.
- *
- * @see org.eclipse.wst.xml.core.internal.validation.core.AbstractNestedValidator#setupValidation(org.eclipse.wst.xml.core.internal.validation.core.NestedValidatorContext)
- */
- protected void setupValidation(NestedValidatorContext context)
- {
- super.setupValidation(context);
- indicateNoGrammar = XMLCorePlugin.getDefault().getPluginPreferences().getInt(XMLCorePreferenceNames.INDICATE_NO_GRAMMAR);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.xml.core.internal.validation.core.AbstractNestedValidator#validate(java.lang.String, java.io.InputStream, org.eclipse.wst.xml.core.internal.validation.core.NestedValidatorContext)
- */
- public ValidationReport validate(String uri, InputStream inputstream, NestedValidatorContext context)
- {
- return validate(uri, inputstream, context, null);
- }
-
- public ValidationReport validate(String uri, InputStream inputstream, NestedValidatorContext context, ValidationResult result)
- {
- XMLValidator validator = XMLValidator.getInstance();
-
- XMLValidationConfiguration configuration = new XMLValidationConfiguration();
- try
- {
- Preferences pluginPreferences = XMLCorePlugin.getDefault().getPluginPreferences();
- configuration.setFeature(XMLValidationConfiguration.INDICATE_NO_GRAMMAR, indicateNoGrammar);
- configuration.setFeature(XMLValidationConfiguration.USE_XINCLUDE, pluginPreferences.getBoolean(XMLCorePreferenceNames.USE_XINCLUDE));
- configuration.setFeature(XMLValidationConfiguration.HONOUR_ALL_SCHEMA_LOCATIONS, pluginPreferences.getBoolean(XMLCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS));
- }
- catch(Exception e)
- {
- // TODO: Unable to set the preference. Log this problem.
- }
-
- XMLValidationReport valreport = validator.validate(uri, inputstream, configuration, result, context);
-
- return valreport;
- }
-
- /**
- * Store additional information in the message parameters. For XML validation there
- * are three additional pieces of information to store:
- * param[0] = the column number of the error
- * param[1] = the 'squiggle selection strategy' for which DOM part to squiggle
- * param[2] = the name or value of what is to be squiggled
- *
- * @see org.eclipse.wst.xml.core.internal.validation.core.AbstractNestedValidator#addInfoToMessage(org.eclipse.wst.xml.core.internal.validation.core.ValidationMessage, org.eclipse.wst.validation.internal.provisional.core.IMessage)
- */
- protected void addInfoToMessage(ValidationMessage validationMessage, IMessage message)
- {
- String key = validationMessage.getKey();
- if(key != null)
- {
- XMLMessageInfoHelper messageInfoHelper = new XMLMessageInfoHelper();
- String[] messageInfo = messageInfoHelper.createMessageInfo(key, validationMessage.getMessageArguments());
-
- message.setAttribute(COLUMN_NUMBER_ATTRIBUTE, new Integer(validationMessage.getColumnNumber()));
- message.setAttribute(SQUIGGLE_SELECTION_STRATEGY_ATTRIBUTE, messageInfo[0]);
- message.setAttribute(SQUIGGLE_NAME_OR_VALUE_ATTRIBUTE, messageInfo[1]);
- }
- }
-
- /**
- * Get the nested validation context.
- *
- * @param state
- * the validation state.
- * @param create
- * when true, a new context will be created if one is not found
- * @return the nested validation context.
- */
- protected NestedValidatorContext getNestedContext(ValidationState state, boolean create)
- {
- NestedValidatorContext context = null;
- Object o = state.get(XML_VALIDATOR_CONTEXT);
- if (o instanceof XMLNestedValidatorContext)
- context = (XMLNestedValidatorContext)o;
- else if (create)
- {
- context = new XMLNestedValidatorContext();
- }
- return context;
- }
-
- public void validationStarting(IProject project, ValidationState state, IProgressMonitor monitor)
- {
- if (project != null)
- {
- NestedValidatorContext context = getNestedContext(state, false);
- if (context == null)
- {
- context = getNestedContext(state, true);
- setupValidation(context);
- state.put(XML_VALIDATOR_CONTEXT, context);
- }
- super.validationStarting(project, state, monitor);
- }
- }
-
- public void validationFinishing(IProject project, ValidationState state, IProgressMonitor monitor)
- {
- if (project != null)
- {
- super.validationFinishing(project, state, monitor);
- NestedValidatorContext context = getNestedContext(state, false);
- if (context != null)
- {
- teardownValidation(context);
- state.put(XML_VALIDATOR_CONTEXT, null);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/XMLMessageInfoHelper.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/XMLMessageInfoHelper.java
deleted file mode 100644
index 458251402c..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/XMLMessageInfoHelper.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xml.core.internal.validation.eclipse;
-
-/**
- * The message info helper determines the selection strategy for elements
- * in a SSE editor.
- *
- */
-public class XMLMessageInfoHelper
-{
- public XMLMessageInfoHelper()
- {
- super();
- }
-
- /**
- * Returns an array containing information about what should be underlined with the red "squiggles"
- * using the errorKey, and the messageArguments.
- * <br>Position 0 of the array returned contains the selection Strategy, or what DOM Element to underline.
- * For example "ATTRIBUTE_NAME"
- * <br>Position 1 contains the name or value to squiggle.
- * <p>For example, if we wanted to squiggle the attribute name of an attribute name
- * foo this method would return {"ATTRIBUTE_NAME", "foo"}
- * </p>
- * @param errorKey
- * The error key given by the Xerces parser.
- * @param messageArguments
- * The arguments used by Xerces to "fill in the blanks" of their messages.
- * @return
- * An array containing the squiggle information.
- * @see org.eclipse.wst.xml.ui.internal.validation.DelegatingSourceValidator
- *
- */
- public String[] createMessageInfo(String errorKey, Object[] messageArguments)
- {
- String selectionStrategy = null;
- String nameOrValue = null;
-
- if(errorKey != null)
- {
- if (errorKey.equals("cvc-complex-type.2.4.a") || errorKey.equals("cvc-complex-type.2.4.d") || errorKey.equals("cvc-complex-type.2.4.b") || errorKey.equals("MSG_CONTENT_INVALID") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- | errorKey.equals("MSG_CONTENT_INCOMPLETE") || errorKey.equals("MSG_REQUIRED_ATTRIBUTE_NOT_SPECIFIED") || errorKey.equals("cvc-complex-type.4")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- {
- selectionStrategy = "START_TAG"; //$NON-NLS-1$
- }
- else if (errorKey.equals("cvc-type.3.1.3")) //$NON-NLS-1$
- {
- selectionStrategy = "TEXT"; //$NON-NLS-1$
- }
- else if (errorKey.equals("cvc-complex-type.2.3")) //$NON-NLS-1$
- {
- selectionStrategy = "FIRST_NON_WHITESPACE_TEXT"; //$NON-NLS-1$
- }
- else if (errorKey.equals("cvc-type.3.1.1")) //$NON-NLS-1$
- {
- selectionStrategy = "ALL_ATTRIBUTES"; //$NON-NLS-1$
- }
- else if (errorKey.equals("cvc-complex-type.3.2.2") || errorKey.equals("MSG_ATTRIBUTE_NOT_DECLARED")) //$NON-NLS-1$ //$NON-NLS-2$
- {
- selectionStrategy = "ATTRIBUTE_NAME"; //$NON-NLS-1$
- //in this case we need nameOrValue to be the name of the attribute to underline
- nameOrValue = (String)messageArguments[1];
- }
- else if (errorKey.equals("cvc-attribute.3") || errorKey.equals("MSG_ATTRIBUTE_VALUE_NOT_IN_LIST") || errorKey.equals("cvc-complex-type.3.1")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- {
- selectionStrategy = "ATTRIBUTE_VALUE"; //$NON-NLS-1$
- //in this case we need nameOrValue to be the name of the Attribute
- if (errorKey.equals("cvc-attribute.3") || errorKey.equals("cvc-complex-type.3.1")) //$NON-NLS-1$ //$NON-NLS-2$
- {
- nameOrValue = (String)messageArguments[1];
- }
- else if (errorKey.equals("MSG_ATTRIBUTE_VALUE_NOT_IN_LIST")) //$NON-NLS-1$
- {
- nameOrValue = (String)messageArguments[0];
- }
- }
- else if (errorKey.equals("cvc-elt.4.2")) //$NON-NLS-1$
- {
- selectionStrategy="VALUE_OF_ATTRIBUTE_WITH_GIVEN_VALUE"; //$NON-NLS-1$
- //in this case we need nameOrValue to be the value of the attribute we want to unerline
- nameOrValue = (String)messageArguments[1];
- }
- else if (errorKey.equals("EntityNotDeclared")) //$NON-NLS-1$
- {
- selectionStrategy="TEXT_ENTITY_REFERENCE"; //$NON-NLS-1$
- nameOrValue = (String)messageArguments[0];
- }
- else if (errorKey.equals("ElementUnterminated")) //$NON-NLS-1$
- {
- selectionStrategy = "ENTIRE_ELEMENT"; //$NON-NLS-1$
- }
- else if (errorKey.equals("ETagUnterminated") || errorKey.equals("ETagRequired")) //$NON-NLS-1$ //$NON-NLS-2$
- {
- selectionStrategy = "END_TAG"; //$NON-NLS-1$
- }
- }
- String messageInfo[] = new String[2];
- messageInfo[0] = selectionStrategy != null? selectionStrategy: ""; //$NON-NLS-1$
- messageInfo[1] = nameOrValue;
- return messageInfo;
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/XMLValidator.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/XMLValidator.java
deleted file mode 100644
index d4810581a1..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/eclipse/XMLValidator.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xml.core.internal.validation.eclipse;
-
-import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin;
-
-/**
- * An XML validator specific to Eclipse. This validator will wrap the internal
- * XML validator and provide automatic URI resolution support. This class also
- * reads from the plug-in registry and registers all error customizers with the
- * registry.
- */
-public class XMLValidator extends org.eclipse.wst.xml.core.internal.validation.XMLValidator
-{
- private static XMLValidator instance = null;
-
- /**
- * Return the one and only instance of the XML validator. The validator
- * can be reused and cannot be customized so there should only be one instance of it.
- *
- * @return The one and only instance of the XML validator.
- */
- public static XMLValidator getInstance()
- {
- if(instance == null)
- {
- instance = new XMLValidator();
- }
- return instance;
- }
- /**
- * Constructor. Create the XML validator, set the URI resolver and
- * get the extension error customizers from the registry.
- */
- protected XMLValidator()
- {
- setURIResolver(URIResolverPlugin.createResolver());
- new ErrorCustomizationPluginRegistryReader().readRegistry();
- }
-}
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
deleted file mode 100644
index 649c99e553..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/ElementInformation.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.validation.errorcustomization;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A simple class to store information about an XML element.
- */
-public class ElementInformation
-{
- protected String localName;
- protected String namespace;
- protected List children = new ArrayList();
-
- /**
- * Constructor.
- *
- * @param uri
- * The namespace URI of the element.
- * @param localName
- * The local name of the element.
- */
- public ElementInformation(String uri, String localName)
- {
- this.localName = localName;
- this.namespace = uri;
- }
-
- /**
- * Get the namespace of this element.
- *
- * @return
- * The namespace of this element.
- */
- public String getNamespace()
- {
- return namespace;
- }
-
- /**
- * Get the local name of this element.
- *
- * @return
- * The local name of this element.
- */
- public String getLocalname()
- {
- return localName;
- }
-
- /**
- * Get the list of children of this element. The list contains
- * ElementInformation objects representing the children of this element.
- *
- * @return
- * The list of children of this element.
- */
- public List getChildren()
- {
- return children;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/ErrorCustomizationManager.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/ErrorCustomizationManager.java
deleted file mode 100644
index 745acc045a..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/ErrorCustomizationManager.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.validation.errorcustomization;
-
-import java.util.Stack;
-
-import org.eclipse.wst.xml.core.internal.validation.core.ValidationInfo;
-import org.eclipse.wst.xml.core.internal.validation.core.ValidationMessage;
-
-/**
- * This class tracks the context of the parsed document to help identify error
- * conditions
- */
-public class ErrorCustomizationManager
-{
- protected Stack elementInformationStack = new Stack();
- protected ErrorMessageInformation messageForConsideration;
-
- /**
- * This method should be called in the start element method of the XML validator's
- * content handler.
- *
- * @param uri
- * The namespace of the element.
- * @param localName
- * The local name of the element.
- */
- public void startElement(String uri, String localName)
- {
- ElementInformation elementInformation = new ElementInformation(uri, localName);
- if (elementInformationStack.size() > 0)
- {
- ElementInformation parent = (ElementInformation) elementInformationStack.peek();
- parent.children.add(elementInformation);
- }
- elementInformationStack.push(elementInformation);
- }
-
- /**
- * This method should be called in the end element method of the XML validator's
- * content handler.
- *
- * @param uri
- * The namespace of the element.
- * @param localName
- * The local name of the element.
- */
- public void endElement(String uri, String localName)
- {
- if (elementInformationStack.size() > 0)
- {
- ElementInformation elementInformation = (ElementInformation)elementInformationStack.pop();
- if (messageForConsideration != null)
- {
- IErrorMessageCustomizer[] customizers = ErrorCustomizationRegistry.getInstance().getCustomizers(elementInformation.getNamespace());
- int numCustomizers = customizers.length;
- for(int i = 0; i < numCustomizers; i++)
- {
- String message = customizers[i].customizeMessage(elementInformation, messageForConsideration.key, messageForConsideration.arguments);
- if(message != null)
- {
- messageForConsideration.message.setMessage(message);
- break;
- }
- }
- }
- }
- }
-
- /**
- * Consider the reported error for customization.
- *
- * @param valInfo
- * The current ValidationInfo object containing validation specific information.
- * @param key
- * The key related to the message.
- * @param arguments
- * Any message arguments.
- */
- public void considerReportedError(ValidationInfo valInfo, String key, Object[] arguments)
- {
- messageForConsideration = null;
- ValidationMessage[] messages = valInfo.getValidationMessages();
- if (messages.length > 0)
- {
- messageForConsideration = new ErrorMessageInformation();
- messageForConsideration.key = key;
- messageForConsideration.arguments = arguments;
- messageForConsideration.message = messages[messages.length - 1];
- }
- }
-
- /**
- * A simple class to hold error message information.
- */
- public class ErrorMessageInformation
- {
- public String key = null;
- public Object[] arguments = null;
- public ValidationMessage message = null;
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/ErrorCustomizationRegistry.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/ErrorCustomizationRegistry.java
deleted file mode 100644
index 20948794fa..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/ErrorCustomizationRegistry.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.validation.errorcustomization;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * The error customization regsitry manages all registered
- * IErrorMessageCustomizers by namespace.
- */
-public class ErrorCustomizationRegistry
-{
- protected static ErrorCustomizationRegistry registry = null;
- protected Map customizers = new HashMap();
-
- /**
- * Restricted constructor in keeping with the singleton pattern.
- */
- protected ErrorCustomizationRegistry()
- {
- }
-
- /**
- * Get the one and only instance of the registry.
- *
- * @return
- * The one and only instance of the registry.
- */
- public static ErrorCustomizationRegistry getInstance()
- {
- if(registry == null)
- {
- registry = new ErrorCustomizationRegistry();
- }
- return registry;
- }
-
- /**
- * Add a customizer to the registry.
- *
- * @param namespace
- * The namespace the customizer will act on.
- * @param customizer
- * The error customizer to register.
- */
- public void addErrorMessageCustomizer(String namespace, IErrorMessageCustomizer customizer)
- {
- // To register a customizer for the no namespace use an empty string.
- if(namespace == null)
- {
- namespace = ""; //$NON-NLS-1$
- }
- List customizersForNS = (List)customizers.get(namespace);
- if(customizersForNS == null)
- {
- customizersForNS = new ArrayList();
- customizers.put(namespace, customizersForNS);
- }
- if(customizer != null)
- {
- customizersForNS.add(customizer);
- }
- }
-
- /**
- * Get the error customizers for a given namespace.
- *
- * @param namespace
- * The namespace for which to retrieve the customizers.
- * @return
- * An array of customizers registered for this namespace.
- */
- public IErrorMessageCustomizer[] getCustomizers(String namespace)
- {
- if(namespace == null)
- {
- namespace = ""; //$NON-NLS-1$
- }
- List customizersForNS = (List)customizers.get(namespace);
- if(customizersForNS == null)
- {
- customizersForNS = new ArrayList();
- }
- return (IErrorMessageCustomizer[])customizersForNS.toArray(new IErrorMessageCustomizer[customizersForNS.size()]);
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/ErrorMessageCustomizerDelegate.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/ErrorMessageCustomizerDelegate.java
deleted file mode 100644
index 07147c1455..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/ErrorMessageCustomizerDelegate.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.validation.errorcustomization;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
-import org.osgi.framework.Bundle;
-
-/**
- * An error message customizer delegate is used to allow for
- * lazy loading of error customizers.
- *
- */
-public class ErrorMessageCustomizerDelegate implements IErrorMessageCustomizer
-{
- protected Bundle bundle = null;
- protected String classname = null;
- protected IErrorMessageCustomizer customizer = null;
-
- public ErrorMessageCustomizerDelegate(Bundle bundle, String classname)
- {
- this.bundle = bundle;
- this.classname = classname;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.xml.core.internal.validation.errorcustomization.IErrorMessageCustomizer#customizeMessage(org.eclipse.wst.xml.core.internal.validation.errorcustomization.ElementInformation, java.lang.String, java.lang.Object[])
- */
- public String customizeMessage(ElementInformation elementInfo, String errorKey, Object[] arguments)
- {
- if(customizer == null)
- {
- loadCustomizer();
- }
- if(customizer == null)
- {
- return null;
- }
- return customizer.customizeMessage(elementInfo, errorKey, arguments);
- }
-
- /**
- * Load the customizer class.
- */
- protected void loadCustomizer()
- {
- try
- {
- Class customizerClass = bundle.loadClass(classname);
- customizer = (IErrorMessageCustomizer)customizerClass.newInstance();
- }
- catch(Exception e)
- {
- XMLCorePlugin.getDefault().getLog().log(
- new Status(IStatus.WARNING,
- XMLCorePlugin.getDefault().getBundle().getSymbolicName(),
- IStatus.OK,
- "The XML validator error customizer was unable to load class " + classname, e)); //$NON-NLS-1$
- }
- }
-
-
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/IErrorMessageCustomizer.java b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/IErrorMessageCustomizer.java
deleted file mode 100644
index ac6d1e0d89..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/errorcustomization/IErrorMessageCustomizer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xml.core.internal.validation.errorcustomization;
-
-/**
- * An error message customizer will be called by the XML validator to customize
- * XML validation errors for a given namespace. The customizer can be used to
- * create clearer errors for specific application domains.
- */
-public interface IErrorMessageCustomizer
-{
- /**
- * Return a customized error message for the given element. Null should be returned
- * if the message should not be customized.
- *
- * @param elementInformation
- * The information about the element for which to customize the error.
- * @param errorKey
- * The key for the error for which to replace the message.
- * @param arguments
- * Arguments related the the error message.
- * @return
- * A customized error message or null if this customizer will not customize the message.
- */
- public String customizeMessage(ElementInformation elementInfo, String errorKey, Object[] arguments);
-}
diff --git a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/xmlvalidation.properties b/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/xmlvalidation.properties
deleted file mode 100644
index cd2009b76a..0000000000
--- a/bundles/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/xmlvalidation.properties
+++ /dev/null
@@ -1,32 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 2006 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
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-!-- Constants for strings
-
-! Usage:
-! {0} replaced with the host name
-!
-_UI_PROBLEMS_VALIDATING_UNKNOWN_HOST = The file cannot be validated as the host "{0}" is currently unreachable.
-
-! Usage:
-! {0} replaced with the file name
-!
-_UI_PROBLEMS_VALIDATING_FILE_NOT_FOUND = The file cannot be validated as the XML Schema "{0}" that is specified as describing the syntax of the file cannot be located.
-
-_UI_PROBLEMS_CONNECTION_REFUSED = The file cannot be validated as there was a connection problem.
-
-!
-! Referenced File Dialog Related Message
-!
-_UI_REF_FILE_ERROR_MESSAGE = Referenced file contains errors ({0}). For more information, right click on the message in the Problems View and select "Show Details..."
-
-# Warning when no grammar is located.
-_WARN_NO_GRAMMAR = No grammar constraints (DTD or XML schema) detected for the document.
-

Back to the top