List of usage examples for org.jdom2.input.sax SAXHandler SAXHandler
public SAXHandler(final JDOMFactory factory)
SAXHandler that listens to SAX events and creates a JDOM Document. From source file:com.ardor3d.extension.model.collada.jdom.ColladaImporter.java
License:Open Source License
/** * Reads the whole Collada DOM tree from the given resource and returns its root element. Exceptions may be thrown * by underlying tools; these will be wrapped in a RuntimeException and rethrown. * /*w ww. ja v a 2 s . c o m*/ * @param resource * the ResourceSource to read the resource from * @return the Collada root element */ private Element readCollada(final ResourceSource resource, final DataCache dataCache) { try { final JDOMFactory jdomFac = new ArdorFactory(dataCache); final SAXBuilder builder = new SAXBuilder(null, new SAXHandlerFactory() { @Override public SAXHandler createSAXHandler(final JDOMFactory factory) { return new SAXHandler(jdomFac) { @Override public void startPrefixMapping(final String prefix, final String uri) throws SAXException { // Just kill what's usually done here... } }; } }, jdomFac); final Document doc = builder.build(resource.openStream()); final Element collada = doc.getRootElement(); // ColladaDOMUtil.stripNamespace(collada); return collada; } catch (final Exception e) { throw new RuntimeException("Unable to load collada resource from source: " + resource, e); } }