public XMLParser(final Class classToBeBound,final String[] schemas) throws XMLException {
  try {
    JAXBContext jc=JAXBContext.newInstance(classToBeBound);
    marshaller=jc.createMarshaller();
    marshaller.setSchema(XMLSchemaUtils.createSchema(schemas));
    unmarshaller=jc.createUnmarshaller();
    unmarshaller.setSchema(XMLSchemaUtils.createSchema(schemas));
  }
 catch (  JAXBException e) {
    throw new XMLException("Cannot instantiate marshaller/unmarshaller for " + classToBeBound,e);
  }
}

public XMLParser ( final Class classToBeBound , final String [ ] schemas ) throws XMLException { try { JAXBContext jc = JAXBContext . newInstance ( classToBeBound ) ; marshaller = jc . createMarshaller ( ) ; marshaller . setSchema ( XMLSchemaUtils . createSchema ( schemas ) ) ; unmarshaller = jc . createUnmarshaller ( ) ; unmarshaller . setSchema ( XMLSchemaUtils . createSchema ( schemas ) ) ; } catch ( JAXBException e ) { throw new XMLException ( "Cannot instantiate marshaller/unmarshaller for " + classToBeBound , e ) ; } }
creates the xmlparser with the given class as root and schema files for validation .
