Index: /home/exo/java/projects/xwiki/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java
===================================================================
--- /home/exo/java/projects/xwiki/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java	(revision 1054)
+++ /home/exo/java/projects/xwiki/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java	(working copy)
@@ -133,6 +133,9 @@
 
     private XWikiStoreInterface store;
 
+    private Vector sections = new Vector();
+    private int sectionID_ = 0 ;
+
     public XWikiStoreInterface getStore() {
         return store;
     }
@@ -2488,4 +2491,125 @@
         return context.getUser().equals(getFullName());
     }
 
+    public void setSplitSections(String[] sections_){
+        sections.add(sections_);
+    }
+
+    public String[] getSplitSections(int index) {
+        return (String[])sections.get(index-1);
+    }
+
+    public Vector getSplisSections(){
+        return sections ;
+    }
+
+    public void removeSections(){
+        sections.removeAllElements();
+    }
+    // return content of section
+    public String mergeSections(int idSection) {
+        Vector vt = getSplisSections();
+        int indexEnd = 0 ;
+        // paramater of section
+        String[] obSection = (String[]) vt.get(idSection-1);
+        int indexStart = Integer.parseInt(obSection[1].trim());
+        String level = obSection[2];
+        int dot = level.indexOf(".");
+        for(int i = idSection ;i<vt.size() ;i++){
+            String[] sectionNext =(String[]) vt.get(i);
+            String levelNext = sectionNext[2];
+            if( i != vt.size() ){
+
+                if(dot == -1 ){
+                    if(levelNext.indexOf(".") == -1){
+                        indexEnd = Integer.parseInt(sectionNext[1].trim());
+                        break ;
+                    }
+                }else{
+                    indexEnd = Integer.parseInt(sectionNext[1].trim());
+                    break;
+                }
+
+            }else{
+                indexEnd = 0;
+            }
+        }
+        String sectionContent = null;
+
+        if(indexStart < 0){
+               indexStart = 0;
+        }
+       if(indexEnd == 0)
+          sectionContent = getContent().substring(indexStart);
+        else
+          sectionContent = getContent().substring(indexStart,indexEnd);
+    
+
+
+        return sectionContent;
+    }
+
+    public int getSection() {
+        return sectionID_;
+    }
+
+    public void setSection(int idSection){
+      this.sectionID_ = idSection;
+    }
+
+    public int getIndexContentSection(int idSection){
+       String[] obSection =  getSplitSections(idSection);
+       return Integer.parseInt(obSection[1].trim());
+
+    }
+
+    public String getTitleSection(int idSection){
+        String[] obSection = getSplitSections(idSection);
+        return obSection[3];
+    }
+
+    public String updateSection(int idSection , String newcontent) {
+        int secIndex = getIndexContentSection(idSection);
+
+        if(idSection == sections.size() && idSection != 1){
+            String contentBegin = getContent().substring(0,secIndex);
+            return contentBegin+newcontent;
+        }else if(sections.size() == 1) {
+            return newcontent;
+        }else if(idSection == 1 && (idSection != sections.size()) ){
+            Vector vt = getSplisSections();
+            String[] obSection = (String[]) vt.get(0);
+            String levelSection = obSection[2];
+            int dot = levelSection.indexOf(".");
+            int indexNext = 0;
+            for(int i =1 ; i<vt.size(); i++){
+                String[] ob = (String[])vt.get(i);
+                String level = ob[2];
+                if( dot == -1 ){
+                    if(level.indexOf(".") == -1 ){
+                        indexNext = Integer.parseInt(ob[1].trim());
+                        break;
+                    }
+                }else{
+                    indexNext = Integer.parseInt(ob[1].trim());
+                    break;
+                }
+            }
+            if(indexNext == 0){
+              return newcontent;
+            }else{
+              String contentAfter = getContent().substring(indexNext);
+              return newcontent+contentAfter;
+            }
+
+        }else{
+            int indexA = getIndexContentSection(idSection+1);
+            String contentAfter = getContent().substring(indexA);
+            String contentBegin = getContent().substring(0,secIndex);
+
+            return contentBegin+newcontent+contentAfter;
+        }
+
+    }
+
 }
