xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "tomas lin" <tomas...@hotmail.com>
Subject Re: Loading a SVG Document from a String
Date Tue, 15 Jul 2003 21:36:14 GMT
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" <tomaslin@hotmail.com>
To: "Batik Users" <batik-users@xml.apache.org>; <jlf@donnell.com>
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" <jlf@donnell.com>
> To: "'Batik Users'" <batik-users@xml.apache.org>
> 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:efayyad@netmap-us.com]
> > > 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:jlf@donnell.com]
> > > Sent: Tuesday, July 15, 2003 4:23 PM
> > > To: batik-users@xml.apache.org
> > > 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: batik-users-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: batik-users-help@xml.apache.org
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: batik-users-help@xml.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-users-help@xml.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message