when serializing my resources on Jersey, I want to use namespaces in some cases.
Is there any way to customize the namespace prefixes on jersey?
Default:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <order xmlns:ns2="http://www.w3.org/2005/Atom"> <price>123</price> <ns2:link rel="duh" href="/abc/123"/> <ns2:link rel="abc" href="/def/234"/> </order>
I want something like:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <order xmlns:atom="http://www.w3.org/2005/Atom"> <price>123</price> <atom:link rel="duh" href="/abc/123"/> <atom:link rel="abc" href="/def/234"/> </order>
Thanks,
Lucas
If you use the MOXy JAXB implementation you can control your prefixes using the @XmlSchema package level annotation:
To use MOXy JAXB you need to have a file named jaxb.properties in with your model classes with the following entry:
For an example of using MOXy with Jersey see: