Overview of xml.inc

Public Function Summary

Public functions are intended to be called by the code that imports this library.

Name Summary
xml_close_comment
xml_close_tag
xml_escape
xml_newline
xml_open_comment
xml_open_tag
xml_tagline

Public Function Details

xml_close_comment

Named Parameters

Code

function xml_close_comment() {
    return '-->';
}

function xml_newline() {

		
top

xml_close_tag

Named Parameters

tag

Code

function xml_close_tag(tag) {
    return '</' + tag + '>';
}

function xml_tagline(tag, attributes, value) {

		
top

xml_escape

Named Parameters

Code

function xml_escape() {
  local_var escape_table, str, str_escaped, i;

  escape_table = make_array(
                      "&", "&amp;",
                      "'", "&apos;",
                      '"', "&quot;",
                      "<", "&lt;",
                      ">", "&gt;");

  str_escaped = "";

  str = _FCT_ANON_ARGS[0];
  max_idx = strlen(str);

  for (i = 0; i < max_idx; i++) {
    if (!isnull(escape_table[str[i]]))
      str_escaped += escape_table[str[i]];
    else
      str_escaped += str[i];
  }
  return str_escaped;
}



		
top

xml_newline

Named Parameters

Code

function xml_newline() {
    return '\n';
}

function xml_escape() {

		
top

xml_open_comment

Named Parameters

Code

function xml_open_comment() {
    return '<!--';
}

function xml_close_comment() {

		
top

xml_open_tag

Named Parameters

attributes
tag

Code

function xml_open_tag(tag, attributes) {
    res = '';

    res += '<' + tag;
    
    if (!isnull(attributes)) {
        foreach attr (keys(attributes)) {
            res += ' ' + attr + '="' + xml_escape(attributes[attr]) + '"';
        }
    }
    res += '>';

    return res;
}

function xml_close_tag(tag) {

		
top

xml_tagline

Named Parameters

attributes
tag
value

Code

function xml_tagline(tag, attributes, value) {
    return xml_open_tag(tag:tag, attributes:attributes) + xml_escape(value) + xml_close_tag(tag);
}

function xml_open_comment() {

		
top