Hector,

You're mapping looks correct, but you'll also need to add a namespace prefix mapping on the marshaller itself to prevent the automatic prefix ("ns1") from being used.

Marshaller m = new Marshaller(myWriter);
m.setNamespaceMapping("foo", "http://www.mybusiness.org/myns";);
m.marshal(myObject);


Basically the problem is that the XML Name specified on the bind-xml element is a QName, but the namespace prefix is not saved (since theoretically namespace prefixes are not important, only the namespace is important).


So you have to respecify the prefix you want on the Marshaller.

Not convenient, but should do the trick.

--Keith





Hector Huang wrote:
Hi,

Does anyone know how I can create an XML document like
the following (with namespace "foo" only to the
"revision" attribute)?

<BusinessDocument
xmlns:foo="http://www.mybusiness.org/myns"; foo:revision="1.0">
<BusinessData>
....
</BusinessData>
</BusinessDocument>


I have tried the following but didn't work.
<bind-xml name="foo:revision"
xmlns:foo="http://www.mybusiness.org/myns";
node="attribute"/>

It creates something like this instead
<BusinessDocument
xmlns:ns1="http://www.mybusiness.org/myns"; ns1:revision="1.0">


Any feedbacks would be appriciated

Thanks
Hector



__________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com




----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user





----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user

Reply via email to