Search code examples
jaxbeclipselinkmoxy

How to get the root element in Moxy


I am trying to create an xml by analyzing an xsd using Moxy. I will not be aware of how the xsd looks like. The xsd will be provided on the fly. Using Moxy I am able to load the xsd and print details of all the XmlDescriptors. My question is, how to identify the root element.

Thanks


Solution

  • Having xsd, any global type can be root element of xml document. For such global type, use method

    org.eclipse.persistence.oxm.XMLDescriptor#getDefaultRootElement
    

    to get name of root element.