users@jaxb.java.net

Setting multiple namespaces on an element tag

From: Jerald Pratt <jerpratt_at_NORTHROPGRUMMAN.COM>
Date: Wed, 05 Mar 2003 15:19:06 -0700

I'm trying to define multiple namespaces for my xml file output using JAXB. I tried using the setProperty() method of the Marshaller class along with Marshaller.JAXB_SCHEMA_LOCATION but this property only sets the xmlns:schemaLocation attribute.

What do I need to use in order to define multiple/additional namespaces to be used for an element tag? I don't really want to use the default tag definition and I want to be able to define all my namespaces at the root tag and not have them intersperse throughout the document.

For instance:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<a:aaa xmlns:a="http://www.bogus.com/aaa"
      xmlns:b="http://www.bogus.com/bbb"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <b:bbb>test</b:bbb>
</a:aaa>

Jerald Pratt