public ValidatingMarshalRecord(MarshalRecord marshalRecord, XMLMarshaller xmlMarshaller) {
   this.marshalRecord = marshalRecord;
   Schema schema = xmlMarshaller.getSchema();
   ValidatorHandler validatorHandler = schema.newValidatorHandler();
   validatorHandler.setErrorHandler(
       new ValidatingMarshalRecordErrorHandler(marshalRecord, xmlMarshaller.getErrorHandler()));
   if (xmlMarshaller.isFragment()) {
     try {
       validatorHandler.startDocument();
     } catch (SAXException e) {
     }
   }
   validatingRecord = new ContentHandlerRecord();
   validatingRecord.setMarshaller(xmlMarshaller);
   validatingRecord.setContentHandler(validatorHandler);
   validatingRecord.setEqualNamespaceResolvers(marshalRecord.hasEqualNamespaceResolvers());
 }
 @Override
 public void setMarshaller(XMLMarshaller marshaller) {
   super.setMarshaller(marshaller);
   encoder = Charset.forName(marshaller.getEncoding()).newEncoder();
 }