Hi,
Given some XmlObject, is it possible to dynamically rename its root XML
element?Details:
1) I have and XSD with ComplexType:<complexType name="Employee"> <element
name="salary" type="string"/></<complexType>
2) I need to create an XmlObjects, but dynamically rename its root XML tag.I
wish I could just write:XmlObject
e1=Employee.Factory.newInstance();e.setSalary("1000");e.setRootXmlTag("AAA");
// Wishful thinking - not a real code// Now e.xmlText() should be:
<AAA><salary>1000</salary></AAA>
3) I know that if the xml tag name (<AAA>) is known in advance, I can declare
an XSD Element:<element name="AAA" type="EmployeeType"/>And XmlBeans will
easily generate corresponding XmlObjects, with <AAA> root.
4) But what if the xml tag name is totally dynamic (e.g. extracted at runtime
from a user's request)? Is there any way for me to control the XML tag name?
Thanks very much.