Reader xsReader = new InputStreamReader(is);
// create an instance of XML Schema marshaller
// MarshallerImpl marshaller = new MarshallerImpl(); // todo: replace XercesXsMarshaller by this
XercesXsMarshaller marshaller = new XercesXsMarshaller();
marshaller.setSchemaResolver(RESOLVER);
// we need to specify what elements are top most (roots) providing namespace URI, prefix and local name
marshaller.addRootElement(PRODUCER_NAMESPACE, "", "producer-configuration");
// declare default namespace
marshaller.declareNamespace("wpc", PRODUCER_NAMESPACE);
// add schema location by declaring xsi namespace and adding xsi:schemaLocation attribute
marshaller.declareNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
marshaller.addAttribute("xsi", "schemaLocation", "string",
PRODUCER_NAMESPACE + " http://www.jboss.org/portal/xsd/" + PRODUCER_XSD);
// create an instance of Object Model Provider
ObjectModelProvider provider = new ProducerConfigurationProvider();
marshaller.setProperty("org.jboss.xml.binding.marshalling.indent", "true");
marshaller.marshal(xsReader, provider, configuration, xmlOutput);
// close XML Schema reader
xsReader.close();
config.createNewFile();