Question

I need to generate SVG from given DXF file. I try to archive that by using kabeja package. This is the code that they gave on their web page.

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import org.xml.sax.ContentHandler;

import org.kabeja.dxf.DXFDocument;
import org.kabeja.parser.DXFParseException;
import org.kabeja.parser.Parser;
import org.kabeja.parser.ParserBuilder;
import org.kabeja.svg.SVGGenerator;
import org.kabeja.xml.SAXGenerator;
 public class MyClass{
   public MyClass(){
        ...
 }
public void parseFile(String sourceFile) {

Parser parser = ParserBuilder.createDefaultParser();

try {
 parser.parse(new FileInputStream(sourceFile));

 DXFDocument doc = parser.getDocument();

     //the SVG will be emitted as SAX-Events
     //see org.xml.sax.ContentHandler for more information 

     ContentHandler myhandler = new ContentHandlerImpl();

     //the output - create first a SAXGenerator (SVG here)
 SAXGenerator generator = new SVGGenerator();

 //setup properties
 generator.setProperties(new HashMap());

 //start the output
 generator.generate(doc,myhandler);


} catch (DXFParseException e) {
     e.printStackTrace();
} catch (IOException ioe) {
     ioe.printStackTrace();
}
}
}

Hear is the code that provided by the kabeja development group on sourceforge web site. But in above code I noticed that some of the classes are missing on their new package. for example

         ContentHandler myhandler = new ContentHandlerImpl();

In this line it create contentHandlerImpl object but with new kabeja package it dosn't have that class.So because of this it doesn't generate SVG file. So could some one explain me how to archive my target by using this package.

Was it helpful?

Solution

Try to read symbol ContentHandlerImpl not found from kabeja's forum

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top