XMLSerialize status

"rvj" <[email protected]> Sun, 13 May 2007 11:26:21 +0100
Newsgroups gmane.comp.mozilla.devel.xml
Message-ID <[email protected]>
I'm attempting to create a web pagewhich uses XMLSerialize to generate the 
the equivalent of IE's .xml property

ie gernerate a string of tags from a document object

The problem I seem to be having is that the string appears not be be ready 
when I subsequently come to use it


    function setHTML(source,target)
   {
        serial = new XMLSerializer
        markup=serial.serializeToString(source)

        alert("wait")

        try
        {
               target.innerHTML=markup
         }
        catch (e)
        {
                alert("markup not ready")  //    gererates meassge <tag> has 
no properties
        }
    }

I know I add a interval timer inside the catch() which can retry the 
assignment at intervals but I what I doubt if this should work since 
setHTML() is a function and maybe called async. ie the pervious interval 
timer is still running ??????

is there a simple or simpler work around for this ?

NB adding the alert() seems to allow enough time for the string to be 
generated