}
final OutputStream outputStream = bundle.createEntry(fileName, "text/xml");
final DefaultTagDescription tagDescription = new DefaultTagDescription(ClassicEngineBoot.getInstance().getGlobalConfig(),
PmdDataFactoryModule.TAG_DEF_PREFIX);
final XmlWriter xmlWriter = new XmlWriter(new OutputStreamWriter(outputStream, "UTF-8"), tagDescription, " ", "\n");
final AttributeList rootAttrs = new AttributeList();
rootAttrs.addNamespaceDeclaration("data", PmdDataFactoryModule.NAMESPACE);
xmlWriter.writeTag(PmdDataFactoryModule.NAMESPACE, "pmd-datasource", rootAttrs, XmlWriter.OPEN);
final PmdDataFactory pmdDataFactory = (PmdDataFactory) dataFactory;
final AttributeList configAttrs = new AttributeList();
configAttrs.setAttribute(PmdDataFactoryModule.NAMESPACE, "label-mapping", String.valueOf(pmdDataFactory.isLabelMapping()));
configAttrs.setAttribute(PmdDataFactoryModule.NAMESPACE, "domain", String.valueOf(pmdDataFactory.getDomainId()));
configAttrs.setAttribute(PmdDataFactoryModule.NAMESPACE, "xmi-file", String.valueOf(pmdDataFactory.getXmiFile()));
xmlWriter.writeTag(PmdDataFactoryModule.NAMESPACE, "config", configAttrs, XmlWriterSupport.CLOSE);
final String[] queryNames = pmdDataFactory.getQueryNames();
for (int i = 0; i < queryNames.length; i++)
{
final String queryName = queryNames[i];
final String query = pmdDataFactory.getQuery(queryName);
xmlWriter.writeTag(PmdDataFactoryModule.NAMESPACE, "query", "name", queryName, XmlWriterSupport.OPEN);
xmlWriter.writeTextNormalized(query, false);
xmlWriter.writeCloseTag();
}
xmlWriter.writeCloseTag();
xmlWriter.close();
return fileName;
}