code: private void validate(Source src, Result res) throws XMLStreamException {
          try {
              Validator v = schemaFactory.newSchema().newValidator();
              v.setResourceResolver(schemaFactory.getResourceResolver());
              v.validate(src, res);
          } catch (SAXException | IOException e) {
              throw new XMLStreamException(e);
          }
      }
docs: (e.g., default values) and is then used for parsing.