NamedNodeMap attr = n.getAttributes();
IDynamicAdapter2 da = null;
if(n.getNodeName().equals("this"))
- da = new ThisResource2();
+ da = ThisResource2.INSTANCE;
else if(n.getNodeName().equals("graph"))
- da = new GraphObject2();
+ da = GraphObject2.INSTANCE;
else if(n.getNodeName().equals("bundle")) {
String bundleId = null;
Node fc = n.getFirstChild();
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
- if(schemaURL != null) {
+ if(schemaURL != null && validateAgainstSchema()) {
factory.setValidating(true);
factory.setAttribute(
}
}
-
- public void initialize(BundleContext context) {
+
+ private boolean validateAgainstSchema() {
+ return Platform.inDevelopmentMode();
+ }
+
+ public void initialize(BundleContext context) {
try {
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
- factory.setValidating(true);
- factory.setAttribute(
- "http://java.sun.com/xml/jaxp/properties/schemaLanguage",
- "http://www.w3.org/2001/XMLSchema");
- factory.setAttribute(
- "http://java.sun.com/xml/jaxp/properties/schemaSource",
- context.getBundle().getResource("adapters.xsd").toString());
+
+ if (validateAgainstSchema()) {
+ factory.setValidating(true);
+ factory.setAttribute(
+ "http://java.sun.com/xml/jaxp/properties/schemaLanguage",
+ "http://www.w3.org/2001/XMLSchema");
+ factory.setAttribute(
+ "http://java.sun.com/xml/jaxp/properties/schemaSource",
+ context.getBundle().getResource("adapters.xsd").toString());
+ }
// TODO Listen bundles (install/uninstall)
if (exceptions.isEmpty())