code: static Node select_parser(int partnum, String mime, Element instruction) {
          if (null == instruction)
              return null;
          NodeList instructions = instruction.getElementsByTagNameNS(PARSERS_NS,
                  "parse");
          Node parserNode = null;
          instructionsLoop: for (int i = 0; i < instructions.getLength(); i++) {
              Element parse = (Element) instructions.item(i);
              if (partnum != 0) {
                  String part_i = parse.getAttribute("part");
                  if (part_i.length() > 0) {
                      int n = Integer.parseInt(part_i);
                      if (n != partnum) {
                          continue;
                      }
                  }
              }
              if (mime != null) {
                  String mime_i = parse.getAttribute("mime");
                  if (mime_i.length() > 0) {
                      String[] mime_parts = mime_i.split(";\\s*");
                      if (!mime.startsWith(mime_parts[0])) {
                          continue;
                      }
                      boolean ok = true;
                      for (int j = 1; j < mime_parts.length; j++) {
                          if (mime.indexOf(mime_parts[j]) < 0) {
                              ok = false;
                              break;
                          }
                      }
                      if (!ok) {
                          continue;
                      }
                  }
              }
              NodeList children = parse.getChildNodes();
              for (int j = 0; j < children.getLength(); j++) {
                  if (children.item(j).getNodeType() == Node.ELEMENT_NODE) {
                      parserNode = children.item(j);
                      break instructionsLoop;
                  }
              }
          }
          return parserNode;
      }
docs: Selects a parser for a message part based on the part number and MIME
  format type, if supplied in instructions.
  
  @param partnum
  An integer indicating the message part number.
  @param mime
  A MIME media type.
  @param instruction
  An Element representing parser instructions.
  @return A Node containing parser info, or {@code null} if no matching
  parser is found.