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 ) ) );
    }



----- Original Message -----
From: "tomas lin" <[EMAIL PROTECTED]>
To: "Batik Users" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, July 15, 2003 5:21 PM
Subject: Re: Loading a SVG Document from a String


> Hi,
>
> You can use
>
> JSvgCanvas.setSVGDocument((SVGDocument) m_doc);
>
> where m_doc is a standard XML Document object.
>
> You would need to use your string as the inputSource of the XML parser,
> obtain a Document object and cast this as a SVG Document.
>
> -tomas
>
> ----- Original Message -----
> From: "Joseph Foster" <[EMAIL PROTECTED]>
> To: "'Batik Users'" <[EMAIL PROTECTED]>
> Sent: Tuesday, July 15, 2003 4:36 PM
> Subject: RE: Loading a SVG Document from a String
>
>
> > I don't think that I explained myself well enough.  I have a String
> > which is not the file name, it is the entire document, in string form.
> >
> > > -----Original Message-----
> > > From: Fayyad, Elias [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, July 15, 2003 3:36 PM
> > > To: Batik Users
> > > Subject: RE: Loading a SVG Document from a String
> > >
> > >
> > > This would do it.
> > >
> > > try {
> > >     File f = new File(stringFileName);
> > >     svgCanvas.loadSVGDocument(f.toURL().toString());
> > > }
> > > catch (IOException ex) {
> > >     ex.printStackTrace();
> > > }
> > >
> > >
> > > -----Original Message-----
> > > From: Joseph Foster [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, July 15, 2003 4:23 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Loading a SVG Document from a String
> > >
> > >
> > > Greetings,
> > >
> > > I was wondering if it is possible to have the JSVGCanvas load
> > > a SVGDocument from a String. I can see that a URL is
> > > generally specified, but this doesn't really help me since I
> > > am getting raw SVG from the database in text form.  Is this
> > > not the right tack to take?  Is there another way to create a
> > > SVGDocument that I am not realizing and just passing it a raw
> > > String to construct the document?
> > >
> > > Thanks,
> > >
> > > Joe Foster
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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