begin process at 2010 03 20 19:26:47
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Divers

 > ANALYSEUR XML GÉNÉRIQUE ET PROGRAMMATION REFLÉXIVE

ANALYSEUR XML GÉNÉRIQUE ET PROGRAMMATION REFLÉXIVE


 Information sur la source

Note :
Aucune note
Catégorie :Divers Classé sous :analyseur, xml, générique, programmation, reflexive Niveau :Initié Date de création :21/06/2007 Vu / téléchargé :5 822 / 338

Auteur : AlexN

Ecrire un message privé
Site perso
Ce membre participe au partage de revenus publicitaires
Commentaire sur cette source (4)
Ajouter un commentaire et/ou une note


 Description

Le problème était le suivant.
Pour une application, j'ai eu besoin d'un analyseur xml capable de lire trois types de fichiers contenant :

- un noyau d'informations similaires
- des informations spécifiques à chaque fichier

Début de réponse :

Faire trois classes dont deux dérivent de celle qui définit le noyau commun d'information, afin de bénéficier d'un groupe de fonctionnalités initiales

Deux solutions :

- créer trois classes et les trois analyseurs correspondants
- créer trois classes et un seul analyseur capable d'analyser les trois types de flux.

La première solution est simple mais implique des redondances de code inutiles.
La seconde solution supprime ces redondances.
Mais comment permettre à un seul analyseur de lire trois types de flux et d'associer les informations lues avec leur classes respectives avec un minimum de code, le tout en restant ouvert à de futures extensions (une quatrième classe de fichier par exemple) ?

La réponse :

- programmation générique : permet de supprimer les redondances de code.
- programmation reflexive : permet de synthétiser l'analyse et d'integrer de nouvelles classes à analyser plus facilement.

Le résultat est un analyseur xml générique bénéficiant des capacités de la programmation reflexive.

L'exemple ici utilise trois classes :

Person : une personne (nom, prenom, date de naissance)
Employee : une personne avec un emploi (fonction, salaire)
Client : une personne avec un compte client (nom du compte et date de création)

Il y a juste un problème, mais dont j'ignore la source. Eclipse ne semble pas comprendre les transtypages sur les types génériques et il rajoute des warnings sur chacune de ces opérations.
D'où les directives SuppressWarnings.
Si quelqu'un sait où est le problème, je le remercie d'avance.

