%@ page import = "org.w3c.dom.*,org.apache.xerces.parsers.DOMParser,org.xml.sax.*" %>
http://tecfa2.unige.ch/guides/java/staf2x/ex/xml/fiches/v2/table-arbre.jsp affiche un document XML sous forme d'un arbre au format HTML. Techniques utilisé: JSP + un SAX/DOM parseur (Xerces). La version source est disponible.
Il s agit ici de la version "arbre" qui "rammasse" les enfants d un type de tag. Si tag=Entry, ca ramasse les enfants immédiats de "Entry".
<!ELEMENT Entry (Title, Creator?, Description, Keywords, Location?, MetaDocumentAuthor, MainType, SubType*, Topic, SubTopic*)>
Pour les autres versions (Application, servlet, etc.) voir http://tecfa.unige.ch/guides/java/staf2x/ex/xml/fiches/
English: This is a simple XAML-DOM-JSP Demo that shows how to deal with simple table-like structures. Click on all links above and you will understand (source code uses english variable names)
Note that MOST XML files will NOT work, examples that will work are:
http://tecfa2.unige.ch/guides/java/staf2x/ex/xml/fiches/v2/table-arbre.jsp?url=http://tecfa2.unige.ch/guides/java/staf2x/ex/xml/fiches/Fiches.xml&tag=Entry
http://tecfa2.unige.ch/guides/java/staf2x/ex/xml/fiches/v2/table-arbre.jsp?url=http://tecfa2.unige.ch/guides/java/staf2x/ex/xml/formcont/formcont.xml&tag=session-component
Fiches structurés par " + tag+" :
"); // List of entries (fiches) NodeList entries = TheDocument.getDocumentElement().getElementsByTagName(tag); int nEntries = entries.getLength(); // Deal Entry by Entry for(int i=0; i < nEntries; i++) { Element currentEntry = (Element) entries.item(i); NodeList entryItems = currentEntry.getChildNodes(); int nEntryItems = entryItems.getLength(); out.println("On arrete tout de suite, reparez l'erreur SVP