gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ./ChangeLog server/xml.h server/xml.cpp t...


From: Rob Savoye
Subject: [Gnash-commit] gnash ./ChangeLog server/xml.h server/xml.cpp t...
Date: Sun, 05 Feb 2006 18:06:28 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Branch:         
Changes by:     Rob Savoye <address@hidden>     06/02/05 18:06:28

Modified files:
        .              : ChangeLog 
        server         : xml.h xml.cpp 
Added files:
        testsuite/actionscript.all: XML.as 

Log message:
        * server/xml.h: Add stubs for the missing methods and
        properties. Fix bit rot with get_member() so it actually works
        again.
        * server/xml.cpp:  Add stubs for the missing methods and
        properties.
        * testsuite/actionscript.all/XML.as: New file to test XML class.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/ChangeLog.diff?tr1=1.93&tr2=1.94&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/testsuite/actionscript.all/XML.as?rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/xml.h.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/gnash/gnash/server/xml.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: gnash/ChangeLog
diff -u gnash/ChangeLog:1.93 gnash/ChangeLog:1.94
--- gnash/ChangeLog:1.93        Sun Feb  5 16:55:21 2006
+++ gnash/ChangeLog     Sun Feb  5 18:06:28 2006
@@ -1,3 +1,12 @@
+2006-02-05  Rob Savoye  <address@hidden>
+
+       * server/xml.h: Add stubs for the missing methods and
+       properties. Fix bit rot with get_member() so it actually works
+       again.
+       * server/xml.cpp:  Add stubs for the missing methods and
+       properties.
+       * testsuite/actionscript.all/XML.as: New file to test XML class.
+
 2006-02-05 Sandro Santilli <address@hidden>
 
        * server/action.cpp: added support for Object copy construction
@@ -47,7 +56,7 @@
        network.cpp. Setup callbacks for our custom methods using the
        Network, instead of NetConnection class.
 
-       * Makefile.am: Rearrange variable definitions so the diit and
+       * Makefile.am: Rearrange variable definitions so the dist and
        distcheck Makefile targets actually work. Add DIST directories so
        everything makes it into the tarball.
        * doc/C/Makefile.am: Define XML_FILES for all the other xml doc
Index: gnash/server/xml.cpp
diff -u gnash/server/xml.cpp:1.3 gnash/server/xml.cpp:1.4
--- gnash/server/xml.cpp:1.3    Sat Jan 28 01:14:33 2006
+++ gnash/server/xml.cpp        Sun Feb  5 18:06:28 2006
@@ -40,91 +40,91 @@
 
 namespace gnash {
   
-  //#define DEBUG_MEMORY_ALLOCATION 1
+//#define DEBUG_MEMORY_ALLOCATION 1
   
-array<as_object *> _xmlobjs;    // FIXME: hack alert
+//array<as_object *> _xmlobjs;    // FIXME: hack alert
 
 XMLAttr::XMLAttr()
 {
 #ifdef DEBUG_MEMORY_ALLOCATION
-  log_msg("\t\tCreating XMLAttr data at %p \n", this);
+    log_msg("\t\tCreating XMLAttr data at %p \n", this);
 #endif
-  _name = 0;
-  _value = 0;
+    _name = 0;
+    _value = 0;
 }
 
 XMLAttr::~XMLAttr()
 {
 #ifdef DEBUG_MEMORY_ALLOCATION
-  log_msg("\t\tDeleting XMLAttr data %s at %p \n", this->_name, this);
+    log_msg("\t\tDeleting XMLAttr data %s at %p \n", this->_name, this);
 #endif
-  //log_msg("%s: %p \n", __FUNCTION__, this);
-  if (_name) {
-    delete _name;
-  }
-  if (_value) {
-    delete _value;
-  }  
+    //log_msg("%s: %p \n", __FUNCTION__, this);
+    if (_name) {
+        delete _name;
+    }
+    if (_value) {
+        delete _value;
+    }  
 }
   
 XMLNode::XMLNode()
 {
-  //log_msg("%s: %p \n", __FUNCTION__, this);
+    //log_msg("%s: %p \n", __FUNCTION__, this);
 #ifdef DEBUG_MEMORY_ALLOCATION
-  log_msg("\tCreating XMLNode data at %p \n", this);
+    log_msg("\tCreating XMLNode data at %p \n", this);
 #endif
-  _name = 0;
-  _value = 0;
+    _name = 0;
+    _value = 0;
 }
 
 XMLNode::~XMLNode()
 {
-  int i;
-  //log_msg("%s: %p \n", __FUNCTION__, this);
+    int i;
+    //log_msg("%s: %p \n", __FUNCTION__, this);
 #ifdef DEBUG_MEMORY_ALLOCATION
-  log_msg("\tDeleting XMLNode data %s at %p\n", this->_name, this);
+    log_msg("\tDeleting XMLNode data %s at %p\n", this->_name, this);
 #endif
   
-  for (i=0; i<_children.size(); i++) {
+    for (i=0; i<_children.size(); i++) {
 //     if (_children[i]->_name) {
 //       delete _children[i]->_name;
 //     }
 //     if (_children[i]->_value) {
 //       delete _children[i]->_value;
 //     }
-    delete _children[i];
-  }
+        delete _children[i];
+    }
 
-  for (i=0; i<_attributes.size(); i++) {
-    //     if (_attributes[i]->_name) {
+    for (i=0; i<_attributes.size(); i++) {
+        //     if (_attributes[i]->_name) {
 //       delete _attributes[i]->_name;
 //     }
 //     if (_attributes[i]->_value) {
 //       delete _attributes[i]->_value;
 //     }
-    delete _attributes[i];
-  }
+        delete _attributes[i];
+    }
 
-  _children.clear();
-  _attributes.clear();
+    _children.clear();
+    _attributes.clear();
 
-  if (_name) {
-    delete _name;
-  }
-  if (_value) {
-    delete _value;
-  }
-  //  _value.set_undefined();
+    if (_name) {
+        delete _name;
+    }
+    if (_value) {
+        delete _value;
+    }
+    //  _value.set_undefined();
 }
 
 XML::XML()
 {
 #ifdef DEBUG_MEMORY_ALLOCATION
-  log_msg("Creating XML data at %p \n", this);
+    log_msg("Creating XML data at %p \n", this);
 #endif
-  //log_msg("%s: %p \n", __FUNCTION__, this);
-  _loaded = false;
-  _nodename = 0;
+    //log_msg("%s: %p \n", __FUNCTION__, this);
+    _loaded = false;
+    _nodename = 0;
 }
 
 
@@ -132,189 +132,182 @@
 XML::XML(tu_string xml_in)
 {
 #ifdef DEBUG_MEMORY_ALLOCATION
-  log_msg("Creating XML data at %p \n", this);
+    log_msg("Creating XML data at %p \n", this);
 #endif
-  //log_msg("%s: %p \n", __FUNCTION__, this);
-  //memset(&_nodes, 0, sizeof(XMLNode));
-  parseXML(xml_in);
+    //log_msg("%s: %p \n", __FUNCTION__, this);
+    //memset(&_nodes, 0, sizeof(XMLNode));
+    parseXML(xml_in);
 }
 
 XML::XML(struct node *childNode)
 {
 #ifdef DEBUG_MEMORY_ALLOCATION
-  log_msg("\tCreating XML data at %p \n", this);
+    log_msg("\tCreating XML data at %p \n", this);
 #endif
-  //log_msg("%s: %p \n", __FUNCTION__, this);
+    //log_msg("%s: %p \n", __FUNCTION__, this);
 }
 
 
 XML::~XML()
 {
 #ifdef DEBUG_MEMORY_ALLOCATION
-  if (this->_nodes) {
-    log_msg("\tDeleting XML top level node %s at %p \n", this->_nodes->_name, 
this);
-  } else {
-    log_msg("\tDeleting XML top level node at %p \n", this);
-  }
+    if (this->_nodes) {
+        log_msg("\tDeleting XML top level node %s at %p \n", 
this->_nodes->_name, this);
+    } else {
+        log_msg("\tDeleting XML top level node at %p \n", this);
+    }
 #endif
   
-  //log_msg("%s: %p \n", __FUNCTION__, this);
-  delete _nodes;
+    //log_msg("%s: %p \n", __FUNCTION__, this);
+    delete _nodes;
 }
 
 // Dispatch event handler(s), if any.
 bool
 XML::on_event(event_id id)
 {
-  // Keep m_as_environment alive during any method calls!
-  //  smart_ptr<as_object_interface>   this_ptr(this);
+    // Keep m_as_environment alive during any method calls!
+    //  smart_ptr<as_object_interface> this_ptr(this);
   
 #if 0
-  // First, check for built-in event handler.
-  as_value     method;
-  if (get_event_handler(event_id(id), &method))
-    {/
-      // Dispatch.
-      call_method0(method, &m_as_environment, this);
-          return true;
-    }
-  
-  // Check for member function.
-  // In ActionScript 2.0, event method names are CASE SENSITIVE.
-  // In ActionScript 1.0, event method names are CASE INSENSITIVE.
-  const tu_string&     method_name = id.get_function_name();
-  if (method_name.length() > 0)hostByNameGet
-    {
-      as_value method;
-      if (get_member(method_name, &method))
-        {
-          call_method0(method, &m_as_environment, this);
-          return true;
+    // First, check for built-in event handler.
+    as_value   method;
+    if (get_event_handler(event_id(id), &method)) {
+        call_method0(method, &m_as_environment, this);
+        return true;
+    }
+  
+    // Check for member function.
+    // In ActionScript 2.0, event method names are CASE SENSITIVE.
+    // In ActionScript 1.0, event method names are CASE INSENSITIVE.
+    const tu_string&   method_name = id.get_function_name();
+    if (method_name.length() > 0) {
+        as_value       method;
+        if (get_member(method_name, &method)) {
+            call_method0(method, &m_as_environment, this);
+            return true;
         }
     }
 #endif
-  return false;
+    return false;
 }
 
 void
 XML::on_event_load()
 {
-  // Do the events that (appear to) happen as the movie
-  // loads.  frame1 tags and actions are executed (even
-  // before advance() is called).  Then the onLoad event
-  // is triggered.
-  {
+    // Do the events that (appear to) happen as the movie
+    // loads.  frame1 tags and actions are executed (even
+    // before advance() is called).  Then the onLoad event
+    // is triggered.
     on_event(event_id::LOAD);
-  }
 }
 
 XMLNode*
 XML::extractNode(xmlNodePtr node, bool mem)
 {
-  xmlAttrPtr attr;
-  xmlNodePtr childnode;
-  xmlChar *ptr = NULL;
-  XMLNode *element, *child;
-  int len;
+    xmlAttrPtr attr;
+    xmlNodePtr childnode;
+    xmlChar *ptr = NULL;
+    XMLNode *element, *child;
+    int len;
 
-  element = new XMLNode;
+    element = new XMLNode;
             
-  //log_msg("Created new element for %s at %p\n", node->name, element);
-  memset(element, 0, sizeof (XMLNode));
+    //log_msg("Created new element for %s at %p\n", node->name, element);
+    memset(element, 0, sizeof (XMLNode));
 
-  //log_msg("%s: extracting node %s\n", __FUNCTION__, node->name);
+    //log_msg("%s: extracting node %s\n", __FUNCTION__, node->name);
 
-  // See if we have any Attributes (properties)
-  attr = node->properties;
-  while (attr != NULL) {
-    //log_msg("extractNode %s has property %s, value is %s\n",
-    //          node->name, attr->name, attr->children->content);
-    XMLAttr *attrib = new XMLAttr;
-    len = memadjust(strlen(reinterpret_cast<const char *>(attr->name))+1);
-    attrib->_name = (char *)new char[len];
-    memset(attrib->_name, 0, len);
-    strcpy(attrib->_name, reinterpret_cast<const char *>(attr->name));
-    len = memadjust(strlen(reinterpret_cast<const char 
*>(attr->children->content))+1);
-    attrib->_value = (char *)new char[len];
-    memset(attrib->_value, 0, len);
-    strcpy(attrib->_value, reinterpret_cast<const char 
*>(attr->children->content));
-    //log_msg("\tPushing attribute %s for element %s has value %s\n",
-    //        attr->name, node->name, attr->children->content);
-    element->_attributes.push_back(attrib);
-    attr = attr->next;
-  }
-
-  len = memadjust(strlen(reinterpret_cast<const char *>(node->name))+1);
-  element->_name = (char *)new char[len];
-  memset(element->_name, 0, len);
-  strcpy(element->_name, reinterpret_cast<const char *>(node->name));
-  //element->_name = reinterpret_cast<const char *>(node->name);
-  if (node->children) {
-    //ptr = node->children->content;
-    ptr = xmlNodeGetContent(node->children);
-    if (ptr != NULL) {
-      if ((strchr((const char *)ptr, '\n') == 0) && (ptr[0] != 0))
-      {
-        if (node->children->content == NULL) {
-          //log_msg("Node %s has no contents\n", node->name);
-        } else {
-          //log_msg("extractChildNode from text for %s has contents %s\n", 
node->name, ptr);
-          len = memadjust(strlen(reinterpret_cast<const char *>(ptr))+1);
-          element->_value = (char *)new char[len];
-          memset(element->_value, 0, len);
-          strcpy(element->_value, reinterpret_cast<const char *>(ptr));
-          //element->_value = reinterpret_cast<const char *>(ptr);
-        }
-      }
-      xmlFree(ptr);
-    }
-  }
-
-  // See if we have any data (content)
-  childnode = node->children;
-
-  while (childnode != NULL) {
-    if (childnode->type == XML_ELEMENT_NODE) {
-      //log_msg("\t\t extracting node %s\n", childnode->name);
-      child = extractNode(childnode, mem);
-      //if (child->_value.get_type() != as_value::UNDEFINED) {
-      if (child->_value != 0) {
-        //log_msg("\tPushing childNode %s, value %s on element %p\n", 
child->_name.c_str(), child->_value.to_string(), element);
-      } else {
-        //log_msg("\tPushing childNode %s on element %p\n", 
child->_name.c_str(), element);
-      }
-      element->_children.push_back(child);
+    // See if we have any Attributes (properties)
+    attr = node->properties;
+    while (attr != NULL) {
+        //log_msg("extractNode %s has property %s, value is %s\n",
+        //          node->name, attr->name, attr->children->content);
+        XMLAttr *attrib = new XMLAttr;
+        len = memadjust(strlen(reinterpret_cast<const char *>(attr->name))+1);
+        attrib->_name = (char *)new char[len];
+        memset(attrib->_name, 0, len);
+        strcpy(attrib->_name, reinterpret_cast<const char *>(attr->name));
+        len = memadjust(strlen(reinterpret_cast<const char 
*>(attr->children->content))+1);
+        attrib->_value = (char *)new char[len];
+        memset(attrib->_value, 0, len);
+        strcpy(attrib->_value, reinterpret_cast<const char 
*>(attr->children->content));
+        //log_msg("\tPushing attribute %s for element %s has value %s\n",
+        //        attr->name, node->name, attr->children->content);
+        element->_attributes.push_back(attrib);
+        attr = attr->next;
+    }
+
+    len = memadjust(strlen(reinterpret_cast<const char *>(node->name))+1);
+    element->_name = (char *)new char[len];
+    memset(element->_name, 0, len);
+    strcpy(element->_name, reinterpret_cast<const char *>(node->name));
+    //element->_name = reinterpret_cast<const char *>(node->name);
+    if (node->children) {
+        //ptr = node->children->content;
+        ptr = xmlNodeGetContent(node->children);
+        if (ptr != NULL) {
+            if ((strchr((const char *)ptr, '\n') == 0) && (ptr[0] != 0)) {
+                if (node->children->content == NULL) {
+                    //log_msg("Node %s has no contents\n", node->name);
+                } else {
+                    //log_msg("extractChildNode from text for %s has contents 
%s\n", node->name, ptr);
+                    len = memadjust(strlen(reinterpret_cast<const char 
*>(ptr))+1);
+                    element->_value = (char *)new char[len];
+                    memset(element->_value, 0, len);
+                    strcpy(element->_value, reinterpret_cast<const char 
*>(ptr));
+                    //element->_value = reinterpret_cast<const char *>(ptr);
+                }
+            }
+            xmlFree(ptr);
+        }
     }
-    childnode = childnode->next;
-  }
+    
+    // See if we have any data (content)
+    childnode = node->children;
 
-  return element;
+    while (childnode != NULL) {
+        if (childnode->type == XML_ELEMENT_NODE) {
+            //log_msg("\t\t extracting node %s\n", childnode->name);
+            child = extractNode(childnode, mem);
+            //if (child->_value.get_type() != as_value::UNDEFINED) {
+            if (child->_value != 0) {
+                //log_msg("\tPushing childNode %s, value %s on element %p\n", 
child->_name.c_str(), child->_value.to_string(), element);
+            } else {
+                //log_msg("\tPushing childNode %s on element %p\n", 
child->_name.c_str(), element);
+            }
+            element->_children.push_back(child);
+        }
+        childnode = childnode->next;
+    }
+
+    return element;
 }
 
 // Read in an XML document from the specified source
 bool
 XML::parseDoc(xmlDocPtr document, bool mem)
 {
-  XMLNode *top;
-  xmlNodePtr cur;
+    XMLNode *top;
+    xmlNodePtr cur;
 
-  if (document == 0) {
-    log_error("Can't load XML file!\n");
-    return false;
-  }
+    if (document == 0) {
+        log_error("Can't load XML file!\n");
+        return false;
+    }
 
-  cur = xmlDocGetRootElement(document);
+    cur = xmlDocGetRootElement(document);
   
-  if (cur != NULL) {
-    top = extractNode(cur, mem);
-    //_nodes->_name = reinterpret_cast<const char *>(cur->name);
-    _nodes = top;
-    //_node_data.push_back(top);
-    //cur = cur->next;
-  }  
+    if (cur != NULL) {
+        top = extractNode(cur, mem);
+        //_nodes->_name = reinterpret_cast<const char *>(cur->name);
+        _nodes = top;
+        //_node_data.push_back(top);
+        //cur = cur->next;
+    }  
 
-  _loaded = true;
-  return true;
+    _loaded = true;
+    return true;
 }
 
 // This reads in an XML file from disk and parses into into a memory resident
