-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #363 Signed-off-by: azerr <azerr@redhat.com>
- Loading branch information
1 parent
2c6d46a
commit 2ee7159
Showing
13 changed files
with
223 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...e/lsp4xml/extensions/contentmodel/participants/diagnostics/LSPXMLParserConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2019 Red Hat Inc. and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* Contributors: | ||
* Red Hat Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.lsp4xml.extensions.contentmodel.participants.diagnostics; | ||
|
||
import org.apache.xerces.impl.Constants; | ||
import org.apache.xerces.impl.xs.XMLSchemaValidator; | ||
import org.apache.xerces.parsers.XIncludeAwareParserConfiguration; | ||
|
||
/** | ||
* Custom Xerces configuration to configure XSD version. | ||
* | ||
*/ | ||
class LSPXMLParserConfiguration extends XIncludeAwareParserConfiguration { | ||
|
||
private static final String XML_SCHEMA_VERSION = Constants.XERCES_PROPERTY_PREFIX | ||
+ Constants.XML_SCHEMA_VERSION_PROPERTY; | ||
|
||
private static final String SCHEMA_VALIDATOR = Constants.XERCES_PROPERTY_PREFIX | ||
+ Constants.SCHEMA_VALIDATOR_PROPERTY; | ||
|
||
private final String namespaceSchemaVersion; | ||
|
||
public LSPXMLParserConfiguration(String namespaceSchemaVersion) { | ||
this.namespaceSchemaVersion = namespaceSchemaVersion; | ||
} | ||
|
||
@Override | ||
protected void configurePipeline() { | ||
super.configurePipeline(); | ||
configureSchemaVersion(); | ||
} | ||
|
||
@Override | ||
protected void configureXML11Pipeline() { | ||
super.configureXML11Pipeline(); | ||
configureSchemaVersion(); | ||
} | ||
|
||
private void configureSchemaVersion() { | ||
if (namespaceSchemaVersion != null) { | ||
XMLSchemaValidator validator = (XMLSchemaValidator) super.getProperty(SCHEMA_VALIDATOR); | ||
if (validator != null) { | ||
validator.setProperty(XML_SCHEMA_VERSION, namespaceSchemaVersion); | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.