Hello again groups.. found one more strange feature in 0.9.6
This code DID work in 0.9.5.3:
try {
writer = new StringWriter();
// Create a Castor Marshaller initialized with the output
stream
Marshaller marshaller = new Marshaller(writer);
// Don't include the DOCTYPE, otherwise an exception occurs
due to
//2 DOCTYPE defined in the document. The XML fragment is
included in
//an XML document containing already a DOCTYPE
marshaller.setMarshalAsDocument(false);
if
(value.getClass().getName().equalsIgnoreCase("qualified.class.name.one")
) {
marshaller.setNamespaceMapping("mynammespace","http://www.test.com/test/
webservices/one");
} else if
(value.getClass().getName().equalsIgnoreCase("qualified.class.name.two")
) {
marshaller.setNamespaceMapping("mynammespace","http://www.test.com/test/
webservices/two");
} /*else if (etc etc...) {
}*/
// Marshall the Castor object into the stream (sink)
marshaller.marshal(value);
context.writeString(writer.toString());
} catch (MarshalException me) {
This code DOES NOT work in 0.9.6:
try {
AxisContentHandler hand = new AxisContentHandler(context);
Marshaller marshaller = new Marshaller(hand);
// Don't include the DOCTYPE, otherwise an exception occurs
due to
//2 DOCTYPE defined in the document. The XML fragment is
included in
//an XML document containing already a DOCTYPE
marshaller.setMarshalAsDocument(false);
marshaller.setRootElement(name.getLocalPart());
marshaller.setSuppressXSIType(true);
// Set namespace declarations
if
(value.getClass().getName().equalsIgnoreCase("qualified.class.name.one")
) {
marshaller.setNamespaceMapping("mynammespace","http://www.test.com/test/
webservices/one");
} else if
(value.getClass().getName().equalsIgnoreCase("qualified.class.name.two")
) {
marshaller.setNamespaceMapping("mynammespace","http://www.test.com/test/
webservices/two");
} /*else if (etc etc...) {
}*/
// Marshall the Castor object into the stream (sink)
marshaller.marshal(value);
} catch (MarshalException me) {
Any suggestion !?
I want the namespace declaration to appear in top of the
qualified.class.name.one and qualified.class.name.two "objects"
in the response xml. I managed to achieve this in 0.9.5.3 with the code
above.. but I'm not able to get this to work
in 0.9.6.
Cheers,
Are T. Tysnes
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------