Source

  • package MultiParser;
  • import java.io.File;
  • import java.io.FileInputStream;
  • import java.io.FileNotFoundException;
  • import java.io.IOException;
  • import java.lang.reflect.InvocationTargetException;
  • import java.lang.reflect.Method;
  • import java.net.MalformedURLException;
  • import java.net.URL;
  • import java.util.Date;
  • import java.util.GregorianCalendar;
  • import java.util.NoSuchElementException;
  • import java.util.Vector;
  • import org.xml.sax.Attributes;
  • import org.xml.sax.InputSource;
  • import org.xml.sax.SAXException;
  • import org.xml.sax.XMLReader;
  • import org.xml.sax.helpers.DefaultHandler;
  • import org.xml.sax.helpers.XMLReaderFactory;
  • /**
  • * Xml multiobject file parser for Person, Employee, Client class
  • * <br><br>Can parse three file structures:
  • * <ol>
  • * <li>Person file, which contains a list of Person
  • * <li>Employee file, which contains a list of Employee
  • * <li>Client file, a list of Client
  • * </ol>
  • *
  • * @author AlexN
  • *
  • */
  • public class XmlMultiParser extends DefaultHandler {
  • public enum ParsingMethod { PERSON, EMPLOYEE, CLIENT };
  • private enum NameFormat { LOWERCASE, FIRSTCAPITAL }
  • private ParsingMethod method; // parsing method to use : person, employee or client
  • private String filename; // name of file to use
  • private FileInputStream stream; // stream associated to filename
  • private Vector<? extends Person> results; // results container
  • private String value; // characters container
  • private Action action; // reference to action for each tag
  • /**
  • * default Constructor
  • *
  • * @param filename
  • * @param method
  • */
  • public XmlMultiParser(String filename, ParsingMethod method) {
  • setSource(filename, method);
  • }
  • /**
  • * Change source filename and parsing method of parser
  • *
  • * @param filename
  • * @param method
  • */
  • public void setSource(String filename, ParsingMethod method) {
  • try{
  • this.filename = filename;
  • this.method = method;
  • stream = new FileInputStream(new File(filename));
  • } catch(FileNotFoundException e){
  • System.err.println(getMethodName(NameFormat.FIRSTCAPITAL)
  • + " file not found : " + filename);
  • }
  • }
  • /**
  • * Check for a valid stream
  • *
  • * @return
  • */
  • public Boolean fileExists() { return stream != null; }
  • /**
  • * get current parsing method
  • *
  • * @return
  • */
  • public ParsingMethod getMethod() {
  • return method;
  • }
  • /**
  • * get name of parsing method using format for String response
  • *
  • * @param method
  • * @param format
  • * @return
  • */
  • public static String getMethodName(ParsingMethod method, NameFormat format) {
  • String name = method == ParsingMethod.PERSON ?
  • "Person" : method == ParsingMethod.EMPLOYEE ? "Employee" : "Client";
  • return format == NameFormat.LOWERCASE ? name.toLowerCase() : name;
  • }
  • /**
  • * get name of current parsing method using format for String response
  • *
  • * @param format
  • * @return
  • */
  • public String getMethodName(NameFormat format) {
  • return getMethodName(method, format);
  • }
  • /**
  • * add a new response object to results list
  • *
  • * @return
  • */
  • @SuppressWarnings("unchecked")
  • private void addResult() {
  • switch (method) {
  • case PERSON: ((Vector<Person>)results).add(new Person()); break;
  • case EMPLOYEE: ((Vector<Employee>)results).add(new Employee()); break;
  • case CLIENT: ((Vector<Person>)results).add(new Client()); break;
  • }
  • }
  • /**
  • * parse the current stream using current method
  • *
  • * @return
  • */
  • public Vector<? extends Person> parse () {
  • switch (method) {
  • case PERSON : results = new Vector<Person>(); break;
  • case EMPLOYEE : results = new Vector<Employee>(); break;
  • case CLIENT : results = new Vector<Client>(); break;
  • }
  • if (stream != null) try {
  • XMLReader xr = XMLReaderFactory.createXMLReader();
  • xr.setContentHandler(this);
  • xr.setErrorHandler(this);
  • xr.parse(new InputSource(stream));
  • } catch (SAXException se) {
  • System.err.println(getMethodName(NameFormat.FIRSTCAPITAL)
  • + " SAXException in file '" + filename + "' : " + se.getLocalizedMessage());
  • } catch (IOException ie) {
  • System.err.println(getMethodName(NameFormat.FIRSTCAPITAL)
  • + " IOException in file '" + filename + "' : " + ie.getLocalizedMessage());
  • }
  • if (results.size() == 0) addResult();
  • return results;
  • }
  • // Event Handlers
  • /**
  • * Called event when a start tag has been parsed
  • *
  • * clear character container
  • * add a new object to results list when parsed tag is appropriate
  • */
  • public void startElement(String uri, String localName,
  • String qName, Attributes attributes) throws SAXException {
  • value = ""; // reset characters receiver
  • if ((method == ParsingMethod.PERSON && qName.equalsIgnoreCase("person"))
  • || (method == ParsingMethod.EMPLOYEE && qName.equalsIgnoreCase("employee"))
  • || (method == ParsingMethod.CLIENT && qName.equalsIgnoreCase("client")))
  • addResult();
  • }
  • /**
  • * Called event when enclosed tag characters has been parsed
  • *
  • * Fill characters container
  • */
  • public void characters(char[] ch, int start, int length) throws SAXException {
  • value = new String(ch,start,length);
  • }
  • /**
  • * Called event when a end tag has been parsed
  • *
  • * Fill appropriate result property
  • */
  • @SuppressWarnings("unchecked")
  • public void endElement(String uri, String localName, String qName) {
  • // try to find object action associated to tag name
  • // if not find try to find qName in allowed tag for object
  • try {
  • if ((action = (Action) Action.ACTIONS.get(qName)) == null) {
  • Boolean FoundAllowedTag = false;
  • Vector<String> allowedTags = Action.TAGS.get(method);
  • for (String tag : allowedTags)
  • if (tag.equalsIgnoreCase(qName)) {
  • FoundAllowedTag = true;
  • break;
  • }
  • if (!FoundAllowedTag)
  • System.err.println(getMethodName(NameFormat.FIRSTCAPITAL)
  • + " unknown tagname : " + qName + " (ignoring this tag)");
  • return;
  • }
  • // find method to apply for last results element related to action
  • Method methodClass = action.getType().getDeclaredMethod(action.getName(), action.getClasses());
  • // parse argument of setter
  • Object argument = parseArgument(value, action, qName);
  • // apply action with argument to last results element
  • if (methodClass != null && argument != null)
  • methodClass.invoke(results.lastElement(), new Object[] {argument} );
  • } catch (SecurityException e) {
  • System.err.println(getMethodName(NameFormat.FIRSTCAPITAL)
  • + " security exception for " + qName + " tag");
  • } catch (NoSuchMethodException e) {
  • System.err.println(getMethodName(NameFormat.FIRSTCAPITAL)
  • + " invalid tag " + qName + " " + results.lastElement().getClass());
  • } catch (NoSuchElementException e) {
  • System.err.println(getMethodName(NameFormat.FIRSTCAPITAL)
  • + " invalid element " + qName);
  • } catch (IllegalArgumentException e) {
  • System.err.println(getMethodName(NameFormat.FIRSTCAPITAL)
  • + " invalid agument '"+value+"' for " + qName + " tag");
  • } catch (IllegalAccessException e) {
  • System.err.println(getMethodName(NameFormat.FIRSTCAPITAL)
  • + " illegal access for " + qName + " tag");
  • } catch (InvocationTargetException e) {
  • System.err.println(getMethodName(NameFormat.FIRSTCAPITAL)
  • + " invocation target exception for " + qName + " tag");
  • }
  • }
  • /**
  • * parse argument of setter
  • *
  • * @param value
  • * @param action
  • * @param qName
  • * @return
  • */
  • private Object parseArgument (String value, Action action, String qName) {
  • Object argument = null;
  • if (action.getClasses().length > 0)
  • // String argument, nothing to do
  • if (action.getClasses()[0] == String.class)
  • argument = value;
  • // Boolean argument
  • else if (action.getClasses()[0] == Boolean.class) {
  • if ((argument = parseBoolean()) != BOOLEAN.ERROR)
  • argument = ((BOOLEAN) argument).toBoolean();
  • else {
  • System.err.println(getMethodName(NameFormat.FIRSTCAPITAL)
  • + " invalid boolean agument '"+value+"' for " + qName + " tag");
  • }
  • // Integer argument
  • } else if (action.getClasses()[0] == Integer.class)
  • try {
  • argument = Integer.parseInt(value);
  • } catch (NumberFormatException nfe) {
  • System.err.println(getMethodName(NameFormat.FIRSTCAPITAL)
  • + " invalid integer agument '"+value+"' for " + qName + " tag");
  • }
  • // Float argument
  • else if (action.getClasses()[0] == Float.class)
  • try {
  • argument = Float.parseFloat(value);
  • } catch (NumberFormatException nfe) {
  • System.err.println(getMethodName(NameFormat.FIRSTCAPITAL)
  • + " invalid float agument '"+value+"' for " + qName + " tag");
  • }
  • // Date argument
  • else if (action.getClasses()[0] == Date.class)
  • try {
  • String[] arguments = value.split("/");
  • if (arguments.length != 3) throw new NumberFormatException();
  • GregorianCalendar gc = new GregorianCalendar (Integer.parseInt(arguments[2]),
  • Integer.parseInt(arguments[1]), Integer.parseInt(arguments[0]));
  • argument = new Date(gc.getTimeInMillis());
  • } catch (NumberFormatException nfe) {
  • System.err.println(getMethodName(NameFormat.FIRSTCAPITAL)
  • + " invalid date agument '"+value+"' for " + qName + " tag");
  • }
  • // URL argument
  • else if (action.getClasses()[0] == URL.class)
  • try {
  • argument = new URL(value);
  • } catch(MalformedURLException e){
  • System.err.println(getMethodName(NameFormat.FIRSTCAPITAL)
  • + " invalid url agument '"+value+"' for " + qName + " tag");
  • }
  • return argument;
  • }
  • // non numeric lexem parsing methods
  • private enum BOOLEAN {
  • FALSE, TRUE, ERROR;
  • Boolean toBoolean() { return this == FALSE ? false : this == TRUE ? true : false; }
  • }
  • private BOOLEAN parseBoolean() {
  • boolean isFalse = value.equalsIgnoreCase("false") || value.equals("0");
  • return (value.equalsIgnoreCase("true") || value.equals("1") || isFalse) ?
  • isFalse ? BOOLEAN.FALSE : BOOLEAN.TRUE : BOOLEAN.ERROR;
  • }
  • /**
  • * Program entry point
  • *
  • * @param args
  • */
  • @SuppressWarnings("unchecked")
  • public static void main(String[]args) {
  • XmlMultiParser parser = new XmlMultiParser("persons.xml", ParsingMethod.PERSON);
  • Vector<Person> persons = (Vector<Person>) parser.parse();
  • for (Person person : persons) person.print(true);
  • parser.setSource("employees.xml", ParsingMethod.EMPLOYEE);
  • Vector<Employee> employees = (Vector<Employee>) parser.parse();
  • for (Employee employee : employees) employee.print(true);
  • parser.setSource("clients.xml", ParsingMethod.CLIENT);
  • Vector<Client> clients = (Vector<Client>) parser.parse();
  • for (Client client : clients) client.print(true);
  • }
  • }
