From 459bf13822331ca0cb4af7cdc7f50aafe5a18263 Mon Sep 17 00:00:00 2001 From: hns Date: Thu, 23 May 2002 19:50:40 +0000 Subject: [PATCH] Merged Stefan Pollach's XML Database branch. --- src/helma/scripting/fesi/extensions/DomExtension.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/helma/scripting/fesi/extensions/DomExtension.java b/src/helma/scripting/fesi/extensions/DomExtension.java index 374c6c87..c478b7bd 100644 --- a/src/helma/scripting/fesi/extensions/DomExtension.java +++ b/src/helma/scripting/fesi/extensions/DomExtension.java @@ -52,7 +52,7 @@ public class DomExtension extends Extension { } } - class XmlSave extends BuiltinFunctionObject { + class XmlSave extends BuiltinFunctionObject { XmlSave(String name, Evaluator evaluator, FunctionPrototype fp) { super(fp, evaluator, name, 1); } @@ -69,6 +69,7 @@ public class DomExtension extends Extension { try { File tmpFile = new File(arguments[0].toString()+".tmp."+XmlWriter.generateID()); XmlWriter writer = new XmlWriter (tmpFile); + writer.setDatabaseMode(false); boolean result = writer.write(node); writer.close(); File finalFile = new File(arguments[0].toString()); @@ -81,6 +82,10 @@ public class DomExtension extends Extension { } } + /** + * Xml.create() is used to get a string containing the xml-content. + * Useful if Xml-content should be made public through the web. + */ class XmlCreate extends BuiltinFunctionObject { XmlCreate(String name, Evaluator evaluator, FunctionPrototype fp) { super(fp, evaluator, name, 1); @@ -98,6 +103,7 @@ public class DomExtension extends Extension { try { ByteArrayOutputStream out = new ByteArrayOutputStream(); XmlWriter writer = new XmlWriter (out); + writer.setDatabaseMode(false); boolean result = writer.write(node); writer.flush(); return new ESString (out.toString()); @@ -123,7 +129,7 @@ public class DomExtension extends Extension { } try { XmlReader reader = new XmlReader (); - INode result = reader.read (arguments[0].toString(),node); + INode result = reader.read (new File(arguments[0].toString()),node); return this.evaluator.reval.getNodeWrapper (result); } catch ( NoClassDefFoundError e ) { throw new EcmaScriptException ("Can't load dom-capable xml parser.");