Hi,I'm trying to use the method XMLConfiguration.addNodes() to add a tree of configuration properties to a node in other tree, like this:
public static void main(String ...args){ try{
configDestination = new XMLConfiguration("output.xml"); configSource = new XMLConfiguration("input.xml"); } catch(ConfigurationException cex){ System.out.println("File not found"); }Collection collection = new ArrayList();
collection = configSource.getRoot().getChildren();configDestination.addNodes("newNodes", collection); try {
configDestination.save();} catch (ConfigurationException e) {
System.out.println("Error saving"); e.printStackTrace(); } } The XML files: input.xml <rootNode> <newNodeChild> <newNodeChildChild>child value</newNodeChildChild> <newNodeChildChild>child value 2</newNodeChildChild> <newNodeChildChild>child value 3</newNodeChildChild> </newNodeChild> </rootNode> output.xml <testRootNode> <test>TEST</test> </testRootNode> output.xml after running the code: <testRootNode> <test>TEST</test> <newNodes/> </testRootNode> Expected output.xml: <testRootNode> <test>TEST</test> <newNodes> <newNodeChild> <newNodeChildChild>child value</newNodeChildChild> <newNodeChildChild>child value 2</newNodeChildChild> <newNodeChildChild>child value 3</newNodeChildChild> </newNodeChild> <newNodes/> </testRootNode> Hope someone can help me. --Ruben Silva
Research & Development – Saphety Level - Trusted Services SA E-mail: [EMAIL PROTECTED]
smime.p7s
Description: S/MIME Cryptographic Signature