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

Tue, 25 Nov 2008 16:50:10 GMT.

### core framework

- global
- app (application)
- req (request)
- res (response)
- session
- path
- root
- HopObject
- User
- File
- FtpClient
- Image
- Mail
- Remote
- Xml
- DatabaseObject
- MimePart
- Skin
- Object

### optional modules

- Array extensions
- Date extensions
- Number extensions
- Object extensions
- String extensions
- HopObject extensions
- global macros
- macro filters
- JSON methods
- helma.Aspects
- helma.Chart
- helma.Color
- helma.Database
- helma.File
- helma.Ftp
- helma.Group
- helma.Html
- helma.Http
- helma.Image
- helma.Mail
- helma.Search
- helma.Skin
- helma.Ssh
- helma.Url
- helma.Zip
- jala.BitTorrent
- jala.Captcha
- jala.Date
- jala.db
- jala.DnsClient
- jala.Form
- jala.History
- jala HopObject extensions
- jala.HtmlDocument
- jala.I18n
- jala.ImageFilter
- jala.IndexManager
- jala.ListRenderer
- jala.Mp3
- jala.PodcastWriter
- jala.RemoteContent
- jala.Rss20Writer
- jala.Utilities
- jala.XmlRpcRequest
- jala.XmlWriter

### java libraries

- browse docjar