Merged Stefan Pollach's XML Database branch.
This commit is contained in:
parent
4fdf0b97d9
commit
459bf13822
1 changed files with 8 additions and 2 deletions
|
@ -69,6 +69,7 @@ public class DomExtension extends Extension {
|
||||||
try {
|
try {
|
||||||
File tmpFile = new File(arguments[0].toString()+".tmp."+XmlWriter.generateID());
|
File tmpFile = new File(arguments[0].toString()+".tmp."+XmlWriter.generateID());
|
||||||
XmlWriter writer = new XmlWriter (tmpFile);
|
XmlWriter writer = new XmlWriter (tmpFile);
|
||||||
|
writer.setDatabaseMode(false);
|
||||||
boolean result = writer.write(node);
|
boolean result = writer.write(node);
|
||||||
writer.close();
|
writer.close();
|
||||||
File finalFile = new File(arguments[0].toString());
|
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 {
|
class XmlCreate extends BuiltinFunctionObject {
|
||||||
XmlCreate(String name, Evaluator evaluator, FunctionPrototype fp) {
|
XmlCreate(String name, Evaluator evaluator, FunctionPrototype fp) {
|
||||||
super(fp, evaluator, name, 1);
|
super(fp, evaluator, name, 1);
|
||||||
|
@ -98,6 +103,7 @@ public class DomExtension extends Extension {
|
||||||
try {
|
try {
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
XmlWriter writer = new XmlWriter (out);
|
XmlWriter writer = new XmlWriter (out);
|
||||||
|
writer.setDatabaseMode(false);
|
||||||
boolean result = writer.write(node);
|
boolean result = writer.write(node);
|
||||||
writer.flush();
|
writer.flush();
|
||||||
return new ESString (out.toString());
|
return new ESString (out.toString());
|
||||||
|
@ -123,7 +129,7 @@ public class DomExtension extends Extension {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
XmlReader reader = new XmlReader ();
|
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);
|
return this.evaluator.reval.getNodeWrapper (result);
|
||||||
} catch ( NoClassDefFoundError e ) {
|
} catch ( NoClassDefFoundError e ) {
|
||||||
throw new EcmaScriptException ("Can't load dom-capable xml parser.");
|
throw new EcmaScriptException ("Can't load dom-capable xml parser.");
|
||||||
|
|
Loading…
Add table
Reference in a new issue