+ cb( '<flexy:include src="'+currentElement.getAttribute('flexy:include')+'"></flexy:include>');
+ return;
+ }
+
+ var i = 0;
+ // Prints the node tagName, such as <A>, <IMG>, etc
+ if (tagName) {
+ var attr = [];
+ for(i = 0; i < currentElement.attributes.length;i++) {
+ var attre = currentElement.attributes.item(i);
+ var aname = attre.name;
+ var aval = attre.value || '';
+ if (aname=='id' && aval.match(/^roo\-/)) { // only roo -elements hide..
+ aname= 'xbuilderid';
+ }
+ // skip -- component created by the builder?
+ if (aval == 'builderel') {
+ return;
+ }
+ attr.push(aname + '="' + aval + '"' ); //?? escaping attributes?
+ }
+
+
+ cb("<"+currentElement.tagName+ ( attr.length ? (' ' + attr.join(' ') ) : '') + ">");
+ }
+ else {
+ cb("[unknown tag]");
+ }
+ } else {
+ tagName = false;
+ }
+
+
+ // Traverse the tree
+ i = 0;
+ var currentElementChild = currentElement.childNodes.item(i);
+ var allText = true;
+ while (currentElementChild) {
+ // Formatting code (indent the tree so it looks nice on the screen)
+
+ if (currentElementChild.nodeName == '#text') {
+ cb(currentElementChild.nodeValue);
+ i++;
+ currentElementChild=currentElement.childNodes.item(i);
+ continue;
+ }
+ allText = false;
+ cb("\n");
+ for (j = 0; j < depth; j++) {
+ // ¦ is just a vertical line
+ cb(" ");
+ }
+
+
+ // Recursively traverse the tree structure of the child node
+ this.traverseDOMTree(cb, currentElementChild, depth+1);
+ i++;
+ currentElementChild=currentElement.childNodes.item(i);
+ }
+ if (!allText) {
+ // The remaining code is mostly for formatting the tree
+ cb("\n");
+ for (j = 0; j < depth - 1; j++) {
+ cb(" ");
+ }
+ }
+ if (tagName) {
+ cb("</"+tagName+">");
+ }
+
+ },