package MultiParser;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.NoSuchElementException;
import java.util.Vector;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.helpers.XMLReaderFactory;

/**
 * Xml multiobject file parser for Person, Employee, Client class
 * <br><br>Can parse three file structures:
 * <ol> 
 * <li>Person file, which contains a list of Person
 * <li>Employee file, which contains a list of Employee
 * <li>Client file, a list of Client
 * </ol>
 * 
 * @author AlexN
 *
 */
public class XmlMultiParser extends DefaultHandler {

	public enum ParsingMethod { PERSON, EMPLOYEE, CLIENT };
	private enum NameFormat { LOWERCASE, FIRSTCAPITAL }
	
	private ParsingMethod method; // parsing method to use : person, employee or client
	private String filename; // name of file to use
	private FileInputStream stream; // stream associated to filename
	private Vector<? extends Person> results; // results container 
	private String value; // characters container	
	private Action action; // reference to action for each tag
	
	/**
	 * default Constructor
	 * 
	 * @param filename
	 * @param method
	 */
	public XmlMultiParser(String filename, ParsingMethod method) {
		setSource(filename, method);
	}
	
	/**
	 * Change source filename and parsing method of parser 
	 * 
	 * @param filename
	 * @param method
	 */
	public void setSource(String filename, ParsingMethod method) {
		try{
			this.filename = filename;
			this.method = method;
			stream = new FileInputStream(new File(filename));
		} catch(FileNotFoundException e){
			System.err.println(getMethodName(NameFormat.FIRSTCAPITAL) 
				+ " file not found : " + filename);
		}		
	}
	
