title: How to create an XSD file using XML Data in java
body: <p>I have an XML data like</p>
  
  <pre><code>&lt;Data&gt;&lt;CustomerDetails&gt;&lt;CustomerName&gt;ABCD&lt;/CustomerName&gt;&lt;CusomerACCTNumber&gt;12121212&lt;/CusomerACCTNumber&gt;&lt;/CustomerDetails&gt;&lt;BillDetails&gt;&lt;BillTxDetails&gt;&lt;BillID&gt;121212&lt;/BillID&gt;&lt;BillDate&gt;12-May-2015&lt;/BillDate&gt;&lt;Time&gt;12:55AM&lt;/Time&gt;&lt;/BillTxDetails&gt;&lt;BillTxDetails&gt;&lt;BillID&gt;121212&lt;/BillID&gt;&lt;BillDate&gt;12-May-2015&lt;/BillDate&gt;&lt;Time&gt;5:55AM&lt;/Time&gt;&lt;/BillTxDetails&gt;&lt;/BillDetails&gt;&lt;/Data&gt;
  </code></pre>
  
  <p>how to create xsd File using java? and how to create java class (pojo/bean) for above xml data?
  I tried this way</p>
  
  <pre><code>public class CustomerDetails {
    private String CustomerName;
    private String CusomerACCTNumber; 
    // ==&gt; setters and getters
  }
  
  public class BillTxDetails {
    private String BillID;
    private String BillDate;
    private String Time;
    // ==&gt; setters and getters
  } 
  
  public static void main(String ...) {
    Class[] c = new Class[] { CustomerDetails.class,  BillTxDetails.class };
    JAXBContext jc =JAXBContext.newInstance(Data.class);
    jc.generateSchema(new SchemaOutputResolver() {
  
      @Override 
      public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException {
        StreamResult result = new StreamResult(System.out);
        result.setSystemId(suggestedFileName); 
        return result 
      }
    }); 
  }
  </code></pre>
  
  <p>But still iam not getting in XSD root element 
  Thanks</p>