@@ -322,59 +315,59 @@
 bool
 XML::parseXML(tu_string xml_in)
 {
-  bool ret = true;
-  //log_msg("Parse XML from memory: %s\n", xml_in.c_str());
+    bool ret = true;
+    //log_msg("Parse XML from memory: %s\n", xml_in.c_str());
 
-  if (xml_in.size() == 0) {
-    log_error("XML data is empty!\n");
-    return false;
-  }
+    if (xml_in.size() == 0) {
+        log_error("XML data is empty!\n");
+        return false;
+    }
 
 #ifndef USE_DMALLOC
-  //dump_memory_stats(__FUNCTION__, __LINE__, "before xmlParseMemory");
+    //dump_memory_stats(__FUNCTION__, __LINE__, "before xmlParseMemory");
 #endif
 
 #ifdef USE_XMLREADER
-  XMLNode *node = 0;
-  xmlTextReaderPtr reader;
+    XMLNode *node = 0;
+    xmlTextReaderPtr reader;
 
-  reader = xmlReaderForMemory(xml_in.c_str(), xml_in.size(), NULL, NULL, 0);
-  if (reader != NULL) {
-    ret = true;
-    while (ret) {
-      ret = xmlTextReaderRead(reader);
-      node = processNode(reader, node);
-    }
-    xmlFreeTextReader(reader);
-    if (ret != false) {
-      log_error("%s : couldn't parse\n", xml_in.c_str());
-      return false;
-    }
-  } else {
-    log_error("Unable to open %s\n", xml_in.c_str());
-      return false;
-  }
-  xmlCleanupParser();
-  return true;
+    reader = xmlReaderForMemory(xml_in.c_str(), xml_in.size(), NULL, NULL, 0);
+    if (reader != NULL) {
+        ret = true;
+        while (ret) {
+            ret = xmlTextReaderRead(reader);
+            node = processNode(reader, node);
+        }
+        xmlFreeTextReader(reader);
+        if (ret != false) {
+            log_error("%s : couldn't parse\n", xml_in.c_str());
+            return false;
+        }
+    } else {
+        log_error("Unable to open %s\n", xml_in.c_str());
+        return false;
+    }
+    xmlCleanupParser();
+    return true;
 #else
 #ifdef USE_DOM
-  xmlInitParser();
+    xmlInitParser();
   
-  _doc = xmlParseMemory(xml_in.c_str(), xml_in.size());
-  if (_doc == 0) {
-    log_error("Can't parse XML data!\n");
-    return false;
-  }
-  ret = parseDoc(_doc, true);
-  xmlCleanupParser();
-  xmlFreeDoc(_doc);
-  xmlMemoryDump();
+    _doc = xmlParseMemory(xml_in.c_str(), xml_in.size());
+    if (_doc == 0) {
+        log_error("Can't parse XML data!\n");
+        return false;
+    }
+    ret = parseDoc(_doc, true);
+    xmlCleanupParser();
+    xmlFreeDoc(_doc);
+    xmlMemoryDump();
 #endif
 #ifndef USE_DMALLOC
-  //dump_memory_stats(__FUNCTION__, __LINE__, "after xmlParseMemory");
+    //dump_memory_stats(__FUNCTION__, __LINE__, "after xmlParseMemory");
 #endif
 
-  return ret;
+    return ret;
 #endif
   
 }
