This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes Name space recurring in each element of output XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Name space recurring in each element of output XML" Watch "Name space recurring in each element of output XML" New topic
Author

Name space recurring in each element of output XML

venkat bagavathi subramanian
Greenhorn

Joined: Dec 21, 2003
Posts: 19
hi,
i am using jaxb to marshall object into xml and get the following as the output:
<ns1:tradeHeader xmlns:ns1="http://www.cognotec.com/trade/2004/v01">
<ns1:instrument>SP</ns1:instrument>
<ns1:tradeDate>2006-04-27T00:00:00</ns1:tradeDate>
<ns1:acceptDate>2006-04-27T11:13:54</ns1:acceptDate>

My question is how do i avoid getting this namespace "ns1" in each element.
Above is a sample of the entire xml. i do add in the header the namespace to which the xml has to conform to.
pl help me
thanks
venkatB
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2049
That namespace is specified in your schema.

You want to generate an xml with totally no namespace anywhere?
venkat bagavathi subramanian
Greenhorn

Joined: Dec 21, 2003
Posts: 19
yes,
only an xml with no namespace.
thanks
venkatB
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2049
(You can try remove the namespace declarations in the schema, and see if the marshalled xml is no longer namespace-qualified. It is probably the 'targetNamespace'.)

Can you post your schema here?
 
Don't get me started about those stupid light bulbs.
 
subject: Name space recurring in each element of output XML
 
Similar Threads
Removing namespace prefixes from attributes
Namespace using Axis
DOM String output is not the same as original XML
document root attributes?
Facing problem with JAXB1.0