	/**
	 * Check for a valid stream 
	 * 
	 * @return
	 */
	public Boolean fileExists() { return stream != null; }
	
	/**
	 * get current parsing method
	 * 
	 * @return
	 */
	public ParsingMethod getMethod() { 
		return method;
	}
	
	/**
	 * get name of parsing method using format for String response
	 * 
	 * @param method
	 * @param format
	 * @return
	 */
	public static String getMethodName(ParsingMethod method, NameFormat format) { 
		String name =  method == ParsingMethod.PERSON ? 
				"Person" : method == ParsingMethod.EMPLOYEE ? "Employee" : "Client";
		return format == NameFormat.LOWERCASE ? name.toLowerCase() : name; 
	}
	
	/**
	 * get name of current parsing method using format for String response
	 * 
	 * @param format
	 * @return
	 */
	public String getMethodName(NameFormat format) { 
		return getMethodName(method, format);
	}
	
	
	/**
	 * add a new response object to results list 
	 * 
	 * @return
	 */
	@SuppressWarnings("unchecked")
	private void addResult() {
		switch (method) {
		case PERSON: 	((Vector<Person>)results).add(new Person()); break;
		case EMPLOYEE:  ((Vector<Employee>)results).add(new Employee()); break;
		case CLIENT: 	((Vector<Person>)results).add(new Client()); break;
		}
	}
	