@@ -396,12 +389,12 @@
 // processNode:
 // 2 14 #text 0
 const char *tabs[] = {
-  "",
-  "\t",
-  "\t\t",
-  "\t\t\t",
-  "\t\t\t",
-  "\t\t\t\t",
+    "",
+    "\t",
+    "\t\t",
+    "\t\t\t",
+    "\t\t\t",
+    "\t\t\t\t",
 };
 
 #ifdef USE_XMLREADER
@@ -410,105 +403,105 @@
 XMLNode*
 XML::processNode(xmlTextReaderPtr reader, XMLNode *node)
 {
-  //log_msg("%s: node is %p\n", __FUNCTION__, node);
-  static XMLNode *parent[10];
-  xmlChar *name, *value;
-  int   depth;
-  XMLNode *element;
-  //static int previous_depth = 0;
-  xmlReaderTypes type;
-
-  if (node == 0) {
-    memset(parent, 0, sizeof(XMLNode *));
-  }
-  type = (xmlReaderTypes)xmlTextReaderNodeType(reader);
-  depth = xmlTextReaderDepth(reader);
-  value = xmlTextReaderValue(reader);
-  name = xmlTextReaderName(reader);
+    //log_msg("%s: node is %p\n", __FUNCTION__, node);
+    static XMLNode *parent[10];
+    xmlChar *name, *value;
+    int   depth;
+    XMLNode *element;
+    //static int previous_depth = 0;
+    xmlReaderTypes type;
+
+    if (node == 0) {
+        memset(parent, 0, sizeof(XMLNode *));
+    }
+    type = (xmlReaderTypes)xmlTextReaderNodeType(reader);
+    depth = xmlTextReaderDepth(reader);
+    value = xmlTextReaderValue(reader);
+    name = xmlTextReaderName(reader);
   
-  if (name == NULL)
-    name = xmlStrdup(BAD_CAST "--");
+    if (name == NULL)
+        name = xmlStrdup(BAD_CAST "--");
 
 #if 0
-  printf("%d %d %s %d\n",
-         depth,
-         (int)type,
-         name,
-         xmlTextReaderIsEmptyElement(reader));  
+    printf("%d %d %s %d\n",
+           depth,
+           (int)type,
+           name,
+           xmlTextReaderIsEmptyElement(reader));  
 #endif
 
   
-  //child = node->_children[0];
-  switch(xmlTextReaderNodeType(reader)) {
-  case XML_READER_TYPE_NONE:
-    break;
-  case XML_READER_TYPE_SIGNIFICANT_WHITESPACE: // This is an empty text node
-    //log_msg("\tWhitespace at depth %d\n", depth);
-    break;
-  case XML_READER_TYPE_END_ELEMENT:
-     if (depth == 0) {          // This is the last node in the file
-       element = node;
-       break;
-     }
-     parent[depth]->_children.push_back(element);
+    //child = node->_children[0];
+    switch(xmlTextReaderNodeType(reader)) {
+      case XML_READER_TYPE_NONE:
+          break;
+      case XML_READER_TYPE_SIGNIFICANT_WHITESPACE: // This is an empty text 
node
+          //log_msg("\tWhitespace at depth %d\n", depth);
+          break;
+      case XML_READER_TYPE_END_ELEMENT:
+          if (depth == 0) {          // This is the last node in the file
+              element = node;
+              break;
+          }
+          parent[depth]->_children.push_back(element);
 //       log_msg("Pushing element %s on node %s\n", node->_name, 
parent[depth]->_name);
 //       log_msg("End element at depth %d is %s for parent %s %p\n", depth, 
name,
 //               parent[depth]->_name, parent[depth]);
-     element = parent[depth];
-    break;
-  case XML_READER_TYPE_ELEMENT:
-    element = new XMLNode;
+          element = parent[depth];
+          break;
+      case XML_READER_TYPE_ELEMENT:
+          element = new XMLNode;
 //      log_msg("%sElement at depth %d is %s for node at %p\n", tabs[depth], 
depth, name, element);
-    element->_name = (char *)new char[strlen(reinterpret_cast<const char 
*>(name))+1];
-    memset(element->_name, 0, strlen(reinterpret_cast<const char *>(name))+1);
-    strcpy(element->_name, reinterpret_cast<const char *>(name));
-    if (node == 0) {
-      _nodes = element;
-      parent[0] = element;
-    } else {
-      parent[depth] = node;
-      parent[depth+1] = node;
-    }
-    //  xmlTextReaderAttributeCount(reader);
-    if (xmlTextReaderHasAttributes(reader)) {
-      // log_msg("Has Attributes!\n");
-      xmlTextReaderMoveToFirstAttribute(reader);
-      processNode(reader, element);
-      while(xmlTextReaderMoveToNextAttribute(reader)) {
-        processNode(reader, element);
-      }
-    }
-    break;
-  case XML_READER_TYPE_TEXT:
-    element = node;
+          element->_name = (char *)new char[strlen(reinterpret_cast<const char 
*>(name))+1];
+          memset(element->_name, 0, strlen(reinterpret_cast<const char 
*>(name))+1);
+          strcpy(element->_name, reinterpret_cast<const char *>(name));
+          if (node == 0) {
+              _nodes = element;
+              parent[0] = element;
+          } else {
+              parent[depth] = node;
+              parent[depth+1] = node;
+          }
+          //  xmlTextReaderAttributeCount(reader);
+          if (xmlTextReaderHasAttributes(reader)) {
+              // log_msg("Has Attributes!\n");
+              xmlTextReaderMoveToFirstAttribute(reader);
+              processNode(reader, element);
+              while(xmlTextReaderMoveToNextAttribute(reader)) {
+                  processNode(reader, element);
+              }
+          }
+          break;
+      case XML_READER_TYPE_TEXT:
+          element = node;
 //      log_msg("%sValue at depth %d is \"%s\" for node at %p\n", tabs[depth], 
depth, value, element);
-    element->_value = (char *)new char[strlen(reinterpret_cast<const char 
*>(value))+1];
-    memset(element->_value, 0, strlen(reinterpret_cast<const char 
*>(value))+1);
-    strcpy(element->_value, reinterpret_cast<const char *>(value));
-    break;
-  case XML_READER_TYPE_ATTRIBUTE:
-    element = node;
-    XMLAttr *attrib = new XMLAttr;
-    attrib->_name = (char *)new char[strlen(reinterpret_cast<const char 
*>(name))+1];
-    memset(attrib->_name, 0, strlen(reinterpret_cast<const char *>(name))+1);
-    strcpy(attrib->_name, reinterpret_cast<const char *>(name));
-    attrib->_value = (char *)new char[strlen(reinterpret_cast<const char 
*>(value))+1];
-    memset(attrib->_value, 0, strlen(reinterpret_cast<const char *>(value))+1);
-    strcpy(attrib->_value, reinterpret_cast<const char *>(value));
+          element->_value = (char *)new char[strlen(reinterpret_cast<const 
char *>(value))+1];
+          memset(element->_value, 0, strlen(reinterpret_cast<const char 
*>(value))+1);
+          strcpy(element->_value, reinterpret_cast<const char *>(value));
+          break;
+      case XML_READER_TYPE_ATTRIBUTE:
+          element = node;
+          XMLAttr *attrib = new XMLAttr;
+          attrib->_name = (char *)new char[strlen(reinterpret_cast<const char 
*>(name))+1];
+          memset(attrib->_name, 0, strlen(reinterpret_cast<const char 
*>(name))+1);
+          strcpy(attrib->_name, reinterpret_cast<const char *>(name));
+          attrib->_value = (char *)new char[strlen(reinterpret_cast<const char 
*>(value))+1];
+          memset(attrib->_value, 0, strlen(reinterpret_cast<const char 
*>(value))+1);
+          strcpy(attrib->_value, reinterpret_cast<const char *>(value));
 //     log_msg("%sPushing attribute %s, value \"%s\" for node %s\n", 
tabs[depth], name, value, element->_name);
-    element->_attributes.push_back(attrib);
-    break;
-  default:   // FIXME: why does this break GCC 3.3.3 but not 3.4.3 ?
-    log_error("Unsupported XML type %d\n!", type);
-    break;
-  };
-
-  xmlFree(name);
-  if (value != NULL) {
-    xmlFree(value);
-  }
-  //previous_depth = depth;
-  return element;
+          element->_attributes.push_back(attrib);
+          break;
+      default:   // FIXME: why does this break GCC 3.3.3 but not 3.4.3 ?
+          log_error("Unsupported XML type %d\n!", type);
+          break;
+    };
+
+    xmlFree(name);
+    if (value != NULL) {
+        xmlFree(value);
+    }
+    //previous_depth = depth;
+    return element;
 }
 #endif
 
