It exists an another way to create a document.
The methode setURI() required an url - ok thats what we know, but you can define new 
protocoll types e.g. memory://....

Take a look at class ParsedURL and ParsedURLData (this class defines the data:// 
protocoll).
Thats seems a good starting point to build your own class.

ParsedURL provide also methods to retriefe the data and though you have ful access to 
everything.

Jan

-----Ursprüngliche Nachricht-----
Von: Joseph Foster [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 16. Juli 2003 17:34
An: 'Batik Users'
Betreff: RE: Loading a SVG Document from a String


Thanks for all your help but I still have one question, won't this
return a Document type when what I really need is a SVGDocument?  I know
that you mentioned casting the document, but it seems that an explicit
cast only throws a ClassCastException
e.g.
Document d = Util.string2Dom(xmlString);
JSVGCanvas canvas = new JSVGCanvas();
canvas.setSVGDocument((SVGDocument)d);

The above throws a class cast exception.

Is there some sort of conversion utility that I need to be using instead
of an explicit cast?

Joe Foster

> -----Original Message-----
> From: tomas lin [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, July 15, 2003 4:36 PM
> To: Batik Users; [EMAIL PROTECTED]
> Subject: Re: Loading a SVG Document from a String
> 
> 
> That last part should look something like this....
> 
>  public static Document string2Dom(String xml)
>         throws ParserConfigurationException, IOException, SAXException
>     {
>         if(db == null) {
>             DocumentBuilderFactory dbf = 
> DocumentBuilderFactory.newInstance();
>             db = dbf.newDocumentBuilder();
>         }
>         return db.parse(new InputSource(new StringReader(xml ) ) );
>     }
> 


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