	/**
	 * parse the current stream using current method
	 * 
	 * @return
	 */
	public Vector<? extends Person> parse () {
		
		switch (method) {
		case PERSON : results = new Vector<Person>(); break;
		case EMPLOYEE : results = new Vector<Employee>(); break;
		case CLIENT : results = new Vector<Client>(); break;
		}
		if (stream != null) try {		
			XMLReader xr = XMLReaderFactory.createXMLReader();
			xr.setContentHandler(this);
			xr.setErrorHandler(this);
		    xr.parse(new InputSource(stream));		    
		} catch (SAXException se) {
			System.err.println(getMethodName(NameFormat.FIRSTCAPITAL) 
					+ " SAXException in file '" + filename + "' : " + se.getLocalizedMessage());
		} catch (IOException ie) {
			System.err.println(getMethodName(NameFormat.FIRSTCAPITAL) 
					+ " IOException in file '" + filename + "' : " + ie.getLocalizedMessage());
		}
		if (results.size() == 0) addResult();
		return results;
	}

	// Event Handlers
	/**
	 * Called event when a start tag has been parsed
	 * 
	 * clear character container
	 * add a new object to results list when parsed tag is appropriate
	 */
	public void startElement(String uri, String localName, 
			String qName, Attributes attributes) throws SAXException {		
		value = ""; // reset characters receiver
		if ((method == ParsingMethod.PERSON && qName.equalsIgnoreCase("person")) 
				|| (method == ParsingMethod.EMPLOYEE && qName.equalsIgnoreCase("employee"))
				|| (method == ParsingMethod.CLIENT && qName.equalsIgnoreCase("client")))
			addResult();
	}
	
	/**
	 * Called event when enclosed tag characters has been parsed
	 * 
	 * Fill characters container 
	 */
	public void characters(char[] ch, int start, int length) throws SAXException {
		value = new String(ch,start,length);
	}
	
	/**
	 * Called event when a end tag has been parsed
	 * 
	 * Fill appropriate result property
	 */
	@SuppressWarnings("unchecked")
	public void endElement(String uri, String localName, String qName) {

		// try to find object action associated to tag name
		// if not find try to find qName in allowed tag for object
		try {
			if ((action = (Action) Action.ACTIONS.get(qName)) == null) {
				Boolean FoundAllowedTag = false;
				Vector<String> allowedTags = Action.TAGS.get(method);
				for (String tag : allowedTags) 
					if (tag.equalsIgnoreCase(qName)) {
						FoundAllowedTag = true;
						break;
					}					
				if (!FoundAllowedTag) 
					System.err.println(getMethodName(NameFormat.FIRSTCAPITAL) 
							+ " unknown tagname : " + qName + " (ignoring this tag)");
				return;
			}
			
			// find method to apply for last results element related to action
			Method methodClass = action.getType().getDeclaredMethod(action.getName(), action.getClasses());			
			
			// parse argument of setter
			Object argument = parseArgument(value, action, qName);
			
			// apply action with argument to last results element
			if (methodClass != null && argument != null) 
				methodClass.invoke(results.lastElement(), new Object[] {argument} );
			
		} catch (SecurityException e) {
			System.err.println(getMethodName(NameFormat.FIRSTCAPITAL) 
					+ " security exception for " + qName + " tag");
		} catch (NoSuchMethodException e) {
			System.err.println(getMethodName(NameFormat.FIRSTCAPITAL) 
					+ " invalid tag " + qName + " " + results.lastElement().getClass());
		} catch (NoSuchElementException e) {
			System.err.println(getMethodName(NameFormat.FIRSTCAPITAL) 
					+ " invalid element " + qName);
		} catch (IllegalArgumentException e) {
			System.err.println(getMethodName(NameFormat.FIRSTCAPITAL) 
					+ " invalid agument '"+value+"' for " + qName + " tag");
		} catch (IllegalAccessException e) {
			System.err.println(getMethodName(NameFormat.FIRSTCAPITAL) 
					+ " illegal access for " + qName + " tag");
		} catch (InvocationTargetException e) {
			System.err.println(getMethodName(NameFormat.FIRSTCAPITAL) 
					+ " invocation target exception for " + qName + " tag");
		}
	}

