Results 1 to 3 of 3

Thread: new functions for AjxXmlDoc

  1. #1
    Heladito is offline Project Contributor
    Join Date
    Oct 2005
    Location
    Switzerland
    Posts
    54
    Rep Power
    9

    Default new functions for AjxXmlDoc

    Comparing AjxXmlDoc and AjxSoapDoc, I have added 3 functions to AjxXmlDoc that I beleive could come in handy for people wanting to handle simple xml documents with the AjxXmlDoc class:

    Code:
    AjxXmlDoc.prototype.set =
    function(name, value, element) {
       var p = this._doc.createElement(name);
          if (value != null) {
             var cdata = this._doc.createTextNode("");
             p.appendChild(cdata);
             cdata.nodeValue = value;
          }
          if (element == null) {
             this.root.appendChild(p);
          } else {
             element.appendChild(p);
          }
       return p;
    }
    
    AjxXmlDoc.prototype.getDocXml =
    function() {
       if (AjxEnv.isSafari)
          return AjxXmlDoc.getXml(this.getDoc());
       else
          return this.getDoc().xml;
    }
    
    AjxXmlDoc.createRoot =
    function(rootName) {
       var xmldoc = AjxXmlDoc.create();
       var d = xmldoc.getDoc();
       xmldoc.root = d.createElement(rootName);
    
       d.appendChild(xmldoc.root);
       return xmldoc;
    }
    Below is an example of how to use this code:
    Code:
       var xmlDoc = AjxXmlDoc.createRoot("GetMenuItems");
       xmlDoc.set("pageID", "4");
       xmlDoc.set("type", "content_container");
       xmlDoc.set("parentID", "1");
    The above code produces the following document:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <GetMenuItems>
       <pageID>4</pageID>
       <type>content_container</type>
       <parentID>1</parentID>
    </GetMenuItems>
    Would you be willing to integrate this extra code in the next release ?

    Heladito

  2. #2
    KevinH's Avatar
    KevinH is offline Expert Member
    Join Date
    Aug 2005
    Location
    San Mateo, CA
    Posts
    4,789
    Rep Power
    18

    Default

    Yes I think that is general enough. However for contributions you need to sign our contrib agreement and fax a copy in before we can take code. Just a step we need to take to keep our IP clean and protect the lisense. This is pretty simple, and you can get the form here:

    http://www.zimbra.com/license/contri...agreement.html

    Once you do this you'll get a nice little logo on your Forum username and if you'd like I'll send you some Zimbra wear (hat, shirt, or something) after your first significant contribution.

  3. #3
    Heladito is offline Project Contributor
    Join Date
    Oct 2005
    Location
    Switzerland
    Posts
    54
    Rep Power
    9

    Default

    No problems. I have just sent the fax with the agreement.

    Come back to me if you need anything more.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Server behind proxy having odd results for some functions
    By swallac2 in forum Administrators
    Replies: 9
    Last Post: 12-11-2009, 07:00 AM
  2. CRM functions
    By JustinHarlow in forum Users
    Replies: 1
    Last Post: 06-14-2007, 11:06 PM
  3. delegating administrative functions.
    By dray in forum Developers
    Replies: 5
    Last Post: 03-02-2006, 03:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •