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:
parent
4358af3f20
commit
0e333e8c73
1 changed files with 10 additions and 0 deletions
|
@ -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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue