Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst')
-rw-r--r--bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/XSDValidationConfiguration.java71
-rw-r--r--bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/XSDValidator.java250
-rw-r--r--bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/Validator.java115
-rw-r--r--bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/XSDDelegatingValidator.java31
-rw-r--r--bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/XSDMessageInfoHelper.java120
-rw-r--r--bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/XSDValidator.java48
6 files changed, 0 insertions, 635 deletions
diff --git a/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/XSDValidationConfiguration.java b/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/XSDValidationConfiguration.java
deleted file mode 100644
index 0a57f95bc2..0000000000
--- a/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/XSDValidationConfiguration.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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
- * David Carver, Standards for Technology in Automotive Retail, bug 1147033
- *******************************************************************************/
-package org.eclipse.wst.xsd.core.internal.validation;
-
-/**
- * An XSD validation configuration allows setting specific configuration
- * information for a WTP XSD 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 XSDValidationConfiguration
-{
- public static String HONOUR_ALL_SCHEMA_LOCATIONS = "HONOUR_ALL_SCHEMA_LOCATIONS"; //$NON-NLS-1$
- public static String FULL_SCHEMA_CONFORMANCE = "FULL_SCHEMA_CONFORMANCE"; //$NON-NLS-1$
- private boolean honour_all_schema_locations = false;
- private boolean fullSchemaConformance = true;
-
- /**
- * 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(HONOUR_ALL_SCHEMA_LOCATIONS.equals(feature))
- honour_all_schema_locations = value;
- else if (FULL_SCHEMA_CONFORMANCE.equals(feature))
- fullSchemaConformance = value;
- else
- 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 boolean getFeature(String feature) throws Exception
- {
- if(HONOUR_ALL_SCHEMA_LOCATIONS.equals(feature))
- return honour_all_schema_locations;
- else if (FULL_SCHEMA_CONFORMANCE.equals(feature))
- return fullSchemaConformance;
-
- throw new Exception("Feature not recognized."); //$NON-NLS-1$
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/XSDValidator.java b/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/XSDValidator.java
deleted file mode 100644
index 1a6b5e9b93..0000000000
--- a/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/XSDValidator.java
+++ /dev/null
@@ -1,250 +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
- * David Carver, Standards for Technology in Automotive Retail, bug 1147033
- *******************************************************************************/
-package org.eclipse.wst.xsd.core.internal.validation;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.apache.xerces.impl.Constants;
-import org.apache.xerces.parsers.XMLGrammarPreparser;
-import org.apache.xerces.util.XMLGrammarPoolImpl;
-import org.apache.xerces.xni.XMLResourceIdentifier;
-import org.apache.xerces.xni.XNIException;
-import org.apache.xerces.xni.grammars.XMLGrammarDescription;
-import org.apache.xerces.xni.parser.XMLEntityResolver;
-import org.apache.xerces.xni.parser.XMLErrorHandler;
-import org.apache.xerces.xni.parser.XMLInputSource;
-import org.apache.xerces.xni.parser.XMLParseException;
-import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver;
-import org.eclipse.wst.xml.core.internal.validation.XMLValidator;
-import org.eclipse.wst.xml.core.internal.validation.core.ValidationInfo;
-import org.eclipse.wst.xml.core.internal.validation.core.ValidationReport;
-import org.w3c.dom.DOMError;
-
-/**
- * The XSDValidator will validate XSD files.
- */
-public class XSDValidator
-{
- protected URIResolver uriresolver = null;
-
- public ValidationReport validate(String uri)
- {
- return validate(uri, null);
- }
-
- public ValidationReport validate(String uri, InputStream inputStream)
- {
- return validate(uri, null, null);
- }
-
- /**
- * Validate the XSD file specified by the URI.
- *
- * @param uri
- * The URI of the XSD file to validate.
- * @param inputStream
- * An input stream representing the XSD file to validate.
- * @param configuration
- * A configuration for this validation run.
- */
- public ValidationReport validate(String uri, InputStream inputStream, XSDValidationConfiguration configuration)
- {
- if(configuration == null)
- {
- configuration = new XSDValidationConfiguration();
- }
- ValidationInfo valinfo = new ValidationInfo(uri);
- XSDErrorHandler errorHandler = new XSDErrorHandler(valinfo);
- try
- {
- XMLGrammarPreparser grammarPreparser = new XMLGrammarPreparser();
- grammarPreparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA,null/*schemaLoader*/);
-
- grammarPreparser.setProperty(Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY, new XMLGrammarPoolImpl());
- grammarPreparser.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE, false);
- grammarPreparser.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE, true);
- grammarPreparser.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.NAMESPACE_PREFIXES_FEATURE, true);
- grammarPreparser.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.VALIDATION_FEATURE, true);
- grammarPreparser.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_VALIDATION_FEATURE, true);
-
- grammarPreparser.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.EXTERNAL_GENERAL_ENTITIES_FEATURE, true);
- grammarPreparser.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.EXTERNAL_PARAMETER_ENTITIES_FEATURE, true);
- grammarPreparser.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ATTDEF_FEATURE, true);
-
- if(configuration.getFeature(XSDValidationConfiguration.HONOUR_ALL_SCHEMA_LOCATIONS))
- {
- try
- {
- grammarPreparser.setFeature(Constants.XERCES_FEATURE_PREFIX + "honour-all-schemaLocations", true); //$NON-NLS-1$
- }
- catch (Exception e)
- {
- // catch the exception and ignore
- }
- }
-
- if(configuration.getFeature(XSDValidationConfiguration.FULL_SCHEMA_CONFORMANCE)) {
- try
- {
- grammarPreparser.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_FULL_CHECKING, true);
- }
- catch (Exception e)
- {
- // ignore since we don't want to set it or can't.
- }
-
- }
-
- grammarPreparser.setErrorHandler(errorHandler);
- if (uriresolver != null)
- {
- XSDEntityResolver resolver = new XSDEntityResolver(uriresolver, uri);
- if (resolver != null)
- {
- grammarPreparser.setEntityResolver(resolver);
- }
- }
-
- try
- {
- XMLInputSource is = new XMLInputSource(null, uri, uri, inputStream, null);
- grammarPreparser.getLoader(XMLGrammarDescription.XML_SCHEMA);
- grammarPreparser.preparseGrammar(XMLGrammarDescription.XML_SCHEMA,is);
- }
- catch (Exception e)
- {
- //parser will return null pointer exception if the document is structurally invalid
- //TODO: log error message
- //System.out.println(e);
- }
- }
- catch (Exception e)
- {
- // TODO: log error.
- //System.out.println(e);
- }
- return valinfo;
- }
-
- /**
- * Set the URI resolver to use with XSD validation.
- *
- * @param uriresolver
- * The URI resolver to use.
- */
- public void setURIResolver(URIResolver uriresolver)
- {
- this.uriresolver = uriresolver;
- }
-
- /**
- * The XSDErrorHandler handle Xerces parsing errors and puts the errors
- * into the given ValidationInfo object.
- */
- protected class XSDErrorHandler implements XMLErrorHandler
- {
-
- private final ValidationInfo valinfo;
-
- public XSDErrorHandler(ValidationInfo valinfo)
- {
- this.valinfo = valinfo;
- }
-
- /**
- * Add a validation message with the given severity.
- *
- * @param errorKey The Xerces error key.
- * @param exception The exception that contains the information about the message.
- * @param severity The severity of the validation message.
- */
- protected void addValidationMessage(String errorKey, XMLParseException exception, int severity)
- {
- String systemId = exception.getExpandedSystemId();
- if (systemId != null)
- {
- if (severity == DOMError.SEVERITY_WARNING)
- {
- valinfo.addWarning(exception.getLocalizedMessage(), exception.getLineNumber(), exception.getColumnNumber(), systemId);
- }
- else
- {
- valinfo.addError(exception.getLocalizedMessage(), exception.getLineNumber(), exception.getColumnNumber(), systemId, errorKey, null);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.apache.xerces.xni.parser.XMLErrorHandler#warning(java.lang.String, java.lang.String, org.apache.xerces.xni.parser.XMLParseException)
- */
- public void warning(String domain, String key, XMLParseException exception) throws XNIException
- {
- addValidationMessage(key, exception, DOMError.SEVERITY_WARNING);
- }
-
- /* (non-Javadoc)
- * @see org.apache.xerces.xni.parser.XMLErrorHandler#error(java.lang.String, java.lang.String, org.apache.xerces.xni.parser.XMLParseException)
- */
- public void error(String domain, String key, XMLParseException exception) throws XNIException
- {
- addValidationMessage(key, exception, DOMError.SEVERITY_ERROR);
- }
-
- /* (non-Javadoc)
- * @see org.apache.xerces.xni.parser.XMLErrorHandler#fatalError(java.lang.String, java.lang.String, org.apache.xerces.xni.parser.XMLParseException)
- */
- public void fatalError(String domain, String key, XMLParseException exception) throws XNIException
- {
- addValidationMessage(key, exception, DOMError.SEVERITY_FATAL_ERROR);
- }
- }
-
- /**
- * The XSDEntityResolver wraps an idresolver to provide entity resolution to
- * the XSD validator.
- */
- protected class XSDEntityResolver implements XMLEntityResolver
- {
- private URIResolver uriresolver = null;
-
- /**
- * Constructor.
- *
- * @param idresolver
- * The idresolver this entity resolver wraps.
- * @param baselocation The base location to resolve with.
- */
- public XSDEntityResolver(URIResolver uriresolver, String baselocation)
- {
- this.uriresolver = uriresolver;
- }
-
- /* (non-Javadoc)
- * @see org.apache.xerces.xni.parser.XMLEntityResolver#resolveEntity(org.apache.xerces.xni.XMLResourceIdentifier)
- */
- public XMLInputSource resolveEntity(XMLResourceIdentifier resourceIdentifier) throws XNIException, IOException
- {
- String literalSystemId = resourceIdentifier.getLiteralSystemId();
- if(literalSystemId != null)
- {
- resourceIdentifier.setLiteralSystemId(literalSystemId.replace('\\','/'));
- }
- // TODO cs: In revision 1.1 we explicitly opened a stream to ensure
- // file I/O problems produced messages. I've remove this fudge for now
- // since I can't seem to reproduce the problem it was intended to fix.
- // I'm hoping the newer Xerces code base has fixed this problem and the fudge is defunct.
- return XMLValidator._internalResolveEntity(uriresolver, resourceIdentifier);
-
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/Validator.java b/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/Validator.java
deleted file mode 100644
index 5da031b3e4..0000000000
--- a/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/Validator.java
+++ /dev/null
@@ -1,115 +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, Standards for Technology in Automotive Retail, bug 1147033
- *******************************************************************************/
-
-package org.eclipse.wst.xsd.core.internal.validation.eclipse;
-
-import java.io.InputStream;
-import java.util.HashMap;
-
-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.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;
-import org.eclipse.wst.xsd.core.internal.XSDCorePlugin;
-import org.eclipse.wst.xsd.core.internal.preferences.XSDCorePreferenceNames;
-import org.eclipse.wst.xsd.core.internal.validation.XSDValidationConfiguration;
-
-public class Validator extends AbstractNestedValidator
-{
- protected HashMap xsdConfigurations = new HashMap();
-
- /* (non-Javadoc)
- * @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)
- {
- XSDValidationConfiguration configuration = new XSDValidationConfiguration();
- boolean honourAllSchemaLocations = XMLCorePlugin.getDefault().getPluginPreferences().getBoolean(XMLCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS);
- boolean fullSchemaConformance = XSDCorePlugin.getDefault().getPluginPreferences().getBoolean(XSDCorePreferenceNames.FULL_SCHEMA_CONFORMANCE);
- try
- {
- configuration.setFeature(XSDValidationConfiguration.HONOUR_ALL_SCHEMA_LOCATIONS, honourAllSchemaLocations);
- configuration.setFeature(XSDValidationConfiguration.FULL_SCHEMA_CONFORMANCE, fullSchemaConformance);
- }
- catch(Exception e)
- {
- // Unable to set the honour all schema locations option. Do nothing.
- }
- xsdConfigurations.put(context, configuration);
-
- super.setupValidation(context);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.xml.core.internal.validation.core.AbstractNestedValidator#teardownValidation(org.eclipse.wst.xml.core.internal.validation.core.NestedValidatorContext)
- */
- protected void teardownValidation(NestedValidatorContext context)
- {
- xsdConfigurations.remove(context);
-
- super.teardownValidation(context);
- }
-
- /* (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)
- {
- XSDValidator validator = XSDValidator.getInstance();
-
- XSDValidationConfiguration configuration = (XSDValidationConfiguration)xsdConfigurations.get(context);
-
- ValidationReport valreport = null;
-
- valreport = validator.validate(uri, inputstream, configuration);
-
- return valreport;
- }
-
- /**
- * Store additional information in the message parameters. For XSD 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)
- {
- XSDMessageInfoHelper messageInfoHelper = new XSDMessageInfoHelper();
- String[] messageInfo = messageInfoHelper.createMessageInfo(key, validationMessage.getMessage());
-
- 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]);
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.wst.xml.core.internal.validation.core.AbstractNestedValidator#getValidatorID()
- */
- protected String getValidatorID()
- {
- // Because this class is used as a delegate, return the id of the validator
- // which delegates to this class.
-
- return XSDDelegatingValidator.class.getName();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/XSDDelegatingValidator.java b/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/XSDDelegatingValidator.java
deleted file mode 100644
index 3f615ba45f..0000000000
--- a/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/XSDDelegatingValidator.java
+++ /dev/null
@@ -1,31 +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.xsd.core.internal.validation.eclipse;
-
-import org.eclipse.wst.validation.internal.delegates.DelegatingValidator;
-
-/**
- * This class provides a unique name (class name) which the validation framework
- * will use to identify the XSD validator. The actual delegating validator
- * functionality is provided by the base class. The actual validation
- * functionality is provided by the delegates registered with this class as
- * their target.
- */
-public class XSDDelegatingValidator extends DelegatingValidator
-{
- /**
- * Default constructor.
- */
- public XSDDelegatingValidator()
- {
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/XSDMessageInfoHelper.java b/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/XSDMessageInfoHelper.java
deleted file mode 100644
index 5de3299414..0000000000
--- a/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/XSDMessageInfoHelper.java
+++ /dev/null
@@ -1,120 +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.xsd.core.internal.validation.eclipse;
-
-
-/**
- * The XSDMessageInfoHelper creates a string with the
- */
-public class XSDMessageInfoHelper
-{
- public XSDMessageInfoHelper()
- { super();
- }
-
- public String[] createMessageInfo(String errorKey, String errorMessage)
- {
- //Now map the error key to what we would want to underline:
- String nameOrValue = "";
- String selectionStrategy = "";
- if(errorKey != null)
- {
- if (errorKey.equals("s4s-elt-invalid-content.1") || errorKey.equals("s4s-elt-must-match.1") ||
- errorKey.equals("s4s-att-must-appear") || errorKey.equals("s4s-elt-invalid-content.2")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- {
- selectionStrategy = "START_TAG"; //$NON-NLS-1$
- }
- else if (errorKey.equals("s4s-att-not-allowed")) //$NON-NLS-1$
- {
- selectionStrategy = "ATTRIBUTE_NAME"; //$NON-NLS-1$
- nameOrValue = getFirstStringBetweenSingleQuotes(errorMessage);
- }
- else if (errorKey.equals("s4s-att-invalid-value")) //$NON-NLS-1$
- {
- selectionStrategy = "ATTRIBUTE_VALUE"; //$NON-NLS-1$
- nameOrValue = getFirstStringBetweenSingleQuotes(errorMessage);
- }
- else if (errorKey.equals("s4s-elt-character")) //$NON-NLS-1$
- {
- selectionStrategy = "TEXT"; //$NON-NLS-1$
- }
- else if (errorKey.equals("src-resolve.4.2") || errorKey.equals("src-resolve")) //$NON-NLS-1$ //$NON-NLS-2$
- {
- selectionStrategy = "VALUE_OF_ATTRIBUTE_WITH_GIVEN_VALUE"; //$NON-NLS-1$
- nameOrValue = getFirstStringBetweenSingleQuotes(errorMessage);
- }
- else if (errorKey.equals("EqRequiredInAttribute") || errorKey.equals("OpenQuoteExpected") ||
- errorKey.equals("LessthanInAttValue")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- {
- selectionStrategy = "ATTRIBUTE_NAME"; //$NON-NLS-1$
- nameOrValue = getFirstStringBetweenQuotes(errorMessage);
- }
- 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;
- messageInfo[1] = nameOrValue;
- return messageInfo;
- }
-
- /**
- * This method is used to get the value between the first pair of single quotes
- * It is used to extract information from the error Message (for example
- * an attribute name)
- *
- * @param s
- * The string to extract the value from.
- */
- protected String getFirstStringBetweenSingleQuotes(String s)
- {
- return getFirstStringBetweenDelimiters(s, '\'');
- }
-
- /**
- * This method is used to get the value between the first pair of quotes
- * It is used to extract information from the error Message (for example
- * an attribute name)
- *
- * @param s
- * The string to extract the value from.
- */
- protected String getFirstStringBetweenQuotes(String s)
- {
- return getFirstStringBetweenDelimiters(s, '\"');
- }
-
- /**
- * This method is used to get the value between the first start and end occurrences of the given delimiter character.
- *
- * @param s
- * The string to extract the value from.
- * @param delimiter
- * The start and end character
- */
- protected String getFirstStringBetweenDelimiters(String s, char delimiter)
- {
- int first = s.indexOf(delimiter);
- int second = s.indexOf(delimiter, first + 1);
- String stringBetweenDelimiters = null;
- if (first != -1 && second != -1)
- {
- stringBetweenDelimiters = s.substring(first + 1, second);
- }
- return stringBetweenDelimiters;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/XSDValidator.java b/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/XSDValidator.java
deleted file mode 100644
index fbe1a0333e..0000000000
--- a/bundles/org.eclipse.wst.xsd.core/src-validation/org/eclipse/wst/xsd/core/internal/validation/eclipse/XSDValidator.java
+++ /dev/null
@@ -1,48 +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.xsd.core.internal.validation.eclipse;
-
-import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin;
-
-
-/**
- * An XSD validator specific to Eclipse. This validator will wrap the internal
- * XSD validator an provide automatic URI resolution support.
- * Using this class is equivalent to using the internal XSD validator and registering
- * the URI resolver from the URI resolution framework.
- */
-public class XSDValidator extends org.eclipse.wst.xsd.core.internal.validation.XSDValidator
-{
- private static XSDValidator instance = null;
-
- /**
- * Return the one and only instance of the XSD 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 XSD validator.
- */
- public static XSDValidator getInstance()
- {
- if(instance == null)
- {
- instance = new XSDValidator();
- }
- return instance;
- }
- /**
- * Constructor. Create the XSD validator and set the URI resolver.
- */
- protected XSDValidator()
- {
- this.setURIResolver(URIResolverPlugin.createResolver());
- }
-}

Back to the top