 
 	        if (wrap)
 	        {
-	            markup = '<TextFlow xmlns="http://ns.adobe.com/textLayout/2008">' +
-	                     markup +
-	                     '</TextFlow>';
+	            if (markup is String)
+	            {
+                    markup = 
+                        '<TextFlow xmlns="http://ns.adobe.com/textLayout/2008">' +
+                        markup +
+                        '</TextFlow>';
+                }
+                else
+                {
+                    // It is XML.  Create a root element and add the markup
+                    // as it's child.
+                    var ns:Namespace = 
+                        new Namespace("http://ns.adobe.com/textLayout/2008");
+                                                 
+                    xmlMarkup = <TextFlow />;
+                    xmlMarkup.setNamespace(ns);            
+                    xmlMarkup.setChildren(markup);  
+                                        
+                    // The namespace of the root node is not inherited by
+                    // the children so it needs to be explicitly set on
+                    // every element, at every level.  If this is not done
+                    // the import will fail with an "Unexpected namespace"
+                    // error.
+                    for each (var element:XML in xmlMarkup..*::*)
+                       element.setNamespace(ns);
+
+                    markup = xmlMarkup;
+                }
 	        }
         }
-        
-        return TextFilter.importToFlow(markup, TextFilter.TEXT_LAYOUT_FORMAT,
-                                       staticConfiguration);
+
+        return importToFlow(markup, TextFilter.TEXT_LAYOUT_FORMAT,
+                            staticConfiguration);
     }
     
     /**

        return textFlow;
    }

    /**
     *  @private
     */

            var t:String = mx_internal::_text;
            if (t != null && t != "")
            {
                textFlow = importToFlow(t, TextFilter.PLAIN_TEXT_FORMAT);
            }
            else
            {
