gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10288: Rewrite XML parsing.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10288: Rewrite XML parsing.
Date: Tue, 18 Nov 2008 11:18:05 +0100
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10288
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2008-11-18 11:18:05 +0100
message:
  Rewrite XML parsing.
removed:
  libcore/asobj/xmlattrs.cpp
  macros/libXML.m4
modified:
  configure.ac
  libcore/asobj/Makefile.am
  libcore/asobj/XMLNode_as.cpp
  libcore/asobj/XMLNode_as.h
  libcore/asobj/XML_as.cpp
  libcore/asobj/XML_as.h
  libcore/asobj/xmlattrs.h
  testsuite/actionscript.all/XML.as
  testsuite/swfdec/PASSING
    ------------------------------------------------------------
    revno: 10285.1.1
    committer: Benjamin Wolsey <address@hidden>
    branch nick: test
    timestamp: Tue 2008-11-18 10:29:12 +0100
    message:
      Rewrite XML parsing, using swfdec's model as a base.
      
      This:
      - removes the dependency on libxml2
      - is less strict, so that we can parse XML incorrectly like Flash does
      - and consequently fixes many cases where an unescaped entity broke 
parsing
        completely.
      - parses directly into XMLNodes instead of first into memory
      - passes some more swfdec tests.
      
      Drop various unused functions and files. Rename enums to make it less 
ugly.
      Clean up.
      
      Remove libxml checks from configure.
    removed:
      libcore/asobj/xmlattrs.cpp
      macros/libXML.m4
    modified:
      configure.ac
      libcore/asobj/Makefile.am
      libcore/asobj/XMLNode_as.cpp
      libcore/asobj/XMLNode_as.h
      libcore/asobj/XML_as.cpp
      libcore/asobj/XML_as.h
      libcore/asobj/xmlattrs.h
      testsuite/actionscript.all/XML.as
    ------------------------------------------------------------
    revno: 10285.1.2
    committer: Benjamin Wolsey <address@hidden>
    branch nick: test
    timestamp: Tue 2008-11-18 10:34:03 +0100
    message:
      Swfdec testsuite passes.
    modified:
      testsuite/swfdec/PASSING
    ------------------------------------------------------------
    revno: 10285.1.3
    committer: Benjamin Wolsey <address@hidden>
    branch nick: test
    timestamp: Tue 2008-11-18 10:42:06 +0100
    message:
      Drop libxml includes from XMLNode_as.h
    modified:
      libcore/asobj/XMLNode_as.h
      libcore/asobj/XML_as.cpp
    ------------------------------------------------------------
    revno: 10285.1.4
    committer: Benjamin Wolsey <address@hidden>
    branch nick: test
    timestamp: Tue 2008-11-18 10:46:03 +0100
    message:
      Drop another remnant of libxml.
    modified:
      libcore/asobj/XML_as.h
    ------------------------------------------------------------
    revno: 10285.1.5
    committer: Benjamin Wolsey <address@hidden>
    branch nick: test
    timestamp: Tue 2008-11-18 10:48:27 +0100
    message:
      Unused variables.
    modified:
      libcore/asobj/XML_as.cpp
=== modified file 'configure.ac'
--- a/configure.ac      2008-11-12 15:29:13 +0000
+++ b/configure.ac      2008-11-18 09:29:12 +0000
@@ -1560,8 +1560,6 @@
 
 AM_CONDITIONAL(HAVE_SDL, [ test x$has_SDL = xyes ])
 
-GNASH_PATH_LIBXML
-
 dnl
 dnl NOTE: make sure to check for GLIB and LIBXML2 
 dnl before checking for gstreamer
@@ -2261,18 +2259,6 @@
 # out everything that is missing in one pass, hopefully making it
 # easy for new developers to get everything they need installed.
 
-if test x$xml != xno; then
-  if test x"$LIBXML_CFLAGS" != x; then
-    echo "        XML flags are: $LIBXML_CFLAGS"
-    echo "        XML libs are: $LIBXML_LIBS"
-  else
-    echo "        ERROR: No libxml2 development package installed!" >&3
-    echo "               To compile this project install" >&3
-    echo "               or .deb users: apt-get install libxml2-dev" >&3
-    echo "               or .rpm users: yum install libxml2-devel" >&3
-  fi
-fi
-
 if test x$build_kde = xyes -o x$kparts = xyes; then
   if test x"$has_kde" = xyes; then
     echo "        KDE flags are: $KDE_CFLAGS"

=== modified file 'libcore/asobj/Makefile.am'
--- a/libcore/asobj/Makefile.am 2008-10-30 16:46:00 +0000
+++ b/libcore/asobj/Makefile.am 2008-11-18 09:29:12 +0000
@@ -73,7 +73,6 @@
        MovieClipLoader.cpp\
        String_as.cpp \
        XML_as.cpp \
-       xmlattrs.cpp \
        XMLNode_as.cpp \
        XMLSocket_as.cpp \
        flash/display/BitmapData_as.cpp \

=== modified file 'libcore/asobj/XMLNode_as.cpp'
--- a/libcore/asobj/XMLNode_as.cpp      2008-10-23 09:18:06 +0000
+++ b/libcore/asobj/XMLNode_as.cpp      2008-11-18 09:29:12 +0000
@@ -22,26 +22,17 @@
 #include "builtin_function.h"
 #include "array.h" // for childNodes
 #include "XMLNode_as.h"
+#include "XML_as.h" // escape / unescape
 #include "log.h"
 #include "Object.h" // for getObjectInterface
