XMLSerialize status

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

XMLSerialize status

rvj-2
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



_______________________________________________
dev-tech-xml mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xml
Reply | Threaded
Open this post in threaded view
|

Re: XMLSerialize status

Boris Zbarsky
rvj wrote:
>                 alert("markup not ready")  //    gererates meassge <tag> has
> no properties

The alert() call does?

> 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 ??????

I have no idea what this is talking about.  Setting innerHTML to the string the
XML serializer outputs should "work" (insofar as it works to parse XML as
tag-soup, etc).

Care to post a complete minimal testcase demonstrating your problem?

-Boris

_______________________________________________
dev-tech-xml mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xml
Reply | Threaded
Open this post in threaded view
|

Re: XMLSerialize status

rvj-2
Sorry it looks like its the target object thats generating the error message
because  the target document  is not ready

I seem to have found a workaround by adding a dummy timeout

    function onloadevent
    {
            // build target document using document.write
            window.frames[0].document().open
           window.frames[0].document.write(string)
            window.frames[0].document.close()
            // wait a bit
             x=setTimeout("resumeonload()",0)
    }

    function resumeonload()
    {
            // create an object document reference

       }


"Boris Zbarsky" <[hidden email]> wrote in message
news:[hidden email]...

> rvj wrote:
>>                 alert("markup not ready")  //    gererates meassge <tag>
>> has no properties
>
> The alert() call does?
>
>> 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 ??????
>
> I have no idea what this is talking about.  Setting innerHTML to the
> string the XML serializer outputs should "work" (insofar as it works to
> parse XML as tag-soup, etc).
>
> Care to post a complete minimal testcase demonstrating your problem?
>
> -Boris
>


_______________________________________________
dev-tech-xml mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xml
Reply | Threaded
Open this post in threaded view
|

Re: XMLSerialize status

Boris Zbarsky
rvj wrote:
> Sorry it looks like its the target object thats generating the error message
> because  the target document  is not ready

For what it's worth, cryptic messages with incomplete code attached are kind of
hard to follow.  I'm hoping that you weren't really expecting a response to this
one...

-Boris



_______________________________________________
dev-tech-xml mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xml