package org.apache.batik.test;

import org.apache.batik.swing.svg.*;
import org.apache.batik.dom.svg.SAXSVGDocumentFactory;
import org.apache.batik.util.XMLResourceDescriptor;
import org.apache.batik.util.SVGConstants;
import org.w3c.dom.*;
import org.w3c.dom.svg.SVGDocument;
import java.io.*;
import javax.swing.*;

public class DOMTest {
    public static void main(String args[]) throws Exception{
	JSVGComponent c = new JSVGComponent();
	String svgContent = "<svg width=\"400\" height=\"300\"><rect width=\"100%\" height=\"100%\" fill=\"crimson\" /><circle cx=\"50%\" cy=\"50%\" r=\"50%\" fill=\"gold\" /></svg>";
	String parser = XMLResourceDescriptor.getXMLParserClassName();
	SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
	String uri = "http://www.dummy.com/dummyURIForSVGString";
	Document doc = f.createDocument(uri, new StringReader(svgContent));
	c.setSVGDocument((SVGDocument)doc);

	JFrame fr = new JFrame();
	fr.getContentPane().add(c);
	fr.pack();
	fr.setVisible(true);
    }
}
