Pierre van Rooden wrote:

[x] +1 (YEA) On the condition that there some attention to the following point:



/**
*
* @javadoc
* @move org.mmbase.util.xml
* @deprecation-used Can use Xerces functionality to write an XML, isn't it?


Not always,.. first a check to see if it has an config field,... could use old typedef definition for config.

* @version $Id: XMLApplicationWriter.java,v 1.23 2003/04/10 07:59:42 pierre Exp $
*/
public class XMLApplicationWriter  {




   private static void writeBuilders(XMLApplicationReader app,String targetpath,MMBase 
mmb) {
       // create the dir for the Data & resource files
       File file = new File(targetpath+"/"+app.getApplicationName()+"/builders");
       try {
           file.mkdirs();
       } catch(Exception e) {
           log.error("Can't create dir : 
"+targetpath+"/"+app.getApplicationName()+"/builders");
       }

Vector builders=app.getNeededBuilders();
for (Enumeration e=builders.elements();e.hasMoreElements();) {
Hashtable bset=(Hashtable)e.nextElement();
String name=(String)bset.get("name");
MMObjectBuilder bul=mmb.getMMObject(name);


Could you not first check if the typedef "config" field contains a value? AFAK the comments in the old xml will be replace with the -standard xml comments,.. The config field is of type XML IRC

           if (bul!=null) {
               try {
                   BuilderWriter builderOut=new BuilderWriter(bul);
                   builderOut.setIncludeComments(true);
                   builderOut.setExpandBuilder(false);
                   
builderOut.writeToFile(targetpath+"/"+app.getApplicationName()+"/builders/"+name+".xml");
               } catch (Exception ex) {
                   log.error(Logging.stackTrace(ex));
               }
           }
       }
   }

}




--
Time is on my side,....

Eduard Witteveen
+316 414 789 23





Reply via email to