MyContentHandlerFactory.java

import java.net.*;
public class MyContentHandlerFactory implements ContentHandlerFactory {
  public ContentHandler createContentHandler(String type) {
    System.err.println("Création du gestionnaire de contenu pour mime");
    if (type.equals("text/mytext")) return new MyTextContentHandler(); 
    return null;
    // Si type n'est pas text/mytext, utiliser un gestionnaire par défaut
  }
}