@@ -0,0 +1,1707 @@
+package org.jboss.loom.utils;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport javax.xml.bind.JAXBContext;%0Aimport javax.xml.bind.JAXBException;%0Aimport javax.xml.bind.Unmarshaller;%0Aimport javax.xml.parsers.DocumentBuilder;%0Aimport javax.xml.xpath.XPath;%0Aimport javax.xml.xpath.XPathConstants;%0Aimport javax.xml.xpath.XPathExpressionException;%0Aimport javax.xml.xpath.XPathFactory;%0Aimport org.jboss.loom.ex.MigrationException;%0Aimport org.slf4j.LoggerFactory;%0Aimport org.w3c.dom.Document;%0Aimport org.w3c.dom.Node;%0Aimport org.xml.sax.SAXException;%0A%0A/**%0A *%0A * @author Ondrej Zizka, ozizka at redhat.com%0A */%0Apublic class XmlUtils %7B%0A    private static final org.slf4j.Logger log = LoggerFactory.getLogger( XmlUtils.class );%0A    %0A    public static %3CT%3E T unmarshallBean( File docFile, String xpath, Class%3CT%3E cls ) throws MigrationException%7B%0A        %0A        DocumentBuilder docBuilder = Utils.createXmlDocumentBuilder();%0A        try %7B%0A            Document doc = docBuilder.parse(docFile);%0A%0A            XPath xp = XPathFactory.newInstance().newXPath();%0A            String exp = %22/deployment/bean%5B@name='BootstrapProfileFactory'%5D/property%5B@name='applicationURIs'%5D//list%5B@elementClass='java.net.URI'%5D%22;%0A            Node node = (Node) xp.evaluate(exp, doc, XPathConstants.NODE);%0A%0A            Unmarshaller unmarshaller = JAXBContext.newInstance(cls).createUnmarshaller();%0A            T bean = (T) unmarshaller.unmarshal(node);%0A            return bean;%0A        %7D%0A        catch( SAXException %7C IOException %7C XPathExpressionException %7C JAXBException ex ) %7B%0A            throw new MigrationException(%22Failed parsing bean from a XML file %22 + docFile.getPath() + %22: %22 + ex.getMessage(), ex);%0A        %7D%0A    %7D%0A    %0A%7D// class%0A

Introduce XmlUtils with unmarshallBean()