@@ -517,46 +510,46 @@
 bool
 XML::load(const char *filespec)
 {
-  bool ret = true;
-  log_msg("Load disk XML file: %s\n", filespec);
+    bool ret = true;
+    log_msg("Load disk XML file: %s\n", filespec);
   
-  //log_msg("%s: mem is %d\n", __FUNCTION__, mem);
+    //log_msg("%s: mem is %d\n", __FUNCTION__, mem);
 
 #ifdef USE_XMLREADER
-  XMLNode *node = 0;
-  xmlTextReaderPtr reader;  
+    XMLNode *node = 0;
+    xmlTextReaderPtr reader;  
   
-  reader = xmlNewTextReaderFilename(filespec);
-  if (reader != NULL) {
-    ret = true;
-    while (ret) {
-      ret = xmlTextReaderRead(reader);
-      node = processNode(reader, node);
-    }
-    xmlFreeTextReader(reader);
-    if (ret != false) {
-      log_error("%s : couldn't parse\n", filespec);
-      return false;
-    }
-  } else {
-    log_error("Unable to open %s\n", filespec);
-      return false;
-  }
-  xmlCleanupParser();
-  return true;
+    reader = xmlNewTextReaderFilename(filespec);
+    if (reader != NULL) {
+        ret = true;
+        while (ret) {
+            ret = xmlTextReaderRead(reader);
+            node = processNode(reader, node);
+        }
+        xmlFreeTextReader(reader);
+        if (ret != false) {
+            log_error("%s : couldn't parse\n", filespec);
+            return false;
+        }
+    } else {
+        log_error("Unable to open %s\n", filespec);
+        return false;
+    }
+    xmlCleanupParser();
+    return true;
 #else
 #ifdef USE_DOM
-  xmlInitParser();
-  _doc = xmlParseFile(filespec);
-  if (_doc == 0) {
-    log_error("Can't load XML file: %s!\n", filespec);
-    return false;
-  }
-  ret = parseDoc(_doc, false);
-  xmlCleanupParser();
-  xmlFreeDoc(_doc);
-  xmlMemoryDump();
-  return true;
+    xmlInitParser();
+    _doc = xmlParseFile(filespec);
+    if (_doc == 0) {
+        log_error("Can't load XML file: %s!\n", filespec);
+        return false;
+    }
+    ret = parseDoc(_doc, false);
+    xmlCleanupParser();
+    xmlFreeDoc(_doc);
+    xmlMemoryDump();
+    return true;
 #else
 #error "You have to enable either a DOM or an xmlReader XML parser"
 #endif
@@ -566,16 +559,16 @@
 bool
 XML::onLoad()
 {
-  log_msg("%s: FIXME: onLoad Default event handler\n", __FUNCTION__);
+    log_msg("%s: FIXME: onLoad Default event handler\n", __FUNCTION__);
 
-  return(_loaded);
+    return(_loaded);
 }
 
 XMLNode *
 XML::operator [] (int x) {
-  log_msg("%s:\n", __FUNCTION__);
+    log_msg("%s:\n", __FUNCTION__);
 
-  return _nodes->_children[x];
+    return _nodes->_children[x];
 }
 
 void
@@ -586,36 +579,36 @@
 as_object *
 XML::setupFrame(as_object *obj, XMLNode *xml, bool mem)
 {
-  int           child, i;
-  const char    *nodename;
-  //const char    *nodevalue;
-  //AS_value      nodevalue;
-  int           length;
-  as_value      inum;
-  XMLNode       *childnode;
-  xmlnode_as_object *xmlchildnode_obj;
-  xmlattr_as_object* attr_obj;
-
-  //log_msg("\t%s: processing node %s for object %p, mem is %d\n", 
__FUNCTION__, xml->_name, obj, mem);
-  
-  // Get the data for this node
-  nodename   = xml->_name;
-  //nodename   = xml->_name.c_str();
-  //nodevalue  = xml->_value;
-  length     = xml->length();
-
-  // Set these members in the top level object passed in. This are used
-  // primarily by the disk based XML parser, where at least in all my current
-  // test cases this is referenced with firstChild first, then nodeName and
-  // childNodes.
-  obj->set_member("nodeName",           nodename);
-  obj->set_member("length",             length);
-  if (xml->_value != 0) {
-    obj->set_member("nodeValue",        xml->_value);
-    //log_msg("\tnodevalue for %s is: %s\n", nodename, xml->_value);
-  } else {
-    obj->set_member("nodeValue", as_value::UNDEFINED);
-  }
+    int           child, i;
+    const char    *nodename;
+    //const char    *nodevalue;
+    //AS_value      nodevalue;
+    int           length;
+    as_value      inum;
+    XMLNode       *childnode;
+    xmlnode_as_object *xmlchildnode_obj;
+    xmlattr_as_object* attr_obj;
+
+    //log_msg("\t%s: processing node %s for object %p, mem is %d\n", 
__FUNCTION__, xml->_name, obj, mem);
+  
+    // Get the data for this node
+    nodename   = xml->_name;
+    //nodename   = xml->_name.c_str();
+    //nodevalue  = xml->_value;
+    length     = xml->length();
+
+    // Set these members in the top level object passed in. This are used
+    // primarily by the disk based XML parser, where at least in all my current
+    // test cases this is referenced with firstChild first, then nodeName and
+    // childNodes.
+    obj->set_member("nodeName",           nodename);
+    obj->set_member("length",             length);
+    if (xml->_value != 0) {
+        obj->set_member("nodeValue",        xml->_value);
+        //log_msg("\tnodevalue for %s is: %s\n", nodename, xml->_value);
+    } else {
+        obj->set_member("nodeValue", as_value::UNDEFINED);
+    }
 
 //   if (nodevalue.get_type() != as_value::UNDEFINED) {
 //     obj->set_member("nodeValue",        nodevalue.to_string());
@@ -627,52 +620,139 @@
 //   }
 
   
-  // Process the attributes, if any
-  if (xml->_attributes.size() == 0) {
-    //log_msg("\t\tNo attributes for node %s, created empty object at %p\n", 
nodename, attr_obj);
+    // Process the attributes, if any
+    if (xml->_attributes.size() == 0) {
+        //log_msg("\t\tNo attributes for node %s, created empty object at 
%p\n", nodename, attr_obj);
 //     log_msg("\t\tNo attributes for node %s\n", nodename);
-  } else {
-    attr_obj = new xmlattr_as_object;
-    for (i=0; i<xml->_attributes.size(); i++) {
-      attr_obj->set_member(xml->_attributes[i]->_name, 
xml->_attributes[i]->_value);
+    } else {
+        attr_obj = new xmlattr_as_object;
+        for (i=0; i<xml->_attributes.size(); i++) {
+            attr_obj->set_member(xml->_attributes[i]->_name, 
xml->_attributes[i]->_value);
 //        log_msg("\t\tAdding attribute as member %s, value is %s to node %s 
(%p)\n",
 //                xml->_attributes[i]->_name,
 //                xml->_attributes[i]->_value, nodename, obj);
+        }
+        obj->set_member("attributes", attr_obj);
     }
-    obj->set_member("attributes", attr_obj);
-  }
 
-  //xml->_attributes.resize(0);
-  //obj->set_member("attributes", attr_obj);
+    //xml->_attributes.resize(0);
+    //obj->set_member("attributes", attr_obj);
 
-  // Process the children, if there are any
-  if (length) {
-    //log_msg("\tProcessing %d children nodes for %s\n", length, nodename);
-    inum = 0;
-    for (child=0; child<length; child++) {
-      // Create a new AS object for this node's children
-      xmlchildnode_obj = new xmlnode_as_object;
-      // When parsing XML from memory, the test movies I have expect the 
firstChild
-      // to be the first element of the array instead.
-      if (mem) {
-        childnode = xml;
-        //obj->set_member(inum.to_string(), obj);
-        //inum += 1;
-        //childnode = xml->_children[child];
-      } else {
-        childnode = xml->_children[child];
-      }
-      setupFrame(xmlchildnode_obj, childnode, false); // setup child node
-      obj->set_member(inum.to_string(), xmlchildnode_obj);
-      inum += 1;
-    }
-  } else {
-    //log_msg("\tNode %s has no children\n", nodename);
-  }  
+    // Process the children, if there are any
+    if (length) {
+        //log_msg("\tProcessing %d children nodes for %s\n", length, nodename);
+        inum = 0;
+        for (child=0; child<length; child++) {
+            // Create a new AS object for this node's children
+            xmlchildnode_obj = new xmlnode_as_object;
+            // When parsing XML from memory, the test movies I have expect the 
firstChild
+            // to be the first element of the array instead.
+            if (mem) {
+                childnode = xml;
+                //obj->set_member(inum.to_string(), obj);
+                //inum += 1;
+                //childnode = xml->_children[child];
+            } else {
+                childnode = xml->_children[child];
+            }
+            setupFrame(xmlchildnode_obj, childnode, false); // setup child node
+            obj->set_member(inum.to_string(), xmlchildnode_obj);
+            inum += 1;
+        }
+    } else {
+        //log_msg("\tNode %s has no children\n", nodename);
+    }  
 
-  return obj;
+    return obj;
 }
-  
+
+
+
+void
+XML::addRequestHeader()
+{
+    log_msg("%s:unimplemented \n", __FUNCTION__);
+}
+
+void
+XML::appendChild()
+{
+    log_msg("%s:unimplemented \n", __FUNCTION__);
+}
+
+void
+XML::cloneNode()
+{
+    log_msg("%s:unimplemented \n", __FUNCTION__);
+}
+
+void
+XML::createElement()
+{
+    log_msg("%s:unimplemented \n", __FUNCTION__);
+}
+
+void
+XML::createTextNode()
+{
+    log_msg("%s:unimplemented \n", __FUNCTION__);
+}
+
+void
+XML::getBytesLoaded()
+{
+    log_msg("%s:unimplemented \n", __FUNCTION__);
+}
+
+void
+XML::getBytesTotal()
+{
+    log_msg("%s:unimplemented \n", __FUNCTION__);
+}
+
+void
+XML::insertBefore()
+{
+    log_msg("%s:unimplemented \n", __FUNCTION__);
+}
+
+void
+XML::load()
+{
+    log_msg("%s:unimplemented \n", __FUNCTION__);
+}
+
+void
+XML::parseXML()
+{
+    log_msg("%s:unimplemented \n", __FUNCTION__);
+}
+
+void
+XML::removeNode()
+{
+    log_msg("%s:unimplemented \n", __FUNCTION__);
+}
+
+void
+XML::send()
+{
+    log_msg("%s:unimplemented \n", __FUNCTION__);
+}
+
+void
+XML::sendAndLoad()
+{
+    log_msg("%s:unimplemented \n", __FUNCTION__);
+}
+
+void
+XML::toString()
+{
+    log_msg("%s:unimplemented \n", __FUNCTION__);
+}
+
+
 //
 // Callbacks. These are the wrappers for the C++ functions so they'll work as
 // callbacks from within gnash.
