code: public static void validateXml(Node doc, InputStream schemaStream)
   throws AlipayApiException {
          try {
              Source source = new StreamSource(schemaStream);
              Schema schema = SchemaFactory.newInstance(
                      XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(source);
  
              Validator validator = schema.newValidator();
              validator.validate(new DOMSource(doc));
          } catch (SAXException e) {
              throw new AlipayApiException("XML_VALIDATE_ERROR", e);
          } catch (IOException e) {
              throw new AlipayApiException("XML_READ_ERROR", e);
          } finally {
              if (schemaStream != null) {
                  try {
                      schemaStream.close();
                  } catch (IOException e) {
                      // nothing to do
                  }
              }
          }
      }
docs: Validates the element tree context via given XML schema file.
  
  @param doc the XML document to validate
  @param schemaStream the XML schema file input stream
  @throws ApiException error occurs if validation fail