Java: Clôner un noeud fils

Author:

Java: Clôner un noeud fils
Download

/***** Code de MesExemples.com *******/
         public void duplicatePerson(Document doc) {        Element root = doc.getDocumentElement();        Element origPerson = (Element)root.getFirstChild();        Element newPerson = (Element)origPerson.cloneNode(true);        root.appendChild(newPerson);    }                                      

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: Clôner un noeud fils est apparu en premier sur .

Java: Clôner un noeud fils

Author:

Java: Clôner un noeud fils
Download

/***** Code de MesExemples.com *******/
         public void duplicatePerson(Document doc) {        Element root = doc.getDocumentElement();        Element origPerson = (Element)root.getFirstChild();        Element newPerson = (Element)origPerson.cloneNode(true);        root.appendChild(newPerson);    }                                      

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: Clôner un noeud fils est apparu en premier sur .