Thursday, June 7, 2012

Generate XmlRootElement for jaxb objects

I recently had to add XmlRootElement to a class. After using google for a while, I finally figured out a way to do it. I Updated the pom jaxb plugin to include the annotate plugin and created a mappings file that customizes the jaxb object. pom.xml:
<plugin>
    <groupid>org.jvnet.jaxb2.maven2</groupid>
    <artifactid>maven-jaxb2-plugin</artifactid>
    <configuration>
        <extension>true</extension>
        <strict>false</strict>
        <plugins>
            <plugin>
                <groupid>org/jvnet/jaxb2_commons</groupid>
                <artifactid>annotate</artifactid>
                <version>0.4.1.5</version>
            </plugin>
        </plugins>
    </configuration>
    <executions>
        <execution>
            <id>generate</id>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <bindingincludes>
                    <include>*.xjb</include>
                </bindingincludes>
                <args>
                    <arg>-Xannotate</arg>
                </args>            
            </configuration>
        </execution>
    </executions>
</plugin>
file.xjb:
<!--?xml version="1.0" encoding="UTF-8" standalone="yes"?-->
<jaxb:bindings version="2.1"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:annox="http://annox.dev.java.net"
jaxb:extensionbindingprefixes="annox">
    <jaxb:bindings schemalocation="filename.xsd" node="/xs:schema">
        <jaxb:bindings node="xs:complexType[@name='ObjectType']">
            <annox:annotate>
                <annox:annotate 
                annox:class="javax.xml.bind.annotation.XmlRootElement"
                name="access">
            </annox:annotate>
        </annox:annotate></jaxb:bindings>
    </jaxb:bindings>
</jaxb:bindings>

16 comments:

for ict 99 said...

I have read your blog its very attractive and impressive. I like it your blog.

Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

Java Online Training Java Online Training JavaEE Training in Chennai Java EE Training in Chennai

ragul ragul said...

Really you have done great job,There are may person searching about that now they will find enough resources by your post
Best Devops online Training
Online DevOps Certification Course - Gangboard

tamilsasi said...


A universal message I suppose, not giving up is the formula for success I think. Some things take longer than others to accomplish, so people must understand that they should have their eyes on the goal, and that should keep them motivated to see it out til the end.


Selenium training in Chennai
Selenium training in Bangalore
Selenium training in Pune
Selenium Online training

WUGI said...

Online casinos are perfect for spending time best casino game online online casino is very cool.

saranya said...

Impressive. Your story always bring hope and new energy. Keep up the good work.
Python training in bangalore
Python course in pune
Python training in bangalore

saranya said...

Nice information, valuable and excellent design, as share good stuff with good ideas and concepts, lots of great information and inspiration, both of which I need, thanks to offer such a helpful information here.
Python training in bangalore
Python course in pune
Python training in bangalore

Bangalore Training Academy said...

Thank you so much for the great and very beneficial stuff that you have shared with the world.

Hadoop Training in Bangalore
Hadoop Courses in Bangalore
Hadoop Classes in Bangalore
Hadoop Training Institute in Bangalore
Hadoop Course Syllabus
Best Hadoop Training
Hadoop Training Centers

Bangalore Training Academy said...

It’s really great information for becoming a better Blogger. Keep sharing, Thanks...
Big Data Analytics Training in Bangalore
Big Data Analytics Courses in Bangalore
Big Data Analytics Classes in Bangalore
Big Data Analytics Training Institute in Bangalore
Big Data Analytics Course Syllabus
Best Big Data Analytics Training
Big Data Analytics Training Centers

Bangalore Training Academy said...

Really very happy to say, your post is very interesting to read. I never stop myself to say something about it. You’re doing a great job. Keep it up...

Tableau Training in Bangalore
Tableau Courses in Bangalore
Tableau Classes in Bangalore
Tableau Training Institute in Bangalore
Tableau Course Syllabus
Best Tableau Training
Tableau Training Centers

Bangalore Training Academy said...

I think this is one of the most significant information for me. And I’m glad reading your article. Thanks for sharing!

Data Science Training in Bangalore
Data Science Courses in Bangalore
Data Science Classes in Bangalore
Data Science Training Institute in Bangalore
Data Science Course Syllabus
Best Data Science Training
Data Science Training Centers

Bangalore Training Academy said...

Very interesting, good job and thanks for sharing such a good blog. Thanks a lot…
Workday Training in Bangalore
Workday Courses in Bangalore
Workday Classes in Bangalore
Workday Training Institute in Bangalore
Workday Course Syllabus
Best Workday Training
Workday Training Centers

watson said...

Awesome,Thank you so much for sharing such an awesome blog.

sap hr courses in bangalore

sap hr classes in bangalore

sap hr training institute in bangalore

sap hr course syllabus

best sap hr training

sap hr training centers

sap hr training in bangalore

Anu said...

I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. Definitely a great post I would like to read this
DevOps Training | Certification in Chennai | DevOps Training | Certification in anna nagar | DevOps Training | Certification in omr | DevOps Training | Certification in porur | DevOps Training | Certification in tambaram | DevOps Training | Certification in velachery

Revathi said...

Good post!Thank you so much for sharing this lovely article.It was so good to read and useful to upgrade my understanding...keep on share!!!

android training in chennai

android online training in chennai

android training in bangalore

android training in hyderabad

android Training in coimbatore

android training

android online training

praveen said...

First i got a great blog .I will be interested in more similar topics. i see you got really very useful topics, i will be always checking your blog thanks.
sap training in chennai

sap training in porur

azure training in chennai

azure training in porur

cyber security course in chennai

cyber security course in porur

ethical hacking course in chennai

ethical hacking course in porur

jeni said...


A universal message I suppose, not giving up is the formula for success I think. Some things take longer than others to accomplish, so people must understand that they should have their eyes on the goal, and that should keep them motivated to see it out til the end.


Selenium training in Chennai
Selenium training in Bangalore
Selenium training in Pune
Selenium Online training