-#include "VM.h" // for getting the string_table..
-#include "string_table.h" // ..for using the string_table
-
-#include <boost/algorithm/string/case_conv.hpp>
+#include "VM.h" // for getting the string_table.
+#include "string_table.h" 
 
 #include <string>
 #include <sstream>
 #include <vector>
 #include <algorithm>
 
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-#include <libxml/xmlreader.h>
-
 //#define DEBUG_MEMORY_ALLOCATION 1
 
 namespace gnash {
@@ -76,7 +67,7 @@
     :
     as_object(getXMLNodeInterface()),
     _parent(0),
-    _type(tElement)
+    _type(Element)
 {
     //log_debug("%s: %p", __PRETTY_FUNCTION__, this);
 #ifdef DEBUG_MEMORY_ALLOCATION
@@ -280,8 +271,9 @@
 
 
 #ifdef GNASH_DEBUG
-    log_debug(_("Stringifying node %p with name %s, as_value %s, %u attributes 
and %u children"),
-                    (void*)&xml, nodename, node_value, xml._attributes.size(), 
xml._children.size());
+    log_debug(_("Stringifying node %p with name %s, as_value %s, %u "
+                "attributes and %u children"), (void*)&xml, nodename,
+            node_value, xml._attributes.size(), xml._children.size());
 #endif
 
     // Create the beginning of the tag
@@ -312,9 +304,14 @@
     }
 
     // Node as_value first, then children
-    if ( type == tText )
+    if ( type == Text )
     {
-           encode ? xmlout << URL::encode(node_value) : xmlout << node_value;
+        // Insert entities.
+        std::string escaped(node_value);
+        XML_as::escape(escaped);
+        if (encode) URL::encode(escaped);
+
+           xmlout << escaped;
     }
 
     // Childs, after node as_value.
@@ -338,29 +335,41 @@
     const int noFlags = 0;
     
     // No prop flags:
-    o.init_member("appendChild", new builtin_function(XMLNode_appendchild), 
noFlags);
-    o.init_member("cloneNode", new builtin_function(XMLNode_clonenode), 
noFlags);
-    o.init_member("hasChildNodes", new 
builtin_function(XMLNode_haschildnodes), noFlags);
-    o.init_member("insertBefore", new builtin_function(XMLNode_insertbefore), 
noFlags);
-    o.init_member("removeNode", new builtin_function(XMLNode_removenode), 
noFlags);
+    o.init_member("appendChild", new builtin_function(
+                XMLNode_appendchild), noFlags);
+    o.init_member("cloneNode", new builtin_function(
+                XMLNode_clonenode), noFlags);
+    o.init_member("hasChildNodes", new builtin_function(
+                XMLNode_haschildnodes), noFlags);
+    o.init_member("insertBefore", new builtin_function(
+                XMLNode_insertbefore), noFlags);
+    o.init_member("removeNode", new builtin_function(
+                XMLNode_removenode), noFlags);
     o.init_member("toString", new builtin_function(XMLNode_tostring), noFlags);
-    o.init_member("getPrefixForNamespace", new 
builtin_function(XMLNode_getPrefixForNamespace), noFlags);
-    o.init_member("getNamespaceForPrefix", new 
builtin_function(XMLNode_getNamespaceForPrefix), noFlags);
+    o.init_member("getPrefixForNamespace", new builtin_function(
+                XMLNode_getPrefixForNamespace), noFlags);
+    o.init_member("getNamespaceForPrefix", new builtin_function(
+                XMLNode_getNamespaceForPrefix), noFlags);
 
 
     const int protectedFlags = as_prop_flags::isProtected;
 
     // Just the protected flag:
-    o.init_property("nodeValue", &XMLNode_node_value, &XMLNode_node_value, 
protectedFlags);
-    o.init_property("nodeName", &XMLNode_nodename, &XMLNode_nodename, 
protectedFlags);
+    o.init_property("nodeValue", &XMLNode_node_value, 
+            &XMLNode_node_value, protectedFlags);
+    o.init_property("nodeName", &XMLNode_nodename, 
+            &XMLNode_nodename, protectedFlags);
 
     o.init_readonly_property("firstChild", &XMLNode_firstchild, 
protectedFlags);
     o.init_readonly_property("lastChild", &XMLNode_lastchild, protectedFlags);
     o.init_readonly_property("localName", &XMLNode_localName, protectedFlags);
-    o.init_readonly_property("namespaceURI", &XMLNode_namespaceURI, 
protectedFlags);
-    o.init_readonly_property("nextSibling", &XMLNode_nextsibling, 
protectedFlags);
+    o.init_readonly_property("namespaceURI", 
+            &XMLNode_namespaceURI, protectedFlags);
+    o.init_readonly_property("nextSibling", 
+            &XMLNode_nextsibling, protectedFlags);
     o.init_readonly_property("prefix", &XMLNode_prefix, protectedFlags);
-    o.init_readonly_property("previousSibling", &XMLNode_previoussibling, 
protectedFlags);
+    o.init_readonly_property("previousSibling", 
+            &XMLNode_previoussibling, protectedFlags);
     o.init_readonly_property("nodeType", &XMLNode_nodetype, protectedFlags);
     o.init_readonly_property("attributes", &XMLNode_attributes, 
protectedFlags);
     o.init_readonly_property("childNodes", &XMLNode_childNodes, 
protectedFlags);

=== modified file 'libcore/asobj/XMLNode_as.h'
--- a/libcore/asobj/XMLNode_as.h        2008-10-19 19:36:12 +0000
+++ b/libcore/asobj/XMLNode_as.h        2008-11-18 09:42:06 +0000
@@ -26,10 +26,6 @@
 #include "xmlattrs.h"
 #include "log.h"
 
-#include <libxml/xmlmemory.h>
-#include <libxml/parser.h>
-#include <libxml/xmlreader.h>
-
 #include <list>
 #include <vector>
 #include <string>
@@ -46,45 +42,45 @@
 {
 public:
 
-    typedef enum {
+    enum NodeType {
 
         /// Element
-        tElement = 1,
+        Element = 1,
 
         /// Attribute
-        tAttribute = 2,
+        Attribute = 2,
 
         /// Text
-        tText = 3,
+        Text = 3,
 
         /// CDATA section 
-        tCdata = 4,
+        Cdata = 4,
 
         /// Entity reference
-        tEntityRef = 5,
+        EntityRef = 5,
         
         /// Entity
-        tEntity = 6,
+        Entity = 6,
         
         /// Processing instruction
-        tProcInstr = 7,
+        ProcInstr = 7,
                 
         /// Comment
-        tComment = 8,
+        Comment = 8,
 
         /// Document
-        tDocument = 9,
+        Document = 9,
 
         /// Document type
-        tDocType = 10,
+        DocType = 10,
 
         /// Document fragment
-        tDocFgarment = 11,
+        DocFragment = 11,
 
         /// Notation
-        tNotation = 12
+        Notation = 12
 
-    } NodeType;
+    };
 
     XMLNode();
 
@@ -116,7 +112,8 @@
     void nodeValueSet(const std::string& value) { _value = value; }
     //  nodeType       XML.nodeType
 
-    ///  Returns true if the specified node has child nodes; otherwise, 
returns false.
+    ///  Returns true if the specified node has child nodes; otherwise,
+    ///  returns false.
     bool hasChildNodes();
 
     boost::intrusive_ptr<XMLNode> firstChild();

=== modified file 'libcore/asobj/XML_as.cpp'
--- a/libcore/asobj/XML_as.cpp  2008-10-23 18:27:11 +0000
+++ b/libcore/asobj/XML_as.cpp  2008-11-18 09:48:27 +0000
@@ -17,6 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
+// The XML parsing algorithms are based on swfdec's parsing model.
 
 #ifdef HAVE_CONFIG_H
 #include "gnashconfig.h"
@@ -34,15 +35,14 @@
 #include "VM.h"
 #include "namedStrings.h"
 #include "array.h"
+#include "StringPredicates.h"
 
-#include <libxml/xmlmemory.h>
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-#include <libxml/xmlreader.h>
 #include <string>
 #include <sstream>
 #include <vector>
-#include <boost/algorithm/string/case_conv.hpp>
+#include <algorithm>
+#include <boost/assign/list_of.hpp>
+#include <boost/algorithm/string/compare.hpp>
 
 
 namespace gnash {
@@ -54,25 +54,34 @@
 
 // Define this to enable verbosity of XML parsing
 //#define DEBUG_XML_PARSE 1
-
-static as_object* getXMLInterface();
-static void attachXMLInterface(as_object& o);
-static void attachXMLProperties(as_object& o);
-
-static as_value xml_new(const fn_call& fn);
-static as_value xml_createelement(const fn_call& fn);
-static as_value xml_createtextnode(const fn_call& fn);
-static as_value xml_getbytesloaded(const fn_call& fn);
-static as_value xml_getbytestotal(const fn_call& fn);
-static as_value xml_parsexml(const fn_call& fn);
-static as_value xml_ondata(const fn_call& fn);
-
+// Forward declarations.
+namespace {
+    as_object* getXMLInterface();
+    void attachXMLInterface(as_object& o);
+    void attachXMLProperties(as_object& o);
+
+    as_value xml_new(const fn_call& fn);
+    as_value xml_createelement(const fn_call& fn);
+    as_value xml_createtextnode(const fn_call& fn);
+    as_value xml_getbytesloaded(const fn_call& fn);
+    as_value xml_getbytestotal(const fn_call& fn);
+    as_value xml_parsexml(const fn_call& fn);
+    as_value xml_ondata(const fn_call& fn);
+
+    bool textAfterWhitespace(const std::string& xml,
+            std::string::const_iterator& it);
+    bool textMatch(const std::string& xml, std::string::const_iterator& it,
+            const std::string& match);
+    bool parseNodeWithTerminator(const std::string& xml,
+            std::string::const_iterator& it, const std::string& terminator,
+            std::string& content);
+}
 
 XML_as::XML_as() 
     :
     as_object(getXMLInterface()),
     _loaded(-1), 
-    _status(sOK)
+    _status(XML_OK)
 {
 #ifdef DEBUG_MEMORY_ALLOCATION
     log_debug(_("Creating XML data at %p"), this);
@@ -82,36 +91,77 @@
 }
 
 
-// Parse the ASCII XML string into memory
-XML_as::XML_as(const std::string& xml_in)
+// Parse the ASCII XML string into an XMLNode tree
+XML_as::XML_as(const std::string& xml)
     :
     as_object(getXMLInterface()),
     _loaded(-1), 
-    _status(sOK)
+    _status(XML_OK)
 {
 #ifdef DEBUG_MEMORY_ALLOCATION
     log_debug(_("Creating XML data at %p"), this);
 #endif
 
-    parseXML(xml_in);
+    parseXML(xml);
+}
+
+const XML_as::Entities&
+XML_as::getEntities()
+{
+
+    static Entities entities = boost::assign::map_list_of
+        ("&amp;", "&")
+        ("&apos;", "\"")
+        ("&lt;", "<")
+        ("&gt;", ">")
+        ("&quot;", "'");
+
+    return entities;
+
+}
+
+void
+XML_as::escape(std::string& text)
+{
+    const Entities& ent = getEntities();
+
+    for (Entities::const_iterator i = ent.begin(), e = ent.end();
+            i != e; ++i)
+    {
+        boost::replace_all(text, i->second, i->first);
+    }
+}
+
+void
+XML_as::unescape(std::string& text)
+{
+    const Entities& ent = getEntities();
+
+    for (Entities::const_iterator i = ent.begin(), e = ent.end();
+            i != e; ++i)
+    {
+        boost::replace_all(text, i->first, i->second);
+    }
+
 }
 
 bool
-XML_as::get_member(string_table::key name, as_value *val, string_table::key 
nsname)
+XML_as::get_member(string_table::key name, as_value *val,
+        string_table::key nsname)
 {
-        if (name == NSV::PROP_STATUS) 
-        {
-                val->set_int(_status);
-                return true;
-        }
-        else if (name == NSV::PROP_LOADED)
-        {
-                if ( _loaded < 0 ) val->set_undefined();
-                else val->set_bool(_loaded);
-                return true;
-        }
+    if (name == NSV::PROP_STATUS) 
+    {
+        val->set_int(_status);
+        return true;
+    }
+    else if (name == NSV::PROP_LOADED)
+    {
+        if ( _loaded < 0 ) val->set_undefined();
+        else val->set_bool(_loaded);
+        return true;
+    }
 
-        return as_object::get_member(name, val, nsname);
+    return as_object::get_member(name, val, nsname);
 }
 
 bool
@@ -123,7 +173,8 @@
         // TODO: this should really be a proper property (see XML.as)
         if ( ! val.is_number() )
         {
-            _status = 
static_cast<ParseStatus>(std::numeric_limits<boost::int32_t>::min());
+            _status = static_cast<ParseStatus>(
+                    std::numeric_limits<boost::int32_t>::min());
         }
         else
         {
@@ -136,7 +187,6 @@
     {
         // TODO: this should really be a proper property
         bool b = val.to_bool();
-        //log_debug(_("set_member 'loaded' (%s) became boolean %d"), val, b);
         if ( b ) _loaded = 1;
         else _loaded = 0;
         return true;
@@ -145,181 +195,310 @@
     return as_object::set_member(name, val, nsname, ifFound);
 }
 
-bool
-XML_as::extractNode(XMLNode& element, xmlNodePtr node, bool mem)
-{
-    xmlAttrPtr attr;
-    xmlChar *ptr = NULL;
-    boost::intrusive_ptr<XMLNode> child;
-
-#ifdef DEBUG_XML_PARSE
-    log_debug(_("%s: extracting node %s"), __FUNCTION__, node->name);
-#endif
-
-    // See if we have any Attributes (properties)
-    attr = node->properties;
-    while (attr != NULL)
-    {
-#ifdef DEBUG_XML_PARSE
-        log_debug(_("extractNode %s has property %s, value is %s"),
-                  node->name, attr->name, attr->children->content);
-#endif
-        
-        std::ostringstream name, content;
-
-        name << attr->name;
-        content << attr->children->content;
-        
-        XMLAttr attrib(name.str(), content.str());
-
-#ifdef DEBUG_XML_PARSE
-        log_debug(_("\tPushing attribute %s for element %s has value %s, next 
attribute is %p"),
-                attr->name, node->name, attr->children->content, attr->next);
-#endif
-
-        element._attributes.push_back(attrib);
-        attr = attr->next;
-    }
-    if (node->type == XML_COMMENT_NODE)
-    {
-        // Comments apparently not handled until AS3
-        // Comments in a text node are a *sibling* of the text node
-        // for libxml2.
-        return false;
-    }
-    else if (node->type == XML_ELEMENT_NODE)
-    {
-            element.nodeTypeSet(tElement);
-
-            std::ostringstream name;
-            name << node->name;
-            element.nodeNameSet(name.str());
-    }
-    else if ( node->type == XML_TEXT_NODE )
-    {
-            element.nodeTypeSet(tText);
-
-            ptr = xmlNodeGetContent(node);
-            if (ptr == NULL) return false;
-        if (node->content)
-        {
-        std::ostringstream in;
-        in << ptr;
-        // XML_PARSE_NOBLANKS seems not to be working, so here's
-        // a custom implementation of it.
-        if ( ignoreWhite() )
-        {
-            if ( in.str().find_first_not_of(" \n\t\r") == std::string::npos )
-            {
-#ifdef DEBUG_XML_PARSE
-                log_debug("Text node value consists in blanks only, 
discarding");
-#endif
-                xmlFree(ptr);
-                return false;
+void
+XML_as::parseAttribute(XMLNode* node, const std::string& xml,
+        std::string::const_iterator& it)
+{
+
+    const std::string terminators("\r\t\n >=");
+
+    std::string::const_iterator end = std::find_first_of(it, xml.end(),
+            terminators.begin(), terminators.end());
+
+    if (end == xml.end()) {
+        _status = XML_UNTERMINATED_ELEMENT;
+        return;
+    }
+    std::string name(it, end);
+
+    // Point iterator to the character after the name.
+    it = end;
+
+    // Skip any whitespace before the '='. If we reach the end of the string
+    // or don't find an '=', it's a parser error.
+    if (!textAfterWhitespace(xml, it) || *it != '=') {
+        _status = XML_UNTERMINATED_ELEMENT;
+        return;
+    }
+
+    // Point to the character after the '='
+    ++it;
+
+    // Skip any whitespace. If we reach the end of the string, or don't find
+    // a " or ', it's a parser error.
+    if (!textAfterWhitespace(xml, it) || (*it != '"' && *it != '\'')) {
+        _status = XML_UNTERMINATED_ELEMENT;
+        return;
+    }
+
+    // Find the end of the attribute, looking for the opening character,
+    // as long as it's not escaped. We begin one after the present position,
+    // which should be the opening character. We want to remember what the
+    // iterator is pointing to for a while, so don't advance it.
+    end = it;
+    do {
+        ++end;
+        end = std::find(end, xml.end(), *it);
+    } while (end != xml.end() && *(end - 1) == '\'');
+
+    if (end == xml.end()) {
+        _status = XML_UNTERMINATED_ATTRIBUTE;
+        return;
+    }
+    ++it;
+
+    std::string value(it, end);
+    //log_debug("adding attribute to node %s: %s, %s", node->nodeName(),
+    //        name, value);
+
+    // We've already checked that end != xml.end(), so we can advance at 
+    // least once.
+    it = end;
+    // Advance past the last attribute character
+    ++it;
+
+    // Replace entities in the value.
+    escape(value);
+
+    XMLAttr attr(name, value);
+    node->_attributes.push_back(attr);
+
+}
+
+void
+XML_as::parseDocTypeDecl(XMLNode* /*node*/, const std::string& xml,
+    std::string::const_iterator& it)
+{
+    std::string content;
+    parseNodeWithTerminator(xml, it, ">", content);
+}
+
+void
+XML_as::parseXMLDecl(XMLNode* /*node*/, const std::string& xml,
+    std::string::const_iterator& it)
+{
+    std::string content;
+    parseNodeWithTerminator(xml, it, "?>", content);
+
+    // Handle content.
+}
+
+// The iterator should be pointing to the first char after the '<'
+void
+XML_as::parseTag(XMLNode*& node, const std::string& xml,
+    std::string::const_iterator& it)
+{
+    //log_debug("Processing node: %s", node->nodeName());
+
+    bool closing = (*it == '/');
+    if (closing) ++it;
+
+    // These are for terminating the tag name, not (necessarily) the tag.
+    const std::string terminators("\r\n\t >");
+
+    std::string::const_iterator endName = std::find_first_of(it, xml.end(),
+            terminators.begin(), terminators.end());
+
+    // Check that one of the terminators was found; otherwise it's malformed.
+    if (endName == xml.end()) {
+        _status = XML_UNTERMINATED_ELEMENT;
+        return;
+    }
+
+    // Knock off the "/>" of a self-closing tag.
+    if (std::equal(endName - 1, endName + 1, "/>")) {
+        //log_debug("self-closing tag");
+        --endName;
+    }
+
+    std::string tagName(it, endName);
+    //log_debug("tagName : %s", tagName);
+
+    if (!closing) {
+
+        XMLNode* childNode = new XMLNode;
+        childNode->nodeNameSet(tagName);
+        childNode->nodeTypeSet(Element);
+
+        log_debug("created childNode with name %s", childNode->nodeName());
+        // Skip to the end of any whitespace after the tag name
+        it = endName;
+
+        if (!textAfterWhitespace(xml, it)) {
+            _status = XML_UNTERMINATED_ELEMENT;
+           return;
+        }
+
+        // Parse any attributes in an opening tag only, stopping at "/>" or
+        // '>'
+        while (it != xml.end() && *it != '>' && _status == XML_OK)
+        {
+            if (xml.end() - it > 1 && std::equal(it, it + 2, "/>")) break;
+
+            // This advances the iterator
+            parseAttribute(childNode, xml, it);
+
+            // Skip any whitespace. If we reach the end of the string,
+            // it's malformed.
+            if (!textAfterWhitespace(xml, it)) {
+                _status = XML_UNTERMINATED_ELEMENT;
+                return;
             }
         }
-        element.nodeValueSet(in.str());
-        }
-            xmlFree(ptr);
-    }
-
-    // See if we have any data (content)
-    xmlNodePtr childnode = node->children;
-
-    while (childnode)
-    {
-        child = new XMLNode();
-        child->setParent(&element);
-        if ( extractNode(*child, childnode, mem) )
-        {
-            element._children.push_back(child);
-        }
-        childnode = childnode->next;
-    }
-
-    return true;
-}
-
-/*private*/
-bool
-XML_as::parseDoc(xmlNodePtr cur, bool mem)
-{
-    GNASH_REPORT_FUNCTION;  
-
-    while (cur)
-    {
-        boost::intrusive_ptr<XMLNode> child = new XMLNode();
-        child->setParent(this);
-#ifdef DEBUG_XML_PARSE
-        log_debug("\tParsing top-level node %s", cur->name);
-#endif
-        if ( extractNode(*child, cur, mem) ) 
-        {
-                _children.push_back(child);
-        }
-        cur = cur->next;
-    }  
-
-    return true;
-}
-
-// This parses an XML string into a
-// tree which can be walked through later.
-bool
-XML_as::parseXML(const std::string& xml_in)
-{
-
-    if (xml_in.empty())
+
+        node->appendChild(childNode);
+        if (*it == '/') ++it;
+        else node = childNode;
+
+        if (*it == '>') ++it;
+
+        return;
+    }
+
+    // This may be xml.end(), which is okay.
+    it = std::find(endName, xml.end(), '>');
+
+    if (it == xml.end())
+    {
+       _status = XML_UNTERMINATED_ELEMENT;
+       return;
+    }
+    ++it;
+
+    StringNoCaseEqual noCaseCompare;
+
+    if (node->getParent() && noCaseCompare(node->nodeName(), tagName)) {
+        node = node->getParent();
+    }
+    else {
+        // Malformed. Search for the parent node.
+        XMLNode* s = node;
+        while (s && !noCaseCompare(s->nodeName(), tagName)) {
+            //log_debug("parent: %s, this: %s", s->nodeName(), tagName);
+            s = s->getParent();
+        }
+        if (s) {
+            // If there's a parent, the open tag is orphaned.
+            _status = XML_MISSING_CLOSE_TAG;
+        }
+        else {
+            // If no parent, the close tag is orphaned.
+            _status = XML_MISSING_OPEN_TAG;
+        }
+    }
+
+}
+
+void
+XML_as::parseText(XMLNode* node, const std::string& xml, 
+        std::string::const_iterator& it)
+{
+    std::string::const_iterator end = std::find(it, xml.end(), '<');
+    std::string content(it, end);
+    
+    it = end;
+
+    if (ignoreWhite() && 
+        content.find_first_not_of("\t\r\n ") == std::string::npos) return;
+
+    XMLNode* childNode = new XMLNode;
+
+    childNode->nodeTypeSet(XMLNode::Text);
+
+    // Replace any entitites.
+    unescape(content);
+
+    childNode->nodeValueSet(content);
+    node->appendChild(childNode);
+
+    //log_debug("appended text node: %s", content);
+}
+
+
+
+void
+XML_as::parseComment(XMLNode* /*node*/, const std::string& xml, 
+        std::string::const_iterator& it)
+{
+    log_debug("discarding comment node");
+
+    std::string content;
+
+    if (!parseNodeWithTerminator(xml, it, "-->", content)) {
+        _status = XML_UNTERMINATED_COMMENT;
+        return;
+    }
+    // Comments are discarded at least up to SWF8
+    
+}
+
+void
+XML_as::parseCData(XMLNode* node, const std::string& xml, 
+        std::string::const_iterator& it)
+{
+    std::string content;
+
+    if (!parseNodeWithTerminator(xml, it, "]]>", content)) {
+        _status = XML_UNTERMINATED_CDATA;
+        return;
+    }
+
+    XMLNode* childNode = new XMLNode;
+    childNode->nodeValueSet(content);
+    childNode->nodeTypeSet(Text);
+    node->appendChild(childNode);
+    
+}
+
+
+// This parses an XML string into a tree of XMLNodes.
+void
+XML_as::parseXML(const std::string& xml)
+{
+    GNASH_REPORT_FUNCTION; 
+    if (xml.empty())
     {
         log_error(_("XML data is empty"));
-        return false;
+        return;
     }
 
     // Clear current data
     clear(); 
+    _status = XML_OK;
     
-    initParser();
-
-    xmlNodePtr firstNode; 
-
-    xmlDocPtr doc = xmlReadMemory(xml_in.c_str(), xml_in.size(), NULL, NULL, 
getXMLOptions()); // do NOT recover here !
-    if ( doc )
-    {
-        firstNode = doc->children; // xmlDocGetRootElement(doc);
-    }
-    else
-    {
-        log_debug(_("malformed XML, trying to recover"));
-        int ret = xmlParseBalancedChunkMemoryRecover(NULL, NULL, NULL, 
-                0, (const xmlChar*)xml_in.c_str(), &firstNode, 1);
-        log_debug("xmlParseBalancedChunkMemoryRecover returned %d", ret);
-        if ( ! firstNode )
-        {
-            log_error(_("unrecoverable malformed XML "
-                        "(xmlParseBalancedChunkMemoryRecover returned "
-                        "%d)."), ret);
-            return false;
-        }
-        else
-        {
-            log_error(_("recovered malformed XML."));
-        }
-    }
-
-
-
-    bool ret = parseDoc(firstNode, true);
-
-    xmlCleanupParser();
-    if ( doc ) xmlFreeDoc(doc); // TOCHECK: can it be freed before ?
-    else if ( firstNode ) xmlFreeNodeList(firstNode);
-    xmlMemoryDump();
-
-    return ret;
+
+    std::string::const_iterator it = xml.begin();
+    XMLNode* node = this;
+
+    while (it != xml.end() && _status == XML_OK)
+    {
+        if (*it == '<')
+        {
+            ++it;
+            if (textMatch(xml, it, "!DOCTYPE"))
+            {
+                parseDocTypeDecl(node, xml, it);
+            }
+            else if (textMatch(xml, it, "?xml"))
+            {
+                parseXMLDecl(node, xml, it);
+            }
+            else if (textMatch(xml, it, "!--"))
+            {
+                parseComment(node, xml, it);
+            }
+            else if (textMatch(xml, it, "![CDATA["))
+            {
+                parseCData(node, xml, it);
+            }
+            else parseTag(node, xml, it);
+        }
+        else parseText(node, xml, it);
+    }
   
+    return;
 }
 
-
 bool
 XML_as::onLoad()
 {
@@ -329,8 +508,50 @@
 }
 
 
-
-static void
+void
+XML_as::clear()
+{
+    // TODO: should set childs's parent to NULL ?
+    _children.clear();
+
+    _attributes.clear();
+}
+
+bool
+XML_as::ignoreWhite() const
+{
+
+    string_table::key propnamekey = _vm.getStringTable().find("ignoreWhite");
+    as_value val;
+    if (!const_cast<XML_as*>(this)->get_member(propnamekey, &val)) return 
false;
+    return val.to_bool();
+}
+
+
+// extern (used by Global.cpp)
+void
+xml_class_init(as_object& global)
+{
+
+    static boost::intrusive_ptr<builtin_function> cl;
+
+    if ( cl == NULL )
+    {
+        cl=new builtin_function(&xml_new, getXMLInterface());
+    }
+    
+    global.init_member("XML", cl.get());
+
+}
+
+///
+/// XML object AS interface.
+///
+
+namespace {
+
+
+void
 attachXMLProperties(as_object& /*o*/)
 {
     // if we use a proper member here hasOwnProperty() would return true
@@ -338,7 +559,7 @@
     //o.init_member("status", as_value(XML::sOK));
 }
 
-static void
+void
 attachXMLInterface(as_object& o)
 {
     const int flags = 0;
@@ -365,7 +586,7 @@
 
 }
 
-static as_object*
+as_object*
 getXMLInterface()
 {
     static boost::intrusive_ptr<as_object> o;
@@ -426,7 +647,7 @@
 /// created XML object that represents the element. This method and
 /// the XML.createTextNode() method are the constructor methods for
 /// creating nodes for an XML object. 
-static as_value
+as_value
 xml_createelement(const fn_call& fn)
 {
     
@@ -435,7 +656,7 @@
         const std::string& text = fn.arg(0).to_string();
         XMLNode *xml_obj = new XMLNode;
         xml_obj->nodeNameSet(text);
-        xml_obj->nodeTypeSet(XMLNode::tText);
+        xml_obj->nodeTypeSet(XMLNode::Text);
 
         return as_value(xml_obj);
         
@@ -463,7 +684,7 @@
         const std::string& text = fn.arg(0).to_string();
         XMLNode* xml_obj = new XMLNode;
         xml_obj->nodeValueSet(text);
-        xml_obj->nodeTypeSet(XMLNode::tText);
+        xml_obj->nodeTypeSet(XMLNode::Text);
         return as_value(xml_obj);
     }
     else {
@@ -493,7 +714,7 @@
 }
 
 
-static as_value
+as_value
 xml_parsexml(const fn_call& fn)
 {
 
@@ -514,7 +735,7 @@
 }
 
 
-static as_value
+as_value
 xml_ondata(const fn_call& fn)
 {
     GNASH_REPORT_FUNCTION;
@@ -542,78 +763,66 @@
     return as_value();
 }
 
-// extern (used by Global.cpp)
-void xml_class_init(as_object& global)
-{
-
-    static boost::intrusive_ptr<builtin_function> cl;
-
-    if ( cl == NULL )
-    {
-        cl=new builtin_function(&xml_new, getXMLInterface());
-    }
-    
-    global.init_member("XML", cl.get());
-
-}
-
-
-void
-XML_as::initParser()
-{
-    static bool initialized = false;
-    if ( ! initialized )
-    {
-        xmlInitParser();
-        //xmlGenericErrorFunc func = _xmlErrorHandler;
-        //initGenericErrorDefaultFunc(&func);
-        initialized = true;
-    }
-}
-
-void
-XML_as::clear()
-{
-    // TODO: should set childs's parent to NULL ?
-    _children.clear();
-
-    _attributes.clear();
-}
-
-/*private*/
-bool
-XML_as::ignoreWhite() const
-{
-
-    string_table::key propnamekey = _vm.getStringTable().find("ignoreWhite");
-    as_value val;
-    if (!const_cast<XML_as*>(this)->get_member(propnamekey, &val) ) return 
false;
-    return val.to_bool();
-}
-
-/*private*/
-int
-XML_as::getXMLOptions() const
-{
-    int options = XML_PARSE_NOENT
-        //| XML_PARSE_RECOVER -- don't recover now, we'll call 
xmlParseBalancedChunkRecover later
-        //| XML_PARSE_NOWARNING
-            //| XML_PARSE_NOERROR
-        | XML_PARSE_NOCDATA;
-    // Using libxml2 to convert CDATA nodes to text seems to be what is
-    // required.
-    
-    if ( ignoreWhite() )
-    {
-        // This doesn't seem to work, so the blanks skipping
-        // is actually implemented in XML::extractNode instead.
-            //log_debug("Adding XML_PARSE_NOBLANKS to options");
-            options |= XML_PARSE_NOBLANKS;
-    }
-
-    return options;
-}
-
+/// Case insenstive match of a string, returning false if there too few
+/// characters left or if there is no match. If there is a match, the
+/// iterator points to the character after the match.
+bool
+textMatch(const std::string& xml, std::string::const_iterator& it,
+        const std::string& match)
+{
+
+    const std::string::size_type len = match.length();
+    const std::string::const_iterator end = xml.end();
+
+    if (static_cast<size_t>(end - it) < len) return false;
+
+    if (!std::equal(it, it + len, match.begin(), boost::is_iequal())) {
+        return false;
+    }
+    it += len;
+    return true;
+}
+
+/// Advance past whitespace
+//
+/// @return true if there is text after the whitespace, false if we 
+///         reach the end of the string.
+bool
+textAfterWhitespace(const std::string& xml, std::string::const_iterator& it)
+{
+    const std::string whitespace("\r\t\n ");
+    while (it != xml.end() && whitespace.find(*it) != std::string::npos) ++it;
+    return (it != xml.end());
+}
+
+/// Parse a complete node up to a specified terminator.
+//
+/// @return     false if we reach the end of the text before finding the
+///             terminator.
+/// @param it   The current position of the iterator. If the return is true,
+///             this points to the first character after the terminator 
+///             after return
+/// @param content  If the return is true, this is filled with the content of
+///                 the tag.
+/// @param xml      The complete XML string.
+bool
+parseNodeWithTerminator(const std::string& xml, std::string::const_iterator& 
it,
+        const std::string& terminator, std::string& content)
+{
+    std::string::const_iterator end = std::search(it, xml.end(),
+            terminator.begin(), terminator.end());
+
+    if (end == xml.end()) {
+        return false;
+    }
+
+    content = std::string(it, end);
+    it = end + terminator.length();
+
+    return true;
+}
+
+} // anonymous namespace
 } // end of gnash namespace
 
 // Local Variables:

=== modified file 'libcore/asobj/XML_as.h'
--- a/libcore/asobj/XML_as.h    2008-10-19 19:36:12 +0000
+++ b/libcore/asobj/XML_as.h    2008-11-18 09:46:03 +0000
@@ -23,9 +23,8 @@
 #include "log.h"
 #include "dsodefs.h"
 
-#include <libxml/xmlmemory.h>
-#include <libxml/parser.h>
-#include <libxml/xmlreader.h>
+#include <map>
+#include <string>
 
 //#define DEBUG_MEMORY_ALLOCATION 1
 
@@ -42,42 +41,22 @@
 public:
 
     enum ParseStatus {
-
-            /// Parsing was successful
-            sOK = 0,
-
-            /// Unterminated CDATA section
-            sECDATA = -2,
-
-            /// Unterminated XML declaration
-            sEXMLDECL = -3,
-
-            /// Unterminated DOCTYPE declaration
-            sEDOCTYPEDECL = -4,
-
-            /// Unterminated comment
-            sECOMM = -5,
-
-            /// Malformed XML element structure
-            sESTRUCT = -6,
-
-            /// Out of memory
-            sEMEM = -7,
-
-            /// Unterminated attribute value
-            sEATTR = -8,
-
-            /// Missing close tag (orphaned open tag)
-            sEOPENTAG = -9,
-
-            /// Missing start tag (orphaned close tag)
-            sECLOSETAG = -10
-
+            XML_OK = 0,
+            XML_UNTERMINATED_CDATA = -2,
+            XML_UNTERMINATED_XML_DECL = -3,
+            XML_UNTERMINATED_DOCTYPE_DECL = -4,
+            XML_UNTERMINATED_COMMENT = -5,
+            XML_UNTERMINATED_ELEMENT = -6,
+            XML_OUT_OF_MEMORY = -7,
+            XML_UNTERMINATED_ATTRIBUTE = -8,
+            XML_MISSING_CLOSE_TAG = -9,
+            XML_MISSING_OPEN_TAG = -10
     };
 
-
     XML_as();
-    XML_as(const std::string& xml_in);
+
+    XML_as(const std::string& xml);
+
     ~XML_as() {};
 
     /// Convert the XML object to a string
@@ -108,70 +87,71 @@
 
     /// Parses an XML document into the specified XML object tree.
     //
-    /// This reads in an XML file from disk and parses into into a memory 
resident
-    /// tree which can be walked through later.
+    /// This reads in an XML file from disk and parses into into a memory
+    /// resident tree which can be walked through later.
     ///
     /// Calls to this function clear any precedently parsed data.
     ///
-    bool parseXML(const std::string& xml_in);
-
-    // An event handler that returns a
+    void parseXML(const std::string& xml);
+
+    void parseTag(XMLNode*& node, const std::string& xml, 
+            std::string::const_iterator& it);
+
+    void parseAttribute(XMLNode* node, const std::string& xml, 
+            std::string::const_iterator& it);
+
+    void parseDocTypeDecl(XMLNode* node, const std::string& xml, 
+            std::string::const_iterator& it);
+
+    void parseText(XMLNode* node, const std::string& xml, 
+            std::string::const_iterator& it);
+
+    void parseXMLDecl(XMLNode* node, const std::string& xml, 
+            std::string::const_iterator& it);
+
+    void parseComment(XMLNode* node, const std::string& xml, 
+            std::string::const_iterator& it);
+
+    void parseCData(XMLNode* node, const std::string& xml, 
+            std::string::const_iterator& it);
+ 
+    // An event handler that returns a what?
     bool onLoad();
 
-    XMLNode *processNode(xmlTextReaderPtr reader, XMLNode *node);
-
-    void change_stack_frame(int frame, gnash::as_object *xml, 
gnash::as_environment *env);
-
-    XMLNode *createElement(const char *name);
-
-    XMLNode *createTextNode(const char *name);
+    /// Escape using XML entities.
+    //
+    /// Note this is not the same as a URL escape.
+    static void escape(std::string& text);
+
+    /// Unescape XML entities.
+    //
+    /// Note this is not the same as a URL unescape.
+    static void unescape(std::string& text);
+
+    XMLNode* createElement(const std::string& name);
+
+    XMLNode* createTextNode(const std::string& name);
 
 private:
 
-    /// Remove all childs
+    typedef std::map<std::string, std::string> Entities;
+
+    static const Entities& getEntities();
+
+    /// Remove all children
     void clear();
   
     /// \brief
-    /// Return true if ignoreWhite property was set to anythign evaluating
+    /// Return true if ignoreWhite property was set to anything evaluating
     /// to true.
     bool ignoreWhite() const;
 
-    /// Return the libxml2 options to use during parsing.
-    //
-    /// The options might depend on current XML object state, like
-    /// the 'ignoreWhite' parameter.
-    ///
-    /// See http://xmlsoft.org/html/libxml-parser.html#xmlParserOption
-    ///
-    int getXMLOptions() const;
-
-    /// Read in an XML document from the specified source
-    //
-    /// This is the base method used by both parseXML() and load().
-    ///
-    bool parseDoc(xmlNodePtr startNode, bool mem);
-
     // -1 if never asked to load anything
     //  0 if asked to load but not yet loaded (or failure)
     //  1 if successfully loaded
     int _loaded;
 
     ParseStatus _status;       
-
-    /// Initialize an XMLNode from an xmlNodePtr
-    //
-    /// @param element
-    ///     The XMLNode to initialize.
-    ///
-    /// @return false if the xmlNodePtr shouldn't exist
-    /// (ie: an all-blanks node with ignoreWhite set to true).
-    ///
-    bool extractNode(XMLNode& element, xmlNodePtr node, bool mem);
-
-    void setupFrame(gnash::as_object *xml, XMLNode *data, bool src);
-  
-    /// Initialize the libxml2 parser
-    void initParser();
     
 };
 

=== removed file 'libcore/asobj/xmlattrs.cpp'
--- a/libcore/asobj/xmlattrs.cpp        2008-03-28 16:23:06 +0000
+++ b/libcore/asobj/xmlattrs.cpp        1970-01-01 00:00:00 +0000
@@ -1,51 +0,0 @@
-// 
-//   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-// 
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-//#include <sys/types.h>
-//#include <sys/stat.h>
-//#include <vector>
-
-//#include "action.h"
-//#include "impl.h"
-//#include "as_function.h"
-
-//#include "xmlattrs.h"
-
-//#ifdef DEBUG_MEMORY_ALLOCATION
-//     #include "log.h"
-//#endif
-
-//#include <unistd.h>
-//#include <libxml/xmlmemory.h>
-//#include <libxml/parser.h>
-//#include <libxml/tree.h>
-//#include <libxml/xmlreader.h>
-
-namespace gnash {
-  
-//#define DEBUG_MEMORY_ALLOCATION 1
-  
-//std::vector<as_object *> _xmlobjs;    // FIXME: hack alert
-
-
-} // end of gnash namespace
-
-
-// Local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:

=== modified file 'libcore/asobj/xmlattrs.h'
--- a/libcore/asobj/xmlattrs.h  2008-10-02 11:08:11 +0000
+++ b/libcore/asobj/xmlattrs.h  2008-11-18 09:29:12 +0000
@@ -18,21 +18,8 @@
 #ifndef GNASH_XML_ATTRS_H
 #define GNASH_XML_ATTRS_H
 
-//#define DEBUG_MEMORY_ALLOCATION 1
-#include "as_object.h" // for inheritance
-
 #include "log.h"
 
-#include <vector>
-
-#ifdef DEBUG_MEMORY_ALLOCATION
-       #include "log.h"
-#endif
-
-#include <libxml/xmlmemory.h>
-#include <libxml/parser.h>
-#include <libxml/xmlreader.h>
-
 namespace gnash {
   
 /// XML Attribute class
@@ -60,29 +47,12 @@
 
     std::string _name;
     std::string _value;
-    xmlAttributeType _type;
     
 };
 
-/// XML Attribute ActionScript Object
-class xmlattr_as_object : public as_object
-{
-public:
-    //XMLAttr obj;
-    int   padding;
-#ifdef DEBUG_MEMORY_ALLOCATION
-    xmlattr_as_object() {
-        log_debug("\t\tCreating xmlattr_as_object at %p\n", this);
-    };
-    ~xmlattr_as_object() {
-        log_debug("\tDeleting xmlattr_as_object at %p \n", this);
-    };
-#endif
-};
- 
 } // end of gnash namespace
 
-#endif // __XML_ATTRS_H__
+#endif
 
 
 // Local Variables:

=== removed file 'macros/libXML.m4'
--- a/macros/libXML.m4  2008-03-05 03:55:48 +0000
+++ b/macros/libXML.m4  1970-01-01 00:00:00 +0000
@@ -1,118 +0,0 @@
-dnl  
-dnl    Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
-dnl  
-dnl  This program is free software; you can redistribute it and/or modify
-dnl  it under the terms of the GNU General Public License as published by
-dnl  the Free Software Foundation; either version 3 of the License, or
-dnl  (at your option) any later version.
-dnl  
-dnl  This program is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl  GNU General Public License for more details.
-dnl  You should have received a copy of the GNU General Public License
-dnl  along with this program; if not, write to the Free Software
-dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-
-AC_DEFUN([GNASH_PATH_LIBXML], [
-  has_xml=no
-  dnl Look for the header
-  AC_ARG_WITH(libxml-incl, AC_HELP_STRING([--with-libxml-incl], [directory 
where libxml2 header is]), with_libxml_incl=${withval})
-  AC_CACHE_VAL(ac_cv_path_libxml_incl, [
-    if test x"${with_libxml_incl}" != x ; then
-      if test -f ${with_libxml_incl}/libxml/xmlmemory.h ; then
-        ac_cv_path_libxml_incl="-I`(cd ${with_libxml_incl}; pwd)`"
-      else
-        AC_MSG_ERROR([${with_libxml_incl} directory doesn't contain 
libxml/xmlmemory.h])
-      fi
-    fi
-  ])
-  dnl Look for the library
-  AC_ARG_WITH(libxml_lib, AC_HELP_STRING([--with-libxml-lib], [directory where 
libxml2 library is]), with_libxml_lib=${withval})
-  AC_CACHE_VAL(ac_cv_path_libxml_lib, [
-    if test x"${with_libxml_lib}" != x ; then
-      if test -f ${with_libxml_libs}/libxml2.a -o -f 
${with_libxml_lib}/libxml2.${shlibext}; then
-        ac_cv_path_libxml_lib="-L`(cd ${with_libxml_lib}; pwd)` -lxml2"
-      fi
-    fi
-  ])
-
-  if test x"${ac_cv_path_libxml_incl}" = x -o x"${ac_cv_path_libxml_lib}" = x; 
then
-    AC_PATH_PROG(XML2_CONFIG, xml2-config, ,[${pathlist}])
-    if test x"$XML2_CONFIG" != x -a x"${darwin}" = xno ; then
-      if test x"$XML2_CFLAGS" = x -a x"${ac_cv_path_libxml_incl}" = x; then
-        ac_cv_path_libxml_incl=`$XML2_CONFIG --cflags`
-      fi
-      if test x"$XML2_LIBS" = x -a x"${ac_cv_path_libxml_lib}" = x; then
-        ac_cv_path_libxml_lib=`$XML2_CONFIG --libs | sed -e 's:-L/usr/lib::'`
-      fi
-    fi
-  fi
-
-  gnash_libxml2_topdir=""
-  gnash_libxml2_version=""
-  AC_MSG_CHECKING([for libxml2 header])  
-  if test x"${ac_cv_path_libxml_incl}" = x; then
-    for i in ${incllist}; do
-      for j in `ls -dr $i/libxml2 2>/dev/null`; do
-             if test -f $j/libxml/xmlmemory.h; then
-         gnash_libxml_topdir=`basename $j`
-         gnash_libxml_version=`echo ${gnash_libxml2_topdir} | sed -e 
's:libxml2::' -e 's:-::'`
-         ac_cv_path_libxml_incl="-I$j"
-          break
-        fi
-      done
-    done
-  fi
- 
-  if test x"${ac_cv_path_libxml_incl}" = x ; then
-    AC_CHECK_HEADERS(libxml/xmlmemory.h, [ac_cv_path_libxml_incl=""])
-  fi
-
-  AC_MSG_RESULT(${ac_cv_path_libxml_incl}) 
-
-  dnl AC_MSG_CHECKING([for libxml2 library])
-  if test x"${ac_cv_path_libxml_lib}" = x ; then
-    for i in $libslist; do
-      if test -f $i/libxml2.a -o -f $i/libxml2.${shlibext}; then
-        if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
-          ac_cv_path_libxml_lib="-L$i -lxml2"
-          break
-        else
-          ac_cv_path_libxml_lib="-lxml2"
-               has_xml=yes
-          break
-        fi
-      fi
-    done
-  fi
-  if test x"${ac_cv_path_libxml_lib}" = x ; then
-    AC_CHECK_LIB(xml2, xmlInitParser, [ac_cv_path_libxml_lib="-lxml2"])
-  fi  
-
-  AC_MSG_CHECKING([for libxml2 library])
-  AC_MSG_RESULT(${ac_cv_path_libxml_lib}) 
-
-  if test x"${ac_cv_path_libxml_incl}" != x ; then
-    LIBXML_CFLAGS="${ac_cv_path_libxml_incl}"
-  else
-    LIBXML_CFLAGS=""
-  fi
-  if test x"${ac_cv_path_libxml_lib}" != x ; then
-    LIBXML_LIBS="${ac_cv_path_libxml_lib}"
-    has_xml=yes
-    AC_DEFINE(HAVE_LIBXML_H, [1], [We have libxml2 support])
-  else
-    has_xml=no
-    LIBXML_LIBS=""
-  fi
-  AC_SUBST(LIBXML_CFLAGS)
-  AC_SUBST(LIBXML_LIBS)
-])
-
-# Local Variables:
-# c-basic-offset: 2
-# tab-width: 2
-# indent-tabs-mode: nil
-# End:

=== modified file 'testsuite/actionscript.all/XML.as'
--- a/testsuite/actionscript.all/XML.as 2008-09-17 12:54:54 +0000
+++ b/testsuite/actionscript.all/XML.as 2008-11-18 09:29:12 +0000
@@ -123,6 +123,7 @@
 check(! tmp.hasOwnProperty("status"));
 xcheck(tmp.__proto__.hasOwnProperty('status') );
 
+tmp = new XML();
 check_equals(tmp.status, 0);
 tmp.status = -1;
 check_equals(tmp.status, -1);
@@ -282,7 +283,6 @@
 var xml_out = '<TOPNODE tna1="tna1val" tna2="tna2val" tna3="tna3val"><SUBNODE1 
sna1="sna1val" sna2="sna2val"><SUBSUBNODE1 ssna1="ssna1val" 
ssna2="ssna2val">sub sub1 node data 1</SUBSUBNODE1><SUBSUBNODE2>sub /sub1 
&lt;br&gt;&quot;node data 
2&quot;</SUBSUBNODE2></SUBNODE1><SUBNODE2><SUBSUBNODE1>sub sub2 node data 
1</SUBSUBNODE1><SUBSUBNODE2>sub sub2 node data 
2</SUBSUBNODE2></SUBNODE2></TOPNODE>';
 //var xml_out = "<TOPNODE tna1=\"tna1val\" tna2=\"tna2val\" 
tna3=\"tna3val\"><SUBNODE1 sna1=\"sna1val\" sna2=\"sna2val\"><SUBSUBNODE1 
ssna1=\"ssna1val\" ssna2=\"ssna2val\">sub sub1 node data 
1</SUBSUBNODE1><SUBSUBNODE2>sub /\sub1 \<br\>\"node data 
2\"</SUBSUBNODE2></SUBNODE1><SUBNODE2><SUBSUBNODE1>sub sub2 node data 
1</SUBSUBNODE1><SUBSUBNODE2>sub sub2 node data 
2</SUBSUBNODE2></SUBNODE2></TOPNODE>";
 
-
 check(XML);
 tmp.checkParsed = function ()
 {

=== modified file 'testsuite/swfdec/PASSING'
--- a/testsuite/swfdec/PASSING  2008-11-06 14:03:09 +0000
+++ b/testsuite/swfdec/PASSING  2008-11-18 09:34:03 +0000
@@ -266,6 +266,10 @@
 crash-0.8.0-huffmann-table-6.swf:a269bc06dd35de125087b2444622f130
 crash-0.8.0-huffmann-table-7.swf:2134c93509e1fc5d2eff527e79e1ea60
 crash-0.8.0-huffmann-table-8.swf:4548f1e9d10a5cd70852c367c8f39af6
+crash-0.8.2-copyPixels-5.swf:54ff82671f1aed95c9af6812ec84a559
+crash-0.8.2-copyPixels-6.swf:b683c00022ef469dcd5b3d9312e1b6f6
+crash-0.8.2-copyPixels-7.swf:490a05f3e8637f23fae76fbd9ff921a7
+crash-0.8.2-copyPixels-8.swf:135d28bfa9d79977c26e6dd61885103c
 crash-0.8.2-gotoAndPlay-5.swf:8b4ebc57963ce4c0b8c80a1ba79a2ed0
 crash-0.8.2-gotoAndPlay-6.swf:808289d1821d14debfaea5aca5f14273
 crash-0.8.2-gotoAndPlay-7.swf:434c0a520e86655e14ac3767cb745dbc
@@ -1166,6 +1170,9 @@
 with-prototypes-5.swf:4fbad4d181fef388e50d993d61c16917
 with-prototypes-6.swf:6b9dcb482fe520cbc9dc4a8456688905
 with-prototypes-7.swf:20f1f3b8905c8a3f3a61cb18e7e59e76
+xml-cdata-6.swf:d7559375e07591033d7739671a8c4d42
+xml-cdata-7.swf:5e51dafbe7f6af8206041ecabf0016f8
+xml-cdata-8.swf:d5537f4fb83eaf49d615eecb89b2ae95
 xml-init-5.swf:2ba1da174f2b1958749fede5667a60c4
 xml-init-5.swf:bb54cac64e38396084a147266f7d9711
 xml-node-init-5.swf:12fd3762a2bfa787b01fc0b8abfaa492


reply via email to

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