users@jaxb.java.net

Re: schema and namespace

From: Brian Matzon <brian_at_matzon.dk>
Date: Wed, 17 Dec 2008 16:07:27 +0100

> Or even better one schema file per namespace?

apparently, when I use: Result r = new StreamResult(System.out); in my
SchemaOutputResolver I only ever get one schema file, even though I have
multiple packages.

I changed to writing to a ByteArrayOutputStream and storing them in a
Hashtable - 1 for each suggestedFileName.

Hashtable<String, ByteArrayOutputStream> streams = new Hashtable<String,
ByteArrayOutputStream>();

public Result createOutput(String namespaceUri, String suggestedFileName)
throws IOException {
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  Result r = new StreamResult(baos);
  r.setSystemId(suggestedFileName);
  streams.put(suggestedFileName, baos);
  return r;
}

And now I have all of the schemas! Not necessarily in the order I'd like
(schema2.xsd, schema1.xsd, schema3.xsd), but still I am a bit further now!

So, how can I specify the namespace per-package, without using
@XmlType.namespace?
JAXBIntroductions: http://www.jboss.org/community/docs/DOC-10075 ?