This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes unable to generate correct xml using jaxb Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "unable to generate correct xml using jaxb" Watch "unable to generate correct xml using jaxb" New topic
Author

unable to generate correct xml using jaxb

ramesh kancherla
Ranch Hand

Joined: May 01, 2008
Posts: 124
Hi team,
I am using jaxB and jax-ws in my application.

I am calling service with request xml prepared by jaxb code.
but request xml is not generating correctly.

i have given xml schema as elementFormDefault="qualified" value.
so parent and all child elements needs to display xmlns.

like :name space "sch" is in parent and child elements




using jaxb request xml is generating with out name space "sch" in child elements




jaxb code is :





can any one please suggest me how can i generate request xml with parent and child having namespace using jaxb


Regards
Ramesh
Kamal Tripathi
Ranch Hand

Joined: Oct 02, 2008
Posts: 86
Can you post the schema also.

Although you may want to explore the concept of package-info.java related to JAXB.

Something like.



Kamal Tripathi
SCJP 1.4 90%, SCWCD5 94%, Next SCDJWS--> In Naescent stage. Researching abt exam and material itself.
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1175
Ramesh,

Very interesting discussion about it at XSD: What is elementFormDefault="qualified" for?.

Joe Kesselman said there -

"Qualified", in XML terms, means "Associated with a namespace, either by
the use of a declared prefix or via a default namespace declaration".


Regards,
Dan


William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1175
Ramesh,

It would be an interesting exercise to post the schema and the instance into a validator and see what it says.

Regards,
Dan
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: unable to generate correct xml using jaxb