Thanks for all the suggestions as alternate to eliminate the "xmlns="" for
child level element. It is really nice to know the alternate solution. Now
I have a question arising from this, say if I set elementFormDefault as
"unqualified", why only the second level element has the null name space for
the type, i.e. xmlns="", why jaxb did not carry it through all its element
type of the schema as this format xmlns="", just to be consistent?
-----Original Message-----
From: Malachi de Aelfweald [mailto:malachid_at_temporal-wave.com]
Sent: Monday, October 20, 2003 3:48 PM
To: users_at_jaxb.dev.java.net
Subject: RE: Re: xmlns="" in direct child element.
It works quite well from my testing of it. Here's what I am doing to
help speed you along doing it yourself:
package com.temporalwave.spec;
import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
import java.util.*;
public class NSPrefixMapper
extends NamespacePrefixMapper
{
HashMap mappings;
public NSPrefixMapper()
{
mappings = new HashMap();
setDefaultMappings();
}
protected void setDefaultMappings()
{
clear();
addMapping("
http://www.temporal-wave.com/spec/dynarray",
"dyn");
addMapping("
http://www.temporal-wave.com/spec/taskman",
"tm");
addMapping("
http://www.w3.org/2001/XMLSchema-instance",
"xsi");
addMapping("
http://java.sun.com/xml/ns/jaxb", "jaxb");
}
public void addMapping(String uri, String
prefix){mappings.put(uri, prefix);}
public String getMapping(String uri){return
(String)mappings.get(uri);}
public HashMap getMappings(){return mappings;}
public void clear(){mappings.clear();}
public String getPreferredPrefix(String namespaceURI, String
suggestion, boolean requirePrefix)
{
String toReturn = getMapping(namespaceURI);
if(toReturn != null)
return toReturn;
return suggestion;
}
}
-----Original Message-----
From: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
Sent: Monday, October 20, 2003 12:33 PM
To: users_at_jaxb.dev.java.net
You could also use NamespacePrefixMapper to change how the RI assigns
prefixes. See namespace-prefix sample for details.
regards,
--
Kohsuke Kawaguchi
Sun Microsystems kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net
*****
"The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential, proprietary, and/or
privileged material. Any review, retransmission, dissemination or other use
of, or taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from all
computers.60"
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net