Detailed reference of prototypes, properties and methods available in the
Javascript environment of your Helma web applications.

Default properties and methods of the Xml object.
Methods
Xml. get(urlString)
Retrieves an XML document from a given URL and transforms it into a HopObject.

Syntax:
Xml.get(urlString)
Xml.get(urlString, filenameString)


The optional argument filenameString refers to a file containing a set of transformation rules how the XML data should be turned into a HopObject. Please take a look at the RFC for details.

Example:
var obj = Xml.get("http://localhost:8080/antville/rss10");
for (var i in obj)
  res.writeln(i + ": " + obj[i]);
 
xmlns_sy: http://purl.org/rss/1.0/modules/syndication/
xmlns_dc: http://purl.org/dc/elements/1.1/
item: HopObject item
channel: HopObject channel
xmlns: http://purl.org/rss/1.0/
xmlns_rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
parameters
String urlString as String, containing the URL to fetch the XML from
returns
HopObject
Xml. getFromString(xmlString)
Parses the string argument as XML and transforms it into a HopObject.

Syntax:
Xml.getFromString(xmlString)
Xml.getFromString(xmlString, filenameString)


The optional argument filenameString refers to a file containing a set of transformation rules how the XML data should be turned into a HopObject. Please take a look at the RFC for details.

Example:
var obj = Xml.getFromString("<a>hello <b>world</b></a>");
for (var i in obj)
  res.writeln(i + ": " + obj[i]);
 
b: HopObject b
text: hello
parameters
String xmlString as String in XML format
returns
HopObject
Xml. read(String)
Reads an XML tree from file and transforms it into a HopObject.

Syntax:
Xml.read(filenameString)
Xml.read(filenameString, HopObject)


If an optional HopObject is specified, the HopObject derived from the XML tree will be added to it.

Example:
var obj = Xml.read("/tmp/dump.xml");
res.write(obj);
HopObject message
parameters
String
returns
HopObject
Xml. readFromString(String)
Reads an XML tree from a string and transforms it into a HopObject.

Syntax:
Xml.readFromString(String)
Xml.readFromString(String, HopObject)


If an optional HopObject is specified, the HopObject derived from the XML tree will be added to it.

Example:
var f = new File("/tmp/dump.xml");
var obj = Xml.readFromString(f.readAll());
res.write(obj);
HopObject message
parameters
String
returns
HopObject
Xml. write(HopObject)
Dumps a HopObject as XML tree to a file.

Syntax:
Xml.write(HopObject, filenameString)


Example:
var obj = new message();
obj.title = "The Message";
obj.text = "Don't push me 'cause I'm close to the edge.";
root.add(obj);
Xml.write(obj, "/tmp/dump.xml");
 
File /tmp/dump.xml: 
 
<?xml version="1.0"?>
<!-- printed by helma object publisher     -->
<!-- created Fri Jul 12 17:25:24 CEST 2002 -->
<xmlroot xmlns:hop="http://www.helma.org/docs/
guide/features/database">
  <hopobject id="8" name="message" prototype="message" 
created="1026487524440" lastModified="1026487524440">
  <hop:parent idref="0" prototyperef="root"/>
    <title>The Message</title>
    <text>Don't push me 'cause I'm close 
to the edge.</text>
  </hopobject>
</xmlroot><
parameters
HopObject and file name as string
Xml. writeToString(HopObject)
Stores a HopObject as XML tree in a string.

Syntax:
Xml.writeToString(HopObject)


Example:
var str = Xml.writeToString(this.get(0));
res.write(str);
 
<?xml version="1.0"?>
<!-- printed by helma object publisher     -->
<!-- created Fri Jul 12 17:25:24 CEST 2002 -->
<xmlroot xmlns:hop="http://www.helma.org/docs/
guide/features/database">
  <hopobject id="8" name="message" prototype="message" 
created="1026487524440" lastModified="1026487524440">
  <hop:parent idref="0" prototyperef="root"/>
    <title>The Message</title>
    <text>Don't push me 'cause I'm close 
to the edge.</text>
  </hopobject>
</xmlroot>
parameters
HopObject
returns
String in XML encoded
Fri, 05 Feb 2010 17:40:05 GMT.

core framework

optional modules

java libraries

properties files