hi ben,

maybe it's possible for you to try this:


        String svgStr = "<svg>bla[...]</svg>";

        InputStream is= new ByteInputStream(svgStr.getBytes());

        SVGDocument doc =SAXDocumentFactory.createSVGDocument(null, is);


but since you have no uri, it'll barf when it tries to resolve relative links (as in, for example, references to external bitmap images). if it's just plain svg grphics with no external references, you should be fine ...

.rm




csanfeb schrieb:
I've got an unusual question that I've been having a difficult time finding
an answer to...

I want to create a svg on the fly for putting onto a JFramel. Strange part
is I want to create the svg based off a string such as follows:

String theString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE svg
PUBLIC '-//W3C//DTD SVG 1.0//EN'
'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'><svg
xmlns:xlink=\"http://www.w3.org/1999/xlink\"; style=\"fill-opacity:1;
color-rendering:auto; color-interpolation:auto; text-rendering:auto;
stroke:black; stroke-linecap:square; stroke-miterlimit:10;
shape-rendering:auto; stroke-opacity:1; fill:black; stroke-dasharray:none;
font-weight:normal; stroke-width:1; font-family:&apos;Dialog&apos;;
font-style:normal; stroke-linejoin:miter; font-size:12; stroke-dashoffset:0;
image-rendering:auto;\" xmlns=\"http://www.w3.org/2000/svg\";><defs
id=\"genericDefs\" /><g><text xml:space=\"preserve\" x=\"10\" y=\"30\"
style=\"stroke:none;\">My Text...</text></g></svg>";

I figured out one way to do this,
        try {
            // Create temp file.
            File temp = File.createTempFile("pattern", ".suffix");
// Delete temp file when program exits.
            temp.deleteOnExit();
// Write to temp file
            BufferedWriter out = new BufferedWriter(new FileWriter(temp));
out.write(theString);
            out.close();
        } catch (IOException e) {

Now I am trying to figure out a way to do this without creating a temp file.
Does anybody know a way to do this?

Thanks.

Ben

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

Reply via email to