buildframework/helium/sf/java/internaldata/src/com/nokia/helium/internaldata/ant/listener/TreeDumper.java
changeset 628 7c4a911dc066
parent 588 c7c26511138f
child 629 541af5ee3ed9
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
     1 /*
       
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17  
       
    18 package com.nokia.helium.internaldata.ant.listener;
       
    19 
       
    20 import java.util.Iterator;
       
    21 /**
       
    22  * Helper class to fix indentation of the xml.
       
    23  *
       
    24  */
       
    25 public class TreeDumper {
       
    26     
       
    27     private DataNode rootNode;
       
    28     
       
    29     public TreeDumper(DataNode root) {
       
    30         this.rootNode = root;
       
    31     }
       
    32     
       
    33     public void dump() {
       
    34         dump(rootNode, "");
       
    35     }
       
    36 
       
    37     public void dump(DataNode root, String indent) {
       
    38         System.out.println(indent + " + " + root);
       
    39         for (Iterator<DataNode> i = root.iterator(); i.hasNext() ;) {
       
    40             DataNode node = i.next();
       
    41             dump(node, indent + "   ");
       
    42         }
       
    43     }
       
    44 
       
    45 }