	/**
	 * parse argument of setter
	 * 
	 * @param value
	 * @param action
	 * @param qName
	 * @return
	 */
	private Object parseArgument (String value, Action action, String qName) {	
		
		Object argument = null;
		
		if (action.getClasses().length > 0)
			// String argument, nothing to do
			if (action.getClasses()[0] == String.class)
				argument = value;
			// Boolean argument
			else if (action.getClasses()[0] == Boolean.class) {
				if ((argument = parseBoolean()) != BOOLEAN.ERROR)
					argument = ((BOOLEAN) argument).toBoolean();						
				else {
					System.err.println(getMethodName(NameFormat.FIRSTCAPITAL) 
							+ " invalid boolean agument '"+value+"' for " + qName + " tag");
				}
			// Integer argument
			} else if (action.getClasses()[0] == Integer.class)
				try {
					argument = Integer.parseInt(value);
				} catch (NumberFormatException nfe) {
					System.err.println(getMethodName(NameFormat.FIRSTCAPITAL) 
							+ " invalid integer agument '"+value+"' for " + qName + " tag");
				}
			// Float argument
			else if (action.getClasses()[0] == Float.class)
				try {
					argument = Float.parseFloat(value);
				} catch (NumberFormatException nfe) {
					System.err.println(getMethodName(NameFormat.FIRSTCAPITAL) 
							+ " invalid float agument '"+value+"' for " + qName + " tag");
				}
			// Date argument
			else if (action.getClasses()[0] == Date.class) 
				try {
					String[] arguments = value.split("/");
					if (arguments.length != 3) throw new NumberFormatException();
					GregorianCalendar gc = new GregorianCalendar (Integer.parseInt(arguments[2]), 
						Integer.parseInt(arguments[1]), Integer.parseInt(arguments[0]));
					argument = new Date(gc.getTimeInMillis());
				} catch (NumberFormatException nfe) {
					System.err.println(getMethodName(NameFormat.FIRSTCAPITAL) 
							+ " invalid date agument '"+value+"' for " + qName + " tag");
				}
			// URL argument
			else if (action.getClasses()[0] == URL.class) 
				try {
					argument = new URL(value);
				} catch(MalformedURLException e){
					System.err.println(getMethodName(NameFormat.FIRSTCAPITAL) 
						+ " invalid url agument '"+value+"' for " + qName + " tag");
				}
		
		return argument;
	}
	
	// non numeric lexem parsing methods
	private enum BOOLEAN { 
		FALSE, TRUE, ERROR; 
		Boolean toBoolean() { return this == FALSE ? false : this == TRUE ? true : false; }
	}
	
	private BOOLEAN parseBoolean() {
		boolean isFalse = value.equalsIgnoreCase("false") || value.equals("0");
		return (value.equalsIgnoreCase("true") || value.equals("1") || isFalse) ? 
			isFalse ? BOOLEAN.FALSE : BOOLEAN.TRUE : BOOLEAN.ERROR;
	}

	/**
	 * Program entry point
	 * 
	 * @param args
	 */
  @SuppressWarnings("unchecked")
	public static void main(String[]args) {
  	XmlMultiParser parser = new XmlMultiParser("persons.xml", ParsingMethod.PERSON);
  	Vector<Person> persons = (Vector<Person>) parser.parse();
   	for (Person person : persons) person.print(true);
   	
   	parser.setSource("employees.xml", ParsingMethod.EMPLOYEE);
  	Vector<Employee> employees = (Vector<Employee>) parser.parse();
   	for (Employee employee : employees) employee.print(true);
   	
   	parser.setSource("clients.xml", ParsingMethod.CLIENT);
  	Vector<Client> clients = (Vector<Client>) parser.parse();
   	for (Client client : clients) client.print(true);
   	
   }
    
}


 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Sources du même auteur

