March 2, 2010

Fast Apex XML DOM TODO’s

Though Apex Dom class wrappers like TG_XmlDOM and TG_XMLNode are almost complete. But still there are some todo’s most of them are for developer ease and rest are some pending API additions.

  • Give cool apex docs with rich samples for each API, for now Apex test cases is best place to refer API usage.  It includes
    • Add HTTP API samples with TG_XmlDom and TG_XMLNode.
    • Add API samples for common protocols like GDATA.
  • Include COST factor against each API exposed so that developers are aware which operation should be cached locally for saving script statements.
  • Implement and add testMethods for each of the following, As spring 10 API doesn't have direct methods for doing so many of the following methods might involve recursions etc to clone, compare and append/replace/insert child
    • appendChild()     Adds a new child node to the end of the list of children of a node
    • cloneNode()      Clones a node
    • getElementsByTagNameNS() Returns element for node’s local name and namespace
    • compareDocumentPosition()  Compares the document position of two nodes
    • insertBefore()     Inserts a new child node before an existing child node
    • isEqualNode()     Checks if two nodes are equal
    • isSameNode()     Checks if two nodes are the same node
    • replaceChild()     Replaces a child node