users@jaxb.java.net

Marshalling of values with xsd:QName simple type

From: Spock <yair.halevi_at_sundaysky.com>
Date: Wed, 6 May 2009 03:57:21 -0700 (PDT)

Hello

I have an XML schema that contains an element with type xsd:QName. When I
compile my schema, the element is mapped to a javax.xml.namespace.QName in
my Java class, which is marshalled properly with an auto generated prefix
and a matching xmlns declaration.

My problem is that I want to select a specific prefix for the marshalled
QName. I know I can use the NamespacePrefixMapper but I prefer to avoid it,
because the list of namespaces isn't that easy for me to collect in advance.

So I tried setting the prefix in the javax.xml.namespace.QName instead. The
result is different depending on how I use JAXB, and I can't seem to
understand why. Some uses of JAXB (for example, using it in a JAX-WS service
implemented using Apache CXF) use the prefix I set, while others
(marshalling it directly with JAXB) ignore the prefix and use an
auto-generated prefix (ns1,ns2,etc).

If anyone has any idea on how to make the marshaller use the prefix I set in
the QName and not an auto-generated one, I'd appreciate it.

Thanks,
Spock

-- 
View this message in context: http://www.nabble.com/Marshalling-of-values-with-xsd%3AQName-simple-type-tp23404346p23404346.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.