Article:
  Generating an XML Document with JAXB
Subject:   JAXB1.4 | Root element of the schema is not created
Date:   2006-07-26 23:37:45
From:   Gowtham_J
Response to: JAXB 2.0

Hi Deepak, I am working on JXB1.4 to create the XML document by binding the XML schema. Everything is fine except the Root element generation. My root element is not at all created. For marshalling, i am giving the root element object. But it didnt worked. what could be the reason/reasons???
Hope you can help me to get rid of this problem.


Thanks in advance.


Gowtham J


Full Threads Newest First

Showing messages 1 through 2 of 2.

  • JAXB1.4 | Root element of the schema is not created
    2006-07-27 11:30:10  Deepak Vohra | [View]

    To marshall, we need to follow the following steps:
    1. Create a JAXBContext object and use this object to create a Marshaller object.
    2. Create an ObjectFactory object to create instances of relevant generated Java content classes.
    3. Using the ObjectFactory object, create an object tree with RootType as the root object. Populate these tree objects with relevant data using the appropriate setter methods.
    4. Create a JAXBElement<<i>RootType> object from CatalogType object. JAXBElement<<i>RootType> represents catalog element in XML document.

    RootType is the interface corresponding to the root element in schema.
    • JAXB1.4 | Root element of the schema is not created
      2006-07-27 11:32:01  Deepak Vohra | [View]

      Modify 4.

      4. Create a JAXBElement<RootType> object from RootType object. JAXBElement<RootType> represents root element in XML document.