summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/kitfox/salamander/parser/SVGParser.java
blob: efdf6b900ee5ad619987a28e19422b75efefb93b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * SVGParser.java
 *
 * Created on April 11, 2007, 5:07 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.kitfox.salamander.parser;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;

/**
 *
 * @author kitfox
 */
public class SVGParser
{
    public static interface SVGParserListener
    {
        
    }
    
    /** Creates a new instance of SVGParser */
    public SVGParser()
    {
    }

    public static void parse(File source, SVGParserListener listener, boolean skipUpToDateFiles)
    {
        try
        {
            XMLReader parser;
            parser = XMLReaderFactory.createXMLReader();
            SVGParserHandler handler = new SVGParserHandler(listener);
            parser.setContentHandler(handler);

            InputSource is = new InputSource(new FileInputStream(source));
            parser.parse(is);

        }
        catch (SAXException ex)
        {
            ex.printStackTrace();
        }
        catch (IOException ex)
        {
            ex.printStackTrace();
        }
    }
}