added toString() method to Xml object:

res.write(Xml) now renders the name of the package used as XML-parser
This commit is contained in:
stefanp 2003-03-14 15:44:40 +00:00
parent 4358af3f20
commit 0e333e8c73

View file

@ -53,8 +53,18 @@ public class DomExtension extends Extension {
public ESObject doConstruct(ESObject thisObject, ESValue[] arguments) throws EcmaScriptException { public ESObject doConstruct(ESObject thisObject, ESValue[] arguments) throws EcmaScriptException {
throw new EcmaScriptException("Xml can't be instanced"); throw new EcmaScriptException("Xml can't be instanced");
} }
public String toString() {
try {
String parser = javax.xml.parsers.DocumentBuilderFactory.newInstance().getClass ().getPackage ().getName();
return "[Xml " + parser + "]";
} catch (NullPointerException zeero) {
return "[Xml - no parser available]";
}
}
} }
class XmlWrite extends BuiltinFunctionObject { class XmlWrite extends BuiltinFunctionObject {
XmlWrite(String name, Evaluator evaluator, FunctionPrototype fp) { XmlWrite(String name, Evaluator evaluator, FunctionPrototype fp) {
super(fp, evaluator, name, 1); super(fp, evaluator, name, 1);