[114915] performance - Make WSDL model not to use deferred DOM
diff --git a/bundles/org.eclipse.wst.wsdl/src-wsdl/org/eclipse/wst/wsdl/util/WSDLResourceImpl.java b/bundles/org.eclipse.wst.wsdl/src-wsdl/org/eclipse/wst/wsdl/util/WSDLResourceImpl.java
index ee5e521..c967624 100644
--- a/bundles/org.eclipse.wst.wsdl/src-wsdl/org/eclipse/wst/wsdl/util/WSDLResourceImpl.java
+++ b/bundles/org.eclipse.wst.wsdl/src-wsdl/org/eclipse/wst/wsdl/util/WSDLResourceImpl.java
@@ -260,6 +260,22 @@
documentBuilderFactory.setNamespaceAware(true);
documentBuilderFactory.setValidating(false);
+ try
+ {
+ // Using a deferred DOM document in the WSDL model may cause a
+ // performance problem in terms of memory consumption in particular.
+ // We're attempting to use the feature which instructs the Xerces parser
+ // to not use deferred DOM trees.
+ // TODO Convert to use setFeature when it becomes available. The Xerces
+ // versions < 2.7.1 do not fully support setFeature, so we have to use
+ // setAttribute.
+ documentBuilderFactory.setAttribute("http://apache.org/xml/features/dom/defer-node-expansion", Boolean.FALSE); //$NON-NLS-1$
+ }
+ catch (IllegalArgumentException e)
+ {
+ // Ignore, as the code will have to run with parsers other than Xerces.
+ }
+
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
// TBD - Revisit