DHTMLX Docs & Samples Explorer

Serialization, Caching and Removing Tree

Serializing Tree

The user can get an XML representation (as a string) of the tree using method serializeTree():


Also there is the possibility to return the tree as a JSON string like this:


Setting Serialization Level

XML serialization can be easily configured in the following way:


The parameters are as follows:

  • userData - enable/disable user data serialization;
  • fullXML - enable/disable full XML serialization;
  • escapeEntities - convert tag brackets to related html entities;
  • userDataAsCData - output user data in CDATA sections;
  • DTD - if specified, then set as XML's DTD.

Preventing Caching in IE

The user can prevent caching in IE by adding random value to URL string with the help of method preventIECaching():

        tree.preventIECaching(true|false); // false by default

Registering XML Entity

There is the possibility in dhtmlxTree to register an XML entity for replacement of special symbols while initialization of the tree (default ones are: ampersand, “less then” and “greater then” symbols):


The parameters are the following:

  • rChar - source char;
  • rEntity - target entity.

Removing Tree

There is a simple method that allows the user to remove the tree completely and to clear memory: