code: private Schema createSchema(JAXBContext context) throws IOException, SAXException {
          // This is surprisingly faffy for something that has a generateSchema method! This will only produce
          // a Result object, of which a schema result is not possible but you can produce dom results that
          // can be converted into dom sources to be read by the schema factory. As you can define multiple
          // namespaces you need to have a list of these.
          final List<DOMResult> schemaDomResults = new ArrayList<DOMResult>();
  
          // First use the context to create the schema dom objects
          context.generateSchema(new SchemaOutputResolver() {
  
              @Override
              public Result createOutput(String namespaceUri, String suggestedFileName)
                              throws IOException {
                  DOMResult domResult = new DOMResult();
                  domResult.setSystemId(suggestedFileName);
                  schemaDomResults.add(domResult);
                  return domResult;
              }
          });
  
          // convert to a form that can be used by the schema factory
          DOMSource[] schemaDomSources = new DOMSource[schemaDomResults.size()];
          for (int i = 0; i < schemaDomResults.size(); i++) {
              DOMSource domSource = new DOMSource(schemaDomResults.get(i).getNode());
              schemaDomSources[i] = domSource;
          }
  
          // Finally create the schema
          Schema schema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(schemaDomSources);
          return schema;
      }
docs: This method will create a {@link Schema} from a {@link JAXBContext}.
  
  @param context The context to create the schema for
  @return The {@link Schema} for this context
  @throws IOException
  @throws SAXException