title: how can i unmarshall in jaxb and enjoy the schema validation without using an explicit schema file
body: <p>I am using jaxb for my application configurations</p>
  
  <p>I feel like I am doing something really crooked and I am looking for a way to not need an actual file or this transaction.</p>
  
  <p>As you can see in code I:</p>
  
  <p>1.create a schema into a file from my JaxbContext (from my class annotation actually) 
  2.set this schema file in order to allow true validation when I unmarshal</p>
  
  <pre><code>JAXBContext context = JAXBContext.newInstance(clazz);
  Schema mySchema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(schemaFile);
  jaxbContext.generateSchema(new MySchemaOutputResolver()); // ultimately creates schemaFile   
  Unmarshaller u = m_context.createUnmarshaller();
  u.setSchema(mySchema);
  u.unmarshal(...);
  </code></pre>
  
  <p>do any of you know how I can validate jaxb without needing to create a schema file that sits in my computer?</p>
  
  <p>Do I need to create a schema for validation, it looks redundant when I get it by JaxbContect.generateSchema ?</p>
  
  <p>How do you do this?</p>