Hi Martin,
first of all, I know there's a lot of Jira issues where you are waiting
for answers (and they will be addessed, rest assured).
Second, about your question: I am not sure I fully understand what are
trying achieve.
On 20.05.2010 10:19, [email protected] wrote:
Hello everyone,
I'm wondering if there is a way to modify the xml-name of a top-level
class programmatically? My current solution works like this:
Can I take it that you have come across:
http://castor.org/javadoc/org/exolab/castor/xml/Marshaller.html#setRootElement(java.lang.String)
This method allows you to set the name of the XML root element in your
document.
If I am misunderstanding you completely, please let me know.
Regards
Werner
((XMLClassDescriptorImpl)this.marshaller.getResolver().resolve(marshalle
rTarget.getClass())).setXMLName("myCustomXMLName");
this.marshaller.marshal(marshallerTarget);
...
As you already may have noticed the problem with the above solution is
the unchecked cast to XMLClassDescriptorImpl as it is not guaranteed
that the resolve-method
returns an object of this type. For example if I pass an object of type
String to the resolve-method I get a StringClassDescriptor. In general
it would be interesting if there is a possibility to
modify the mapping-information (i.e. the state of the descriptors in
memory) at runtime without having to do conditional castings by using
instanceof-checks to get the appropriate descriptor.
Thanks in advance,
Best regards,
Martin
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email