/***** Code de MesExemples.com *******/ /** * @(#)ExempleAttributNoeud.java * * * @author *sakoba(java.mesexemples.com) @version 1.00 2013/7/4 */ import org.w3c.dom.Attr; import org.w3c.dom.Element; public class ExempleAttributNoeud { // Retourner l'attribut du noeud public static Attr getAttr(Element elem, String name) { return elem.getAttributeNode(name); } } |
Code testé avec le fichier XML Suivant
<?xml version="1.0" encoding="windows-1252"?> <!-- Edited by MesEXemple.com --> <note> <to>Sakoba</to> <from>Adams</from> <heading>Rappel</heading> <body>Ne m'oubliez pas ce week-end!</body> </note> |
Cet article Java: Obtenir les attributs d’un Noeud est apparu en premier sur .