@@ -0,0 +1,1690 @@
+package org.wyona.cms.cocoon.sitemap;%0A%0Aimport java.io.File;%0A%0Aimport org.dom4j.Document;%0Aimport org.dom4j.Element;%0Aimport org.dom4j.io.SAXReader;%0A%0A/**%0A * @author Michael Wechner%0A * @created 2002.3.17%0A * @version 2002.3.18%0A */%0Apublic class Sitemap%7B%0A  private File file=null;%0A  private Document doc=null;%0A/**%0A *%0A */%0A  public static void main(String%5B%5D args)%7B%0A    if(args.length != 4)%7B%0A      System.err.println(%22Usage: root-sitemap pattern prefix sub-sitemap%22);%0A      return;%0A      %7D%0A    try%7B%0A      File sitemapFile=new File(args%5B0%5D);%0A      Sitemap sitemap=new Sitemap(sitemapFile);%0A      sitemap.mount(args%5B1%5D,args%5B2%5D,args%5B3%5D);%0A      sitemap.save(sitemapFile);%0A      %7D%0A    catch(Exception e)%7B%0A      System.err.println(%22.main(): %22+e);%0A      %7D%0A    %7D%0A/**%0A *%0A */%0A  public Sitemap(File file) throws Exception%7B%0A    this.file=file;%0A    doc=new SAXReader().read(%22file:%22+file.getAbsolutePath());%0A    %7D%0A/**%0A *%0A */%0A  public void save(File file) throws Exception%7B%0A    //System.out.println(doc.asXML());%0A%0A    java.io.FileWriter fileWriter = new java.io.FileWriter(file.getAbsolutePath());%0A    doc.write(fileWriter);%0A    fileWriter.close();%0A    %7D%0A/**%0A *%0A */%0A  public void mount(String pattern,String uri_prefix,String src)%7B%0A    Element pipelineElement=(Element)doc.selectSingleNode(%22/map:sitemap/map:pipelines/map:pipeline%22);%0A    Element matchElement=org.dom4j.DocumentHelper.createElement(%22map:match%22).addAttribute(%22pattern%22,pattern);%0A    java.util.List list=pipelineElement.content();%0A    list.add(0,matchElement);%0A    matchElement.addElement(%22map:mount%22).addAttribute(%22uri-prefix%22,uri_prefix).addAttribute(%22src%22,src).addAttribute(%22check-reload%22,%22true%22).addAttribute(%22reload-method%22,%22synchron%22);%0A    %7D%0A  %7D%0A

Add subsitemaps