title: how to use jaxb to create java objects
body: <p>I am trying to create java objects from xml file. I am using jaxb(unmarshalling) to create java objects.I am getting errors <code>javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.w3.org/2001/XMLSchema", local:"schema"). Expected elements are</code></p>
  
  <p>I did some google and found out that, we need xsd file to do that... so I converted it to xsd using apache inst2xsd tool. I am using following java code:</p>
  
  <pre><code>import java.io.FileNotFoundException;
  
  import javax.xml.bind.JAXBContext;
  import javax.xml.bind.JAXBException;
  import javax.xml.bind.UnmarshalException;
  import javax.xml.bind.Unmarshaller;
  import javax.xml.bind.annotation.XmlRootElement;
  
  @XmlRootElement(name="report")
  public class Report 
  {
      public static void main(String [] args) throws FileNotFoundException
      {
          try
          {
              JAXBContext jc = JAXBContext.newInstance(new Class[] {com.bcbsks.testjb.Report.class});             
              Unmarshaller um = jc.createUnmarshaller();          
              Report myJAXBObject = (Report)um.unmarshal(new java.io.FileInputStream("report.xsd"));
          } 
          catch( UnmarshalException ue ) 
          {    
              ue.printStackTrace(); 
          } 
          catch( JAXBException je ) 
          { 
              je.printStackTrace(); 
          } 
      }
  }
  </code></pre>
  
  <p>But I am getting fol;owing error:</p>
  
  <pre><code>javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.w3.org/2001/XMLSchema", local:"schema"). Expected elements are  (none)
  </code></pre>
  
  <p>Can you please tell me whats wrong I am doing?</p>
  
  <p>Any help is greatly appreciated.</p>