Code example for SAXSource

0
 
 
        NamespaceFilter xmlFilter = new NamespaceFilter(parser.getXMLReader());
        xmlFilter.setContentHandler(unmarshaller.getUnmarshallerHandler());
 
        SAXSource source = new SAXSource(xmlFilter, inputSource);
//        XMLStreamReader xmlStream = XMLINPUT_FACTORY.createXMLStreamReader(in); 
        JAXBElement<PluginArtifactType> element = unmarshaller.unmarshal(source, PluginArtifactType.class);
        PluginArtifactType plugin = element.getValue();
        return plugin;
    } 
 
    /** 
     * Loads the list of all available plugins from the specified stream 
     * (representing geronimo-plugins.xml at the specified repository). 
     */ 
    public static PluginListType loadPluginList(InputStream in) throws ParserConfigurationException, IOException, SAXException, JAXBException, XMLStreamException {
        Unmarshaller unmarshaller = PLUGIN_LIST_CONTEXT.createUnmarshaller();
        XMLStreamReader xmlStream = XMLINPUT_FACTORY.createXMLStreamReader(in);
        JAXBElement<PluginListType> element = unmarshaller.unmarshal(xmlStream, PluginListType.class);
        PluginListType pluginList = element.getValue();