Provide a way to set a ContentHandler for GeometryTransformer
-------------------------------------------------------------

                 Key: GEOT-1315
                 URL: http://jira.codehaus.org/browse/GEOT-1315
             Project: GeoTools
          Issue Type: Improvement
          Components: core main
    Affects Versions: 2.4-M1
         Environment: JDK 1.5/Windows

            Reporter: Pierrick Brihaye
            Assignee: James Macgill
            Priority: Minor


Unless I'm completely dumb, I can't see a way to pass my own ContentHandler to 
a GeometryTransformer. That's why my current code looks like this :

            //YES !!!
             String gmlString = null;
                try {
                        //TODO : find a way to pass
                        //1) the SRS
                        //2) gmlPrefix
                        //3) other stuff...
                        //This will possibly require some changes in 
GeometryTransformer
                        gmlString = gmlTransformer.transform(geometry);
                } catch (TransformerException e) {
                        throw new SpatialIndexException(e);
                } 
                
                try {
                        SAXParserFactory factory = 
SAXParserFactory.newInstance();
                        factory.setNamespaceAware(true);
                        InputSource src = new InputSource(new 
StringReader(gmlString));
                        SAXParser parser = factory.newSAXParser();
                        XMLReader reader = parser.getXMLReader();
                        reader.setContentHandler((ContentHandler)receiver);
                        reader.parse(src);
                        Document doc = receiver.getDocument();
                        return doc.getDocumentElement(); 
                } catch (ParserConfigurationException e) {                      
        
                        throw new SpatialIndexException(e);
                } catch (SAXException e) {
                        throw new SpatialIndexException(e);
                } catch (IOException e) {
                        throw new SpatialIndexException(e);     
                }

Am I on the right track or is there a way to pass a ContentHandler... and to 
preserve the Geometry's srsName ?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to