CHUNKEDXML, LIRE DU XML PAR MORCEAU
Source avec Zip EXPLORATEUR D'IMAGES
Source avec Zip REDIRECTION D'URL ET TRANSMISSION DE COOKIES
SUPPRIMER LES BALISES D'UN FICHIER HTML
FAIRE CLIGNOTER UN BOUTON AVEC UN TIMER SWING

 Sources de la même categorie

LIRE LES FICHIERS .WAV par Julien39
Source avec Zip Source avec une capture TRADUCTEUR FRANÇAIS --> NERLANDAIS V3 par edouard333
Source avec Zip IA POUR DISCUTER par edouard333
Source avec Zip Source avec une capture JSUBTITLE1.0 par darrylsite
Source avec Zip COMPILATEUR PASCAL par youma85

 Sources en rapport avec celle ci

Source avec Zip COMPILATEUR PASCAL par youma85
Source avec Zip JAVA SERVER PAGE par pasteure
Source avec Zip Source avec une capture IHM CONFIGURABLE POUR FICHIER PROPERTIES par benmor
ENREGISTRER L'ARBORESCENCE D'UN JTREE DANS UN XML AVEC JDOM par coltman
JCONFIGURATIONMANAGER - GESTION DES CONFIGURATIONS par Francks11

Commentaires et avis

Commentaire de yazidmissaoui le 21/06/2007 18:41:37

Pas mal ..

Commentaire de loloof64 le 22/06/2007 19:19:32

Salut, pour éviter les Warnings, tu peux, pour une énumération de Personne, faire (je n'ai pas lu ton code) :
Enumeration<Personne> enum1 = new Enumeration<Personne>()

(JDK >= 1.5)

Commentaire de AlexN le 25/06/2007 20:41:37

Merci je vais voir ça.

Commentaire de petman le 22/10/2007 22:36:49

Juste une remarque, je penses qu'une class List ou ArrayList serai plus judicieuse de Vector qui est tres groumad en memoire...

 Ajouter un commentaire


Discussions en rapport avec ce code source dans le forum

analyseur XML en java [ par rubo ] Salut tt le monde!!je dois réaliser un parseur xml en java et j'ai un peu de mal a debuter!!alors si qq1 a une petite idee ou autres choses ce sera sy Algorithme de parser xml générique [ par snipeurcoq ] Bonjour, je vous envoie ce message car je commence à désespérer sur la réalisation du projet sur lequel je me trouve. Je vous indique ce que je dois [BAR]choix de langage de programmation [ par mourouchou ] salut je vais faire une application de gestion scolartie mais je ne sais pas si j'utlise java avec eclipse et postgressql ou delphie avec sql sever s programmation horloge de 24 heures [ par alaricduban ] Bonjour à tous : et bien tout est dans le titre : je suis ultra-débutant, je ne connais pas le java (en fait, je ne connais qu'un tout petit peu de pr Afficher un fichier XML sous forme d'arbre graphique avec jbuilder [ par iskes ] Bonjour, j'ai un fichier XML qui contient un texte structuré . je veux affiche ce texte sous forme d'arbre graphique avec jbuilder SVP aider moi c'es Créer un PDF à partir d'un XML [ par shark59112 ] Bonjour, Je souhaite créer un .PDF à partir d'un fichier XML mais je ne sais pas du tout comment m'y prendre... =x (projet) J'ai alors effectué des r Problème avec Eclipse/Android [ par ndubien ] Bonjour, J'ai récemment investi dans un HTC Magic (bref un téléphone qui se programme en Java et qui dispose du système d'exploitation android de goo JPA:le fichier :persistence.xml [ par limalima ] Bonjour à tous, j'ai un problème sur une application utilisant JPA, je pense que c'est dû à mon fichier de configuration que voici: ----------------- probleme hibernate.cfg.xml [ par labal ] bonjour; dans mon projet web sous eclips ,Précisément dans mes fichier xml parmi c'est fichier il y a hibernate.cfg.xml ,quelque balise sont souligne Aide: Editeur Script XML? [ par fryser_d ] Bonjours, voilà je suis entrain de coder un programme qui gèrera plusieurs ressources en même temps et doit facilement être testable et modifiable; do


Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Mars 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728
293031    

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,671 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales