aboutsummaryrefslogtreecommitdiff
path: root/common/src/at/gv/egovernment/moa/util
diff options
context:
space:
mode:
authorpeter.danner <peter.danner@d688527b-c9ab-4aba-bd8d-4036d912da1d>2007-05-02 13:45:19 +0000
committerpeter.danner <peter.danner@d688527b-c9ab-4aba-bd8d-4036d912da1d>2007-05-02 13:45:19 +0000
commit0f7722cb0b88ab50b0e4ff22f492afae74c474b9 (patch)
treeee85e5250644e5eae0b2e330998c1d4abfdd75a7 /common/src/at/gv/egovernment/moa/util
parentab5ea0c7cb3a82ba4498811ed500a3e64de53f2a (diff)
downloadmoa-id-spss-0f7722cb0b88ab50b0e4ff22f492afae74c474b9.tar.gz
moa-id-spss-0f7722cb0b88ab50b0e4ff22f492afae74c474b9.tar.bz2
moa-id-spss-0f7722cb0b88ab50b0e4ff22f492afae74c474b9.zip
Added Map, that holds the NamespaceURIs of the grammarPool, to prevent multiple entries of one NamespaceURI
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@825 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'common/src/at/gv/egovernment/moa/util')
-rw-r--r--common/src/at/gv/egovernment/moa/util/DOMUtils.java41
1 files changed, 25 insertions, 16 deletions
diff --git a/common/src/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/at/gv/egovernment/moa/util/DOMUtils.java
index fddf16944..95ee3aa4d 100644
--- a/common/src/at/gv/egovernment/moa/util/DOMUtils.java
+++ b/common/src/at/gv/egovernment/moa/util/DOMUtils.java
@@ -94,9 +94,13 @@ public class DOMUtils {
private static SymbolTable symbolTable = new SymbolTable(BIG_PRIME);
/** Xerces schema grammar pool. */
private static XMLGrammarPool grammarPool = new XMLGrammarPoolImpl();
-
+ /** Map, that holds the NamespaceURIs of the grammarPool, to prevent multiple
+ * entries of one NamespaceURI */
+ private static Set grammarNamespaces;
+
static {
grammarPool.lockPool();
+ grammarNamespaces = new HashSet();
}
/**
@@ -111,23 +115,28 @@ public class DOMUtils {
throws IOException {
XMLGrammarPreparser preparser;
- // unlock the pool so that we can add another grammar
- grammarPool.unlockPool();
-
- // prepare the preparser
- preparser = new XMLGrammarPreparser(symbolTable);
- preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null);
- preparser.setProperty(GRAMMAR_POOL, grammarPool);
- preparser.setFeature(NAMESPACES_FEATURE, true);
- preparser.setFeature(VALIDATION_FEATURE, true);
+ if (!grammarNamespaces.contains(systemId)) {
- // add the grammar to the pool
- preparser.preparseGrammar(
+ grammarNamespaces.add(systemId);
+
+ // unlock the pool so that we can add another grammar
+ grammarPool.unlockPool();
+
+ // prepare the preparser
+ preparser = new XMLGrammarPreparser(symbolTable);
+ preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null);
+ preparser.setProperty(GRAMMAR_POOL, grammarPool);
+ preparser.setFeature(NAMESPACES_FEATURE, true);
+ preparser.setFeature(VALIDATION_FEATURE, true);
+
+ // add the grammar to the pool
+ preparser.preparseGrammar(
XMLGrammarDescription.XML_SCHEMA,
- new XMLInputSource(null, systemId, null, inputStream, null));
-
- // lock the pool again so that schemas are not added automatically
- grammarPool.lockPool();
+ new XMLInputSource(null, systemId, null, inputStream, null));
+
+ // lock the pool again so that schemas are not added automatically
+ grammarPool.lockPool();
+ }
}
/**