@@ -680,76 +760,76 @@
 void
 xml_load(const fn_call& fn)
 {
-  as_value     method;
-  as_value     val;
-  bool          ret;
-  struct stat   stats;
+    as_value   method;
+    as_value   val;
+    bool          ret;
+    struct stat   stats;
 
 
-  //log_msg("%s:\n", __FUNCTION__);
+    //log_msg("%s:\n", __FUNCTION__);
   
-  xml_as_object *xml_obj = (xml_as_object*)fn.this_ptr;
+    xml_as_object *xml_obj = (xml_as_object*)fn.this_ptr;
   
-  const tu_string filespec = 
fn.env->bottom(fn.first_arg_bottom_index).to_string();
+    const tu_string filespec = 
fn.env->bottom(fn.first_arg_bottom_index).to_string();
 
-  // If the file doesn't exist, don't try to do anything.
-  if (stat(filespec.c_str(), &stats) < 0) {
-    fprintf(stderr, "ERROR: doesn't exist.%s\n", filespec.c_str());
-    fn.result->set_bool(false);
-    return;
-  }
+    // If the file doesn't exist, don't try to do anything.
+    if (stat(filespec.c_str(), &stats) < 0) {
+        fprintf(stderr, "ERROR: doesn't exist.%s\n", filespec.c_str());
+        fn.result->set_bool(false);
+        return;
+    }
   
-  // Set the argument to the function event handler based on whether the load
-  // was successful or failed.
-  ret = xml_obj->obj.load(filespec);
-  fn.result->set_bool(ret);
+    // Set the argument to the function event handler based on whether the load
+    // was successful or failed.
+    ret = xml_obj->obj.load(filespec);
+    fn.result->set_bool(ret);
 
-  if (ret == false) {
-    return;
-  }
+    if (ret == false) {
+        return;
+    }
     
-  //env->bottom(first_arg) = ret;
-  array<with_stack_entry> with_stack;
-  array<with_stack_entry> dummy_stack;
-  //  struct node *first_node = ptr->obj.firstChildGet();
-  
-  //const char *name = ptr->obj.nodeNameGet();
-
-  if (xml_obj->obj.hasChildNodes() == false) {
-    log_error("%s: No child nodes!\n", __FUNCTION__);
-  }  
-  xml_obj->obj.setupFrame(xml_obj, xml_obj->obj.firstChild(), false);
+    //env->bottom(first_arg) = ret;
+    array<with_stack_entry> with_stack;
+    array<with_stack_entry> dummy_stack;
+    //  struct node *first_node = ptr->obj.firstChildGet();
+  
+    //const char *name = ptr->obj.nodeNameGet();
+
+    if (xml_obj->obj.hasChildNodes() == false) {
+        log_error("%s: No child nodes!\n", __FUNCTION__);
+    }  
+    xml_obj->obj.setupFrame(xml_obj, xml_obj->obj.firstChild(), false);
   
 #if 1
-  if (fn.this_ptr->get_member("onLoad", &method)) {
-    //    log_msg("FIXME: Found onLoad!\n");
-    fn.env->set_variable("success", true, 0);
-    fn.env->bottom(fn.first_arg_bottom_index) = true;
-    as_c_function_ptr  func = method.to_c_function();
-    if (func)
-      {
-        // It's a C function.  Call it.
-        log_msg("Calling C function for onLoad\n");
-        (*func)(fn_call(&val, xml_obj, fn.env, fn.nargs, 
fn.first_arg_bottom_index)); // was this_ptr instead of node
-      }
-    else if (as_as_function* as_func = method.to_as_function())
-      {
-        // It's an ActionScript function.  Call it.
-        log_msg("Calling ActionScript function for onLoad\n");
-        (*as_func)(fn_call(&val, xml_obj, fn.env, fn.nargs, 
fn.first_arg_bottom_index)); // was this_ptr instead of node
-      } else {
-        log_error("error in call_method(): method is not a function\n");
-      }
-  } else {
-    log_msg("Couldn't find onLoad event handler, setting up callback\n");
-    // ptr->set_event_handler(event_id::XML_LOAD, 
(as_c_function_ptr)&xml_onload);
-  }
+    if (fn.this_ptr->get_member("onLoad", &method)) {
+        //    log_msg("FIXME: Found onLoad!\n");
+        fn.env->set_variable("success", true, 0);
+        fn.env->bottom(fn.first_arg_bottom_index) = true;
+        as_c_function_ptr      func = method.to_c_function();
+        if (func)
+            {
+                // It's a C function.  Call it.
+                log_msg("Calling C function for onLoad\n");
+                (*func)(fn_call(&val, xml_obj, fn.env, fn.nargs, 
fn.first_arg_bottom_index)); // was this_ptr instead of node
+            }
+        else if (as_as_function* as_func = method.to_as_function())
+            {
+                // It's an ActionScript function.  Call it.
+                log_msg("Calling ActionScript function for onLoad\n");
+                (*as_func)(fn_call(&val, xml_obj, fn.env, fn.nargs, 
fn.first_arg_bottom_index)); // was this_ptr instead of node
+            } else {
+                log_error("error in call_method(): method is not a 
function\n");
+            }
+    } else {
+        log_msg("Couldn't find onLoad event handler, setting up callback\n");
+        // ptr->set_event_handler(event_id::XML_LOAD, 
(as_c_function_ptr)&xml_onload);
+    }
 #else
-  xml_obj->set_event_handler(event_id::XML_LOAD, &xml_onload);
+    xml_obj->set_event_handler(event_id::XML_LOAD, &xml_onload);
 
 #endif
 
-  fn.result->set_bool(true);
+    fn.result->set_bool(true);
 }
 
 // This executes the event handler for XML::XML_LOAD if it's been defined,
