Hi. I've looked at the document using
org.apache.xml.serialize.XMLSerializer. It looks ok.

I tried commenting out the waitForGVTB... method. And the svg was displayed
correctly. I think this is because the gvtbuild event was dispatched before
the listener was attached (I reckon building the gvt from a local
svgdocument in memory is far faster than downloading from an url, building
the svgdocument and then building the gvt).

The problem was that I attached the listener just before wait()'ing...
Problem solved. Thanks for all help :)

By the way, what is the difference between an interactive document and an
dynamic document. What different behaviour does Batik show due to the
documentstate?

Sincerely, Fredrik

-----Original Message-----
From: Thomas DeWeese [mailto:[EMAIL PROTECTED]
Sent: 21. mars 2005 02:09
To: [email protected]
Subject: Re: problem with displaying a SVGDocument


Fredrik Medby Hagen wrote:
> Hi. This method is used to get the svgdocument:
>
>     public static SVGDocument textToSVGDocument(String xmlSvg) throws
> Exception{
>         SAXSVGDocumentFactory ssdf = new
> SAXSVGDocumentFactory(XMLResourceDescriptor.getXMLParserClassName());
>         return
>
(SVGDocument)ssdf.createDocument("http:\\\\idi.ntnu.no\\~fredrhag\\test.svg"
> ,new StringReader(xmlSvg));
>     }
>
> The method returns a SVGDocument (the text is parsed and everything is
> ok...). The uri input to the createDocument is chosen at "random" since
the
> document is created from a string which has no uri. Does it matter? What
is
> the uri used for?

   It can matter, that is used as the 'base URL' for the document.
This is used when resolving external references (mostly images).

> Neither (from code below) gvtBuildSucceded/Failed or Cancelled is called.
> One of then should be called right?

    Yes in all cases one of them must be called if gvtBuildStarted
is called.  Is Build Started called?

    Also have you "looked" at the Document you get back?

>
> Sincerely, Fredrik
>
> -----Original Message-----
> From: Thomas DeWeese [mailto:[EMAIL PROTECTED]
> Sent: 20. mars 2005 23:21
> To: [email protected]
> Cc: [email protected]
> Subject: Re: problem with displaying a SVGDocument
>
>
> Hi Fredrik,
>
> Fredrik Medby Hagen wrote:
>
>
>>I tried posting this some days ago, but got no answer. I guess something
>>went wrong (had just registered for this mail-list), so I'm trying again.
>>
>>I've successfully loaded and displayed a document by calling the
>>loadSVGDocument [1] with an uri. But if trying the setSVGDocument [2] with
>
> a
>
>>SVGDocument instance, nothing happens at [3].
>>
>>gvtBuildCompleted is never called when using the setSVGDocument... Any
>>ideas?
>
>
>    Unless you have any more information not really ;)
>    How are you creating the SVG Document?   You might want to read
> the thread about 'namespace woes'.
>
>
>>Sincerely, Fredrik
>>
>>----CODE----
>>
>>[1] svgCanvas.loadSVGDocument(someValidURI);
>>[2] svgCanvas.setSVGDocument(someSVGDocument);
>>
>>[3] waitForGVTTreeBuilding();
>>
>>private void waitForGVTTreeBuilding(){
>>
>>        GVTTreeBuilderAdapter gvtba = new GVTTreeBuilderAdapter() {
>>
>>            public void gvtBuildCompleted(GVTTreeBuilderEvent evt) {
>>                synchronized(this){notify();}
>>            }
>>
>>            public void gvtBuildFailed(GVTTreeBuilderEvent evt){
>>                JOptionPane.showMessageDialog(gjf,"En feil skjedde under
>>lasting av svg. "+evt.toString(),"Feil under
>>lasting",JOptionPane.ERROR_MESSAGE);
>>            }
>>
>>            public void gvtBuildCancelled(GVTTreeBuilderEvent evt){
>>                JOptionPane.showMessageDialog(gjf,"En feil skjedde under
>>lasting av svg. "+evt.toString(),"Feil under
>>lasting",JOptionPane.ERROR_MESSAGE);
>>            }
>>
>>        };
>>
>>        svgCanvas.addGVTTreeBuilderListener(gvtba);
>>        try{synchronized(gvtba){gvtba.wait(0);}}catch(Exception
>>e){e.printStackTrace();}
>>    }
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to