Aleksei Valikov wrote:
>
> Hi.
>
>> please could anyone help me with following problem?
>
> [...]
>
>> but i want the element checkRules without prefix (ns2)
>> just <checkRules>
>
> Please check this link:
>
> https://jaxb.dev.java.net/guide/Changing_prefixes.html
>
> And experiment with NamespacePrefixMapper.
>
> Bye.
> /lexi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
>
Thank you very much for the tip...
i tried to implement it this way
Marshaller m = jc.createMarshaller();
m.setProperty("com.sun.xml.internal.bind.namespacePrefixMapper",new
com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper(){
public String getPreferredPrefix(String namespaceUri, String
suggestion, boolean requirePrefix)
{
if(
"
http://pikeelectronic.com/tibco/qa/xsd".equals(namespaceUri) )
return "";
return suggestion;
}
}
);
and it doesnt work, because it is still
<qualityAssurance>
<ns2:checkRules>
.............
</ns2:checkRules>
</qualityAssurance>
i think it can only rename the prefixes
when i write
if( "
http://pikeelectronic.com/tibco/qa/xsd".equals(namespaceUri) )
return "a";
it generate ::
<qualityAssurance>
<a:checkRules>
.............
</a:checkRules>
</qualityAssurance>
--
View this message in context: http://www.nabble.com/JAXB---problem-with-prefixes-tp22058019p22059482.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.