@@ -757,130 +837,145 @@
 void
 xml_onload(const fn_call& fn)
 {
-  //log_msg("%s:\n", __FUNCTION__);
+    //log_msg("%s:\n", __FUNCTION__);
     
-  as_value     method;
-  as_value      val;
-  static bool first = true;     // This event handler should only be executed 
once.
-  array<with_stack_entry>      empty_with_stack;
-  xml_as_object*       ptr = (xml_as_object*) (as_object*) fn.this_ptr;
-  assert(ptr);
-  
-  if ((ptr->obj.loaded()) && (first)) {
-    // env->set_variable("success", true, 0);
-    //as_value bo(true);
-    //env->push_val(bo);
-
-    first = false;
-    log_msg("The XML file has been loaded successfully!\n");
-    // ptr->on_event(event_id::XML_LOAD);
-    //env->set_variable("success", true, 0);
-    //env->bottom(0) = true;
+    as_value   method;
+    as_value      val;
+    static bool first = true;     // This event handler should only be 
executed once.
+    array<with_stack_entry>    empty_with_stack;
+    xml_as_object*     ptr = (xml_as_object*) (as_object*) fn.this_ptr;
+    assert(ptr);
+  
+    if ((ptr->obj.loaded()) && (first)) {
+        // env->set_variable("success", true, 0);
+        //as_value bo(true);
+        //env->push_val(bo);
+
+        first = false;
+        log_msg("The XML file has been loaded successfully!\n");
+        // ptr->on_event(event_id::XML_LOAD);
+        //env->set_variable("success", true, 0);
+        //env->bottom(0) = true;
     
-    if (fn.this_ptr->get_member("onLoad", &method)) {
-      // log_msg("FIXME: Found onLoad!\n");
-      as_c_function_ptr        func = method.to_c_function();
-      if (func)
-        {
-          // It's a C function.  Call it.
-          log_msg("Calling C function for onLoad\n");
-          (*func)(fn_call(&val, fn.this_ptr, fn.env, 0, 0));
-        }
-      else if (as_as_function* as_func = method.to_as_function())
-        {
-          // It's an ActionScript function.  Call it.
-          log_msg("Calling ActionScript function for onLoad\n");
-        (*as_func)(fn_call(&val, fn.this_ptr, fn.env, 0, 0));
-        }
-      else
-        {
-          log_error("error in call_method(): method is not a function\n");
-        }    
-    } else {
-      log_msg("FIXME: Couldn't find onLoad!\n");
+        if (fn.this_ptr->get_member("onLoad", &method)) {
+            // log_msg("FIXME: Found onLoad!\n");
+            as_c_function_ptr  func = method.to_c_function();
+            if (func)
+                {
+                    // It's a C function.  Call it.
+                    log_msg("Calling C function for onLoad\n");
+                    (*func)(fn_call(&val, fn.this_ptr, fn.env, 0, 0));
+                }
+            else if (as_as_function* as_func = method.to_as_function())
+                {
+                    // It's an ActionScript function.  Call it.
+                    log_msg("Calling ActionScript function for onLoad\n");
+                    (*as_func)(fn_call(&val, fn.this_ptr, fn.env, 0, 0));
+                }
+            else
+                {
+                    log_error("error in call_method(): method is not a 
function\n");
+                }    
+        } else {
+            log_msg("FIXME: Couldn't find onLoad!\n");
+        }
     }
-  }
       
-  fn.result->set_bool(val.to_bool());
+    fn.result->set_bool(val.to_bool());
 }
 
 // This is the default event handler, and is usually redefined in the SWF 
script
 void
 xml_ondata(const fn_call& fn)
 {
-  log_msg("%s:\n", __FUNCTION__);
+    log_msg("%s:\n", __FUNCTION__);
     
-  as_value     method;
-  as_value     val;
-  static bool first = true;     // FIXME: ugly hack!
-  
-  xml_as_object*       ptr = (xml_as_object*)fn.this_ptr;
-  assert(ptr);
-  
-  if ((ptr->obj.loaded()) && (first)) {
-    if (fn.this_ptr->get_member("onData", &method)) {
-      log_msg("FIXME: Found onData!\n");
-      as_c_function_ptr        func = method.to_c_function();
-      fn.env->set_variable("success", true, 0);
-      if (func)
-        {
-          // It's a C function.  Call it.
-          log_msg("Calling C function for onData\n");
-          (*func)(fn_call(&val, fn.this_ptr, fn.env, 0, 0));
-      }
-      else if (as_as_function* as_func = method.to_as_function())
-        {
-          // It's an ActionScript function.  Call it.
-          log_msg("Calling ActionScript function for onData\n");
-          (*as_func)(fn_call(&val, fn.this_ptr, fn.env, 0, 0));
-        }
-      else
-        {
-          log_error("error in call_method(): method is not a function\n");
-        }    
-    } else {
-      log_msg("FIXME: Couldn't find onData!\n");
+    as_value   method;
+    as_value   val;
+    static bool first = true;     // FIXME: ugly hack!
+  
+    xml_as_object*     ptr = (xml_as_object*)fn.this_ptr;
+    assert(ptr);
+  
+    if ((ptr->obj.loaded()) && (first)) {
+        if (fn.this_ptr->get_member("onData", &method)) {
+            log_msg("FIXME: Found onData!\n");
+            as_c_function_ptr  func = method.to_c_function();
+            fn.env->set_variable("success", true, 0);
+            if (func)
+                {
+                    // It's a C function.  Call it.
+                    log_msg("Calling C function for onData\n");
+                    (*func)(fn_call(&val, fn.this_ptr, fn.env, 0, 0));
+                }
+            else if (as_as_function* as_func = method.to_as_function())
+                {
+                    // It's an ActionScript function.  Call it.
+                    log_msg("Calling ActionScript function for onData\n");
+                    (*as_func)(fn_call(&val, fn.this_ptr, fn.env, 0, 0));
+                }
+            else
+                {
+                    log_error("error in call_method(): method is not a 
function\n");
+                }    
+        } else {
+            log_msg("FIXME: Couldn't find onData!\n");
+        }
     }
-  }
 
-  //fn.result->set(&val);
-  fn.result->set_bool(val.to_bool());
+    //fn.result->set(&val);
+    fn.result->set_bool(val.to_bool());
 }
 
 void
 xml_new(const fn_call& fn)
 {
-  as_value      inum;
-  xml_as_object *xml_obj;
-  //const char    *data;
-  
-  //log_msg("%s: nargs=%d\n", __FUNCTION__, nargs);
-  
-  if (fn.nargs > 0) {
-    if (fn.env->top(0).get_type() == as_value::STRING) {
-      xml_obj = new xml_as_object;
-      //log_msg("\tCreated New XML object at %p\n", xml_obj);
-      tu_string datain = fn.env->top(0).to_tu_string();
-      xml_obj->obj.parseXML(datain);
-      //log_msg("*** Start setting up the stack frames ***\n");
-      xml_obj->obj.setupFrame(xml_obj, xml_obj->obj.firstChild(), true);
-      //xml_obj->obj.clear();
-      //delete xml_obj->obj.firstChild();
+    as_value      inum;
+    xml_as_object *xml_obj;
+    //const char    *data;
+  
+//  log_msg("%s: nargs=%d\n", __FUNCTION__, fn.nargs);
+  
+    if (fn.nargs > 0) {
+        if (fn.env->top(0).get_type() == as_value::STRING) {
+            xml_obj = new xml_as_object;
+            //log_msg("\tCreated New XML object at %p\n", xml_obj);
+            tu_string datain = fn.env->top(0).to_tu_string();
+            xml_obj->obj.parseXML(datain);
+            //log_msg("*** Start setting up the stack frames ***\n");
+            xml_obj->obj.setupFrame(xml_obj, xml_obj->obj.firstChild(), true);
+            //xml_obj->obj.clear();
+            //delete xml_obj->obj.firstChild();
+        } else {
+            xml_as_object*     xml_obj = 
(xml_as_object*)fn.env->top(0).to_object();
+            //log_msg("\tCloned the XML object at %p\n", xml_obj);
+            //result->set(xml_obj);
+            fn.result->set_as_object_interface(xml_obj);
+            return;
+        }
     } else {
-      xml_as_object*   xml_obj = (xml_as_object*)fn.env->top(0).to_object();
-      //log_msg("\tCloned the XML object at %p\n", xml_obj);
-      //result->set(xml_obj);
-      fn.result->set_as_object_interface(xml_obj);
-      return;
-    }
-  } else {
-    xml_obj = new xml_as_object;
-    //log_msg("\tCreated New XML object at %p\n", xml_obj);
-    xml_obj->set_member("load", &xml_load);
-    xml_obj->set_member("loaded", &xml_loaded);
-  }
+        xml_obj = new xml_as_object;
+        //log_msg("\tCreated New XML object at %p\n", xml_obj);
+        xml_obj->set_member("loaded", &xml_loaded);
+        
+        xml_obj->set_member("addrequestheader", &xml_addrequestheader);
+        xml_obj->set_member("appendchild", &xml_appendchild);
+        xml_obj->set_member("clonenode", &xml_clonenode);
+        xml_obj->set_member("createelement", &xml_createelement);
+        xml_obj->set_member("createtextnode", &xml_createtextnode);
+        xml_obj->set_member("getbytesloaded", &xml_getbytesloaded);
+        xml_obj->set_member("getbytestotal", &xml_getbytestotal);
+        xml_obj->set_member("haschildnodes", &xml_haschildnodes);
+        xml_obj->set_member("insertbefore", &xml_insertbefore);
+        xml_obj->set_member("load", &xml_load);
+        xml_obj->set_member("parseXML", &xml_parsexml);
+        xml_obj->set_member("removenode", &xml_removenode);
+        xml_obj->set_member("send", &xml_send);
+        xml_obj->set_member("sendandload", &xml_sendandload);
+        xml_obj->set_member("tostring", &xml_tostring);
+    }
 
-  fn.result->set_as_object_interface(xml_obj);
+    fn.result->set_as_object_interface(xml_obj);
 }
 
 //
@@ -894,27 +989,132 @@
 void
 xml_loaded(const fn_call& fn)
 {
-  as_value     method;
-  as_value     val;
+    as_value   method;
+    as_value   val;
+
+    log_msg("%s:\n", __FUNCTION__);
+    
+    xml_as_object*     ptr = (xml_as_object*) (as_object*) fn.this_ptr;
+    assert(ptr);
+    tu_string filespec = fn.env->bottom(fn.first_arg_bottom_index).to_string();
+    //fn.result->set(ptr->obj.loaded());
+    fn.result->set_bool(ptr->obj.loaded());
+}
 
-  log_msg("%s:\n", __FUNCTION__);
+
+void xml_addrequestheader(const fn_call& fn) {
+    xml_as_object *ptr = (xml_as_object*)fn.this_ptr;
+    assert(ptr);
+    
+//    fn.result->set_int(ptr->obj.getAllocated());
+    ptr->obj.addRequestHeader();
+}
+void xml_appendchild(const fn_call& fn) {
+    xml_as_object *ptr = (xml_as_object*)fn.this_ptr;
+    assert(ptr);
+    
+//    fn.result->set_int(ptr->obj.getAllocated());
+    ptr->obj.appendChild();
+}
+void xml_clonenode(const fn_call& fn) {
+    xml_as_object *ptr = (xml_as_object*)fn.this_ptr;
+    assert(ptr);
+    
+//    fn.result->set_int(ptr->obj.getAllocated());
+    ptr->obj.cloneNode();
+}
+void xml_createelement(const fn_call& fn) {
+    xml_as_object *ptr = (xml_as_object*)fn.this_ptr;
+    assert(ptr);
+    
+//    fn.result->set_int(ptr->obj.getAllocated());
+    ptr->obj.createElement();
+}
+void xml_createtextnode(const fn_call& fn) {
+    xml_as_object *ptr = (xml_as_object*)fn.this_ptr;
+    assert(ptr);
+    
+//    fn.result->set_int(ptr->obj.getAllocated());
+    ptr->obj.createTextNode();
+}
+void xml_getbytesloaded(const fn_call& fn) {
+    xml_as_object *ptr = (xml_as_object*)fn.this_ptr;
+    assert(ptr);
+    
+//    fn.result->set_int(ptr->obj.getAllocated());
+    ptr->obj.getBytesLoaded();
+}
+void xml_getbytestotal(const fn_call& fn) {
+    xml_as_object *ptr = (xml_as_object*)fn.this_ptr;
+    assert(ptr);
+    
+//    fn.result->set_int(ptr->obj.getAllocated());
+    ptr->obj.getBytesTotal();
+}
+void xml_haschildnodes(const fn_call& fn) {
+    xml_as_object *ptr = (xml_as_object*)fn.this_ptr;
+    assert(ptr);
+    
+//    fn.result->set_int(ptr->obj.getAllocated());
+    ptr->obj.hasChildNodes();
+}
+void xml_insertbefore(const fn_call& fn) {
+    xml_as_object *ptr = (xml_as_object*)fn.this_ptr;
+    assert(ptr);
+    
+//    fn.result->set_int(ptr->obj.getAllocated());
+    ptr->obj.insertBefore();
+}
+void xml_parsexml(const fn_call& fn) {
+    xml_as_object *ptr = (xml_as_object*)fn.this_ptr;
+    assert(ptr);
+    
+//    fn.result->set_int(ptr->obj.getAllocated());
+    ptr->obj.parseXML();
+}
+void xml_removenode(const fn_call& fn) {
+    xml_as_object *ptr = (xml_as_object*)fn.this_ptr;
+    assert(ptr);
+    
+//    fn.result->set_int(ptr->obj.getAllocated());
+    ptr->obj.removeNode();
+}
+void xml_send(const fn_call& fn) {
+    xml_as_object *ptr = (xml_as_object*)fn.this_ptr;
+    assert(ptr);
+    
+//    fn.result->set_int(ptr->obj.getAllocated());
+    ptr->obj.send();
+}
+void xml_sendandload(const fn_call& fn) {
+    xml_as_object *ptr = (xml_as_object*)fn.this_ptr;
+    assert(ptr);
     
-  xml_as_object*       ptr = (xml_as_object*) (as_object*) fn.this_ptr;
-  assert(ptr);
-  tu_string filespec = fn.env->bottom(fn.first_arg_bottom_index).to_string();
-  //fn.result->set(ptr->obj.loaded());
-  fn.result->set_bool(ptr->obj.loaded());
+//    fn.result->set_int(ptr->obj.getAllocated());
+    ptr->obj.sendAndLoad();
+}
+void xml_tostring(const fn_call& fn) {
+    xml_as_object *ptr = (xml_as_object*)fn.this_ptr;
+    assert(ptr);
+    
+//    fn.result->set_int(ptr->obj.getAllocated());
+    ptr->obj.toString();
 }
 
 int
 memadjust(int x)
 {
-  return (x + (4 - x % 4));
+    return (x + (4 - x % 4));
 }
 
 
 } // end of gnash namespace
 
-
 // HAVE_LIBXML
 #endif
+
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:
Index: gnash/server/xml.h
diff -u gnash/server/xml.h:1.6 gnash/server/xml.h:1.7
--- gnash/server/xml.h:1.6      Wed Feb  1 23:52:44 2006
+++ gnash/server/xml.h  Sun Feb  5 18:06:28 2006
@@ -40,43 +40,41 @@
 namespace gnash {
   
 /// XML Attribute class
-  class XMLAttr {
- public:
-  XMLAttr();
-  ~XMLAttr();
+class XMLAttr {
+public:
+    XMLAttr();
+    ~XMLAttr();
   
-  char        *_name;
-  char        *_value;
+    char        *_name;
+    char        *_value;
 
-  XMLAttr *operator = (XMLAttr node) {
-    log_msg("\t\tCopying XMLAttr object at %p\n", this);
+    XMLAttr *operator = (XMLAttr node) {
+        log_msg("\t\tCopying XMLAttr object at %p\n", this);
     
-    _name = new char[strlen(node._name)+2];
-    memset(_name, 0, strlen(node._name)+2);
-    strcpy(_name, node._name);
-
-    _value = new char[strlen(node._value)+2];
-    memset(_value, 0, strlen(node._value)+2);
-    strcpy(_value, node._value);
+        _name = new char[strlen(node._name)+2];
+        memset(_name, 0, strlen(node._name)+2);
+        strcpy(_name, node._name);
+
+        _value = new char[strlen(node._value)+2];
+        memset(_value, 0, strlen(node._value)+2);
+        strcpy(_value, node._value);
 
-    return this;
-  }
+        return this;
+    }
 };
 
 /// XML Attribute ActionScript Object
 struct xmlattr_as_object : public as_object
 {
-  //XMLAttr obj;
-  int   padding;
+    //XMLAttr obj;
+    int   padding;
 #ifdef DEBUG_MEMORY_ALLOCATION
-  xmlattr_as_object() 
-  {
-    log_msg("\t\tCreating xmlattr_as_object at %p\n", this);
-  };
-  ~xmlattr_as_object() 
-  {
-    log_msg("\tDeleting xmlattr_as_object at %p \n", this);
-  };
+    xmlattr_as_object() {
+        log_msg("\t\tCreating xmlattr_as_object at %p\n", this);
+    };
+    ~xmlattr_as_object() {
+        log_msg("\tDeleting xmlattr_as_object at %p \n", this);
+    };
 #endif
 };
  
@@ -84,329 +82,297 @@
 class XMLNode
 {
 public:
-  XMLNode();
-  ~XMLNode();
+    XMLNode();
+    ~XMLNode();
 
-  int length() { return _children.size(); }
-  tu_string nodeName() 
-  {
-    return _name;
-  }
-
-  char *nodeValue()
-  {
-    return _value;
-  }
+    int length()         { return _children.size(); }
+    tu_string nodeName() { return _name; }
+
+    char *nodeValue()    { return _value; }
   
-  //  nodeType         XML.nodeType
+    //  nodeType       XML.nodeType
 
-  bool hasChildNodes()
-  {
-    if (_children.size() > 0) {
-      return true;
+    bool hasChildNodes() {
+        if (_children.size() > 0) {
+            return true;
+        }
+        return false;
     }
-    return false;
-  }
   
-  XMLNode *firstChild()
-  {
-    return _children[0];
-  }
+    XMLNode *firstChild() {
+        return _children[0];
+    }
   
-  array<XMLNode *>childNodes()
-  {
-    return _children;
-  }  
-
-  XMLNode *operator [] (int x)
-  {
-    gnash::log_msg("%s: get element %d\n", __FUNCTION__, x);
+    array<XMLNode *>childNodes() {
+        return _children;
+    }  
     
-    return _children[x];
-  }
-  
-  XMLNode *operator = (XMLNode &node)
-  {
-    _name = node._name;
-    _value = node._value;
-    _children = node._children;
-    _attributes = node._attributes;
-    return this;
-  }
-
-  XMLNode *operator = (XMLNode *node)
-  {
-    _name = node->_name;
-    _value = node->_value;
-    _children = node->_children;
-    _attributes = node->_attributes;
-    return this;
-  }
-
-  void appendChild(XMLNode *node)
-  {
-    node->_children.push_back(node);
-  }
-
-  void  change_stack_frame(int frame, gnash::as_object *xml, 
gnash::as_environment *env);
+    XMLNode *operator [] (int x) {
+        gnash::log_msg("%s: get element %d\n", __FUNCTION__, x);
+        
+        return _children[x];
+    }
+    
+    XMLNode *operator = (XMLNode &node) {
+        _name = node._name;
+        _value = node._value;
+        _children = node._children;
+        _attributes = node._attributes;
+        return this;
+    }
+    
+    XMLNode *operator = (XMLNode *node) {
+        _name = node->_name;
+        _value = node->_value;
+        _children = node->_children;
+        _attributes = node->_attributes;
+        return this;
+    }
+    
+    void appendChild(XMLNode *node) {
+        node->_children.push_back(node);
+    }
+    
+    void  change_stack_frame(int frame, gnash::as_object *xml, 
gnash::as_environment *env);
 
-  
-#if 0
-appendChild()           XML.appendChild()
-attributes     XML.attributes
-childNodes     XML.childNodes
-cloneNode()    XML.cloneNode()
-insertBefore()         XML.insertBefore()
-lastChild      XML.lastChild
-nextSibling    XML.nextSibling
-nodeType       XML.nodeType
-parentNode     XML.parentNode
-previousSibling        XML.previousSibling
-removeNode()   XML.removeNode()
-toString()     XML.toString()
-#endif
-  char               *_name;
-  char               *_value;
-  array<XMLNode *>   _children;
-  array<XMLAttr *>   _attributes;
+    char               *_name;
+    char               *_value;
+    array<XMLNode *>   _children;
+    array<XMLAttr *>   _attributes;
 };
 
 /// XML Node ActionScript object
 struct xmlnode_as_object : public gnash::as_object
 {
-  //XMLNode obj;
-  int                _padding;
+    //XMLNode obj;
+    int                _padding;
 
 #ifdef DEBUG_MEMORY_ALLOCATION
-  xmlnode_as_object() 
-  {
-    log_msg("\tCreating xmlnode_as_object at %p \n", this);
-  };
-  ~xmlnode_as_object() 
-  {
-    log_msg("\tDeleting xmlnode_as_object at %p \n", this);
-  };
+    xmlnode_as_object() {
+        log_msg("\tCreating xmlnode_as_object at %p \n", this);
+    };
+    ~xmlnode_as_object() {
+        log_msg("\tDeleting xmlnode_as_object at %p \n", this);
+    };
 #endif
-  virtual bool get_member(const tu_stringi& name, as_value* val)
-  {
-    //printf("GET XMLNode MEMBER: %s at %p for object %p\n", name.c_str(), 
val, this);
-
-    if ((name == "firstChild") || (name == "childNodes")) {
-      //printf("Returning a self reference for %s for object at %p\n", 
name.c_str(), this);
-      val->set_as_object_interface(this);
-      return true;
-    }
-    
+    virtual bool get_member(const tu_stringi& name, as_value* val) {
+        //printf("GET XMLNode MEMBER: %s at %p for object %p\n", name.c_str(), 
val, this);
+        
+        if ((name == "firstChild") || (name == "childNodes")) {
+            //printf("Returning a self reference for %s for object at %p\n", 
name.c_str(), this);
+            val->set_as_object_interface(this);
+            return true;
+        }
+        
 #if 1
-       printf("%s(%d): ERROR: as_member::get() unimplemented!", 
__PRETTY_FUNCTION__, __LINE__);
+        printf("%s(%d): ERROR: as_member::get() unimplemented!", 
__PRETTY_FUNCTION__, __LINE__);
 #else
-    if (m_members.get(name, val) == false) {
-      if (m_prototype != NULL) {
-        return m_prototype->get_member(name, val);
-      }
-      return false;
-    }
+        if (m_members.get(name, val) == false) {
+            if (m_prototype != NULL) {
+                return m_prototype->get_member(name, val);
+            }
+            return false;
+        }
 #endif
-    return true;
-  }
+        return true;
+    }
 };
 
 /// XML class
 class XML {
- public:
-  XML();
-  XML(tu_string xml_in);
-  XML(struct node * childNode);
-  virtual ~XML();
-
-  // Methods
-  bool parseDoc(xmlDocPtr document, bool mem); // This is the base method used 
by both parseXML() and load().
-  bool parseXML(tu_string xml_in); // Parses an XML document into the 
specified XML object tree.
-  bool load(const char *filespec);  // Loads a document (specified by
-                                    // the XML object) from a URL.
-
-  bool onLoad();                   // An event handler that returns a
-                                   // Boolean value indicating whether
-                                   // the XML object was successfully
-                                   // loaded with XML.load() or
-                                   // XML.sendAndLoad().
-
-  // Appends a node to the end of the specified object's child list.
-  void appendChild(XMLNode *node)
-  {
-    _nodes->_children.push_back(node);
-  }
-  
-  virtual bool on_event(gnash::event_id id);
-  virtual void on_event_load();
-  bool loaded()    { return _loaded; }
-
-  XMLNode *firstChild()
-  {
-    return _nodes;
-    //return _node_data[0];
-  }
-  
-  void clear()
-  {
-    delete _nodes;
-  }
-  
-  array<XMLNode *> childNodes()
-  {
-    return _nodes->_children;
-  }
-  
-  //  Returns true if the specified node has child nodes; otherwise, returns 
false.
-  bool hasChildNodes()
-  {
-    return _nodes->_children.size();
-  }
-
-  XMLNode *extractNode(xmlNodePtr node, bool mem);
-  XMLNode *processNode(xmlTextReaderPtr reader, XMLNode *node);
-
-  void  change_stack_frame(int frame, gnash::as_object *xml, 
gnash::as_environment *env);
-  void  setupStackFrames(gnash::as_object *xml, gnash::as_environment *env);
-  void  cleanupStackFrames( XMLNode *data);
-  as_object *setupFrame(gnash::as_object *xml, XMLNode *data, bool src);
-  
-  const char *nodeNameGet() 
-    {
-      return _nodename;
+public:
+    XML();
+    XML(tu_string xml_in);
+    XML(struct node * childNode);
+    virtual ~XML();
+
+    // Methods
+    // This is the base method used by both parseXML() and load().
+    bool parseDoc(xmlDocPtr document, bool mem);
+    // Parses an XML document into the specified XML object tree.
+    bool parseXML(tu_string xml_in);
+    // Loads a document (specified by
+    bool load(const char *filespec);
+    // the XML object) from a URL.
+
+    // An event handler that returns a
+    bool onLoad();
+    // Boolean value indicating whether
+    // the XML object was successfully
+    // loaded with XML.load() or
+    // XML.sendAndLoad().
+
+    // Appends a node to the end of the specified object's child list.
+    void appendChild(XMLNode *node) {
+        _nodes->_children.push_back(node);
+    }
+    
+    virtual bool on_event(gnash::event_id id);
+    virtual void       on_event_load();
+    bool loaded()    { return _loaded; }
+    
+    XMLNode *firstChild() {
+        return _nodes;
+        //return _node_data[0];
     }
+    
+    void clear() {
+        delete _nodes;
+    }
+    
+    array<XMLNode *> childNodes() {
+        return _nodes->_children;
+    }
+    
+    //  Returns true if the specified node has child nodes; otherwise, returns 
false.
+    bool hasChildNodes() {
+        return _nodes->_children.size();
+    }
+    
+    XMLNode *extractNode(xmlNodePtr node, bool mem);
+    XMLNode *processNode(xmlTextReaderPtr reader, XMLNode *node);
+
+    void  change_stack_frame(int frame, gnash::as_object *xml, 
gnash::as_environment *env);
+    void  setupStackFrames(gnash::as_object *xml, gnash::as_environment *env);
+    void  cleanupStackFrames( XMLNode *data);
+    as_object *setupFrame(gnash::as_object *xml, XMLNode *data, bool src);
   
-  int length() { return _nodes->length(); }
+    const char *nodeNameGet()    { return _nodename; }
   
-#if 0
-  void addRequestHeader();          // Adds or changes HTTP headers for POST
-                                    // operations. 
-  void appendChild();               // Appends a node to the end of
-                                    // the specified object's child
-                                    // list.
-  void cloneNode();                 // Clones the specified node and,
-                                    // optionally, recursively clones
-                                    // all children. 
-  void createElement(); // Creates a new XML element.
-  void createTextNode(); //Creates a new XML text node.
-  void getBytesLoaded(); // Returns the number of bytes loaded for the 
specified XML document.
-  void getBytesTotal(); // Returns the size of the XML document, in bytes.
-  void insertBefore();// Inserts a node in front of an existing node in the 
specified node's child list.
-  void removeNode();// Removes the specified node from its parent.
-  void send();             // Sends the specified XML object to a URL.
-  void sendAndLoad(); // Sends the specified XML object to a URL and loads the 
server response into another XML object.void 
-  gnash::tu_string toString();                // Converts the specified node 
and 
-                                                // any children to XML text. 
+    int length()                 { return _nodes->length(); }
+  
+#if 1
+    void addRequestHeader();
+    void appendChild();
+    void cloneNode();
+    void createElement();
+    void createTextNode();
+    void getBytesLoaded();
+    void getBytesTotal();
+    void insertBefore();
+    void load();
+    void parseXML();
+    void removeNode();
+    void send();
+    void sendAndLoad();
+    void toString();
 #endif
-  virtual void on_xml_event(gnash::event_id id) { on_event(id); }
+    virtual void       on_xml_event(gnash::event_id id) { on_event(id); }
   
-  // Special event handler; 
-  void on_event_close() { on_event(gnash::event_id::SOCK_CLOSE); }
+    // Special event handler; 
+    void       on_event_close() { on_event(gnash::event_id::SOCK_CLOSE); }
   
-  XMLNode *operator [] (int x);
+    XMLNode *operator [] (int x);
 #if 0
-  XMLNode *operator = (XMLNode &node)
-  {
-    gnash::log_msg("%s: copy element %s\n", __FUNCTION__, node._name.c_str());
-    _nodes = node;
-  }
+    XMLNode *operator = (XMLNode &node) {
+        gnash::log_msg("%s: copy element %s\n", __FUNCTION__, 
node._name.c_str());
+        _nodes = node;
+    }
 
 #endif
-  XML *operator = (XMLNode *node)
-  {
-    _nodes = node;    
-    return this;
-  }
-
-  private:
-  //bool _on_event_loaded;
+    XML *operator = (XMLNode *node) {
+        _nodes = node;    
+        return this;
+    }
+    
+private:
     xmlDocPtr _doc;
     xmlNodePtr _firstChild;
     
     // Properties
-    bool _loaded;                           // Read-only; checks if
-                                            // the specified XML object has 
loaded.
-    const char  *_nodename;                  // The node name of an XML object.
+    bool _loaded;
+    const char  *_nodename;
     XMLNode     *_nodes;
-    //    array<XMLNode *>  _node_data;
-  //    hash<gnash::event_id, gnash::as_value> _event_handlers;
-#if 0
-    array<struct node *> _childNodes; // Read-only; returns an array containing
-                                            // references to the child
-                                            // nodes of the specified
-                                            // node.
-  contentType; //      Indicates the MIME type transmitted to the server.
-  docTypeDecl; // Sets and returns information about an XML document's DOCTYPE 
declaration.
-  firstChild;  // Read-only; references the first child in the list for the 
specified node.
-  bool ignoreWhite;    // When set to true, text nodes that contain only white 
space are discarded during the parsing process.
-  lastChild;   // References the last child in the list for the specified node.
-  nextSibling; // Read-only; references the next sibling in the parent node's 
child list.
-  tu_string nodeType;  // The type of the specified node (XML element or text 
node).
-  nodeValue;   // The text of the specified node if the node is a text node.
-  parentNode;  // Read-only; references the parent node of the specified node.
-  previousSibling; //  Read-only; references the previous sibling in the 
parent node's child list.
-  status; //   A numeric status code indicating the success or failure of an 
XML document parsing operation.
-  xmlDecl; //  Specifies information about a document's XML declaration.
-
-  // Collections data
-  attributes; // Returns an associative array containing all of the attributes 
of the specified node.
-  // Event Handlers
-  onData; // An event handler that is invoked when XML text has been
-          // completely downloaded from the server, or when an error
-          // occurs downloading XML text from a server. 
-#endif  
+    
+    bool _contentType;
+    bool _attributes;
+    bool _childNodes;
+    bool _xmlDecl;
+    bool _docTypeDecl;
+    bool _ignoreWhite;
+    bool _lastChild;
+    bool _nextSibling;
+    bool _nodeName;
+    bool _nodeType;
+    bool _nodeValue;
+    bool _onData;
+    bool _onLoad;
+    bool _parentNode;
+    bool _status;
+    bool _previousSibling;
+
 };
 
 /// XML ActionScript object
 struct xml_as_object : public gnash::as_object
 {
-  XML obj;
+    XML obj;
 #ifdef DEBUG_MEMORY_ALLOCATION
-  xml_as_object() 
-  {
-    log_msg("\tCreating xml_as_object at %p\n", this);
-  };
-  ~xml_as_object() 
-  {
-    log_msg("\tDeleting xml_as_object at %p\n", this);
-  };
+    xml_as_object() {
+        log_msg("\tCreating xml_as_object at %p\n", this);
+    };
+    ~xml_as_object() {
+        log_msg("\tDeleting xml_as_object at %p\n", this);
+    };
 #endif
-  virtual bool get_member(const tu_stringi& name, as_value* val)
-  {
-    printf("GET XML MEMBER: %s at %p for object %p\n", name.c_str(), val, 
this);
-
-    if ((name == "firstChild") || (name == "childNodes")) {
-      //printf("Returning a self reference for %s for object at %p\n", 
name.c_str(), this);
-      val->set_as_object_interface(this);
-      return true;
-    }
-    
-#if 1
-       printf("%s(%s:%d): ERROR: as_member::get() unimplemented!", 
__PRETTY_FUNCTION__, __FILE__, __LINE__);
+
+    virtual bool get_member(const tu_stringi& name, as_value* val) {
+        //printf("GET XML MEMBER: %s at %p for object %p\n", name.c_str(), 
val, this);
+        
+        if ((name == "firstChild") || (name == "childNodes")) {
+//             printf("Returning a self reference for %s for object at %p\n",
+//                    name.c_str(), this);
+            val->set_as_object_interface(this);
+            return true;
+        }
+        
+#if 0
+        printf("%s(%s:%d): ERROR: as_member::get() unimplemented!",
+               __PRETTY_FUNCTION__, __FILE__, __LINE__);
 #else
-    if (m_members.get(name, val) == false) {
-      if (m_prototype != NULL) {
-        return m_prototype->get_member(name, val);
-      }
-      return false;
-    }
+        as_member m;
+        if (m_members.get(name, &m) == false) {
+            if (m_prototype != NULL) {
+                return m_prototype->get_member(name, val);
+            }
+            return false;
+        } else {
+            *val=m.get_member_value();
+            return true;
+        }
 #endif
-    return true;
-  }
+        return true;
+    }
 };
 
-
 void xml_load(const fn_call& fn);
 void xml_set_current(const fn_call& fn);
 void xml_new(const fn_call& fn);
 
+void xml_addrequestheader(const fn_call& fn);
+void xml_appendchild(const fn_call& fn);
+void xml_clonenode(const fn_call& fn);
+void xml_createelement(const fn_call& fn);
+void xml_createtextnode(const fn_call& fn);
+void xml_getbytesloaded(const fn_call& fn);
+void xml_getbytestotal(const fn_call& fn);
+void xml_haschildnodes(const fn_call& fn);
+void xml_insertbefore(const fn_call& fn);
+void xml_parsexml(const fn_call& fn);
+void xml_removenode(const fn_call& fn);
+void xml_send(const fn_call& fn);
+void xml_sendandload(const fn_call& fn);
+void xml_tostring(const fn_call& fn);
+
 // These are the event handlers called for this object
 void xml_onload(const fn_call& fn);
 void xml_ondata(const fn_call& fn);
 void xml_loaded(const fn_call& fn);
 
+
 int memadjust(int x);
 
+
 }      // end namespace gnash
 
 
@@ -414,3 +380,8 @@
 
 #endif // __XML_H__
 
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]