[Castore-commits] OutputDocumentGenerator.java 1.1.2.3 1.1.2.4 InsertReturn.java 1.1.2.3 1.1.2.4

Stéphane Bouchet sbouchet at adullact1.hosting.cri74.org
Lun 6 Mar 17:11:57 CET 2006


Update of /cvsroot/castore/castore-core/src/java/fr/emn/castor/documents/retro/generator
In directory adullact1:/tmp/cvs-serv7508/src/java/fr/emn/castor/documents/retro/generator

Modified Files:
      Tag: v1_1_branch
	OutputDocumentGenerator.java InsertReturn.java 
Log Message:
Mise en page

Index: InsertReturn.java
===================================================================
RCS file: /cvsroot/castore/castore-core/src/java/fr/emn/castor/documents/retro/generator/InsertReturn.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** InsertReturn.java	7 Feb 2006 15:46:10 -0000	1.1.2.3
--- InsertReturn.java	6 Mar 2006 16:11:55 -0000	1.1.2.4
***************
*** 42,53 ****
  
  public class InsertReturn {
! 	
! 	public boolean insert;
! 	public Element element;
! 	
! 	public InsertReturn(boolean pInsert, Element pElement) 
! 	{
! 		insert = pInsert;
! 		element = pElement;
      }
  
--- 42,53 ----
  
  public class InsertReturn {
! 
!     public boolean insert;
! 
!     public Element element;
! 
!     public InsertReturn(boolean pInsert, Element pElement) {
!         insert = pInsert;
!         element = pElement;
      }
  

Index: OutputDocumentGenerator.java
===================================================================
RCS file: /cvsroot/castore/castore-core/src/java/fr/emn/castor/documents/retro/generator/OutputDocumentGenerator.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** OutputDocumentGenerator.java	7 Feb 2006 15:46:10 -0000	1.1.2.3
--- OutputDocumentGenerator.java	6 Mar 2006 16:11:55 -0000	1.1.2.4
***************
*** 68,72 ****
  
      /** le logger.*/
!     private static Log logger = LogFactory.getLog(OutputDocumentGenerator.class);
  
      /**
--- 68,73 ----
  
      /** le logger.*/
!     private static Log logger = LogFactory
!         .getLog(OutputDocumentGenerator.class);
  
      /**
***************
*** 86,91 ****
       */
      public OutputDocumentGenerator(String theInputFilePath,
!     		String theOutputFilePath,
!             String thePpsFilePath) {
          inputFilePath = theInputFilePath;
          outputFilePath = theOutputFilePath;
--- 87,91 ----
       */
      public OutputDocumentGenerator(String theInputFilePath,
!             String theOutputFilePath, String thePpsFilePath) {
          inputFilePath = theInputFilePath;
          outputFilePath = theOutputFilePath;
***************
*** 105,109 ****
      // the PointToPointSchema file path
      protected String ppsFilePath = "";
!    
      // the final outputDocument
      protected Document outputDocument = null;
--- 105,109 ----
      // the PointToPointSchema file path
      protected String ppsFilePath = "";
! 
      // the final outputDocument
      protected Document outputDocument = null;
***************
*** 111,120 ****
      // the point to point schema
      private PointToPointSchema pps = null;
!   
      // getters / setters
      /**
! 	 * @return  Returns the inputFilePath.
! 	 * @uml.property  name="inputFilePath"
! 	 */
      public String getInputFilePath() {
          return inputFilePath;
--- 111,120 ----
      // the point to point schema
      private PointToPointSchema pps = null;
! 
      // getters / setters
      /**
!      * @return  Returns the inputFilePath.
!      * @uml.property  name="inputFilePath"
!      */
      public String getInputFilePath() {
          return inputFilePath;
***************
*** 122,128 ****
  
      /**
! 	 * @return  Returns the outputFilePath.
! 	 * @uml.property  name="outputFilePath"
! 	 */
      public String getOutputFilePath() {
          return outputFilePath;
--- 122,128 ----
  
      /**
!      * @return  Returns the outputFilePath.
!      * @uml.property  name="outputFilePath"
!      */
      public String getOutputFilePath() {
          return outputFilePath;
***************
*** 130,136 ****
  
      /**
! 	 * @return  Returns the ppsFilePath.
! 	 * @uml.property  name="ppsFilePath"
! 	 */
      public String getPpsFilePath() {
          return ppsFilePath;
--- 130,136 ----
  
      /**
!      * @return  Returns the ppsFilePath.
!      * @uml.property  name="ppsFilePath"
!      */
      public String getPpsFilePath() {
          return ppsFilePath;
***************
*** 138,144 ****
  
      /**
! 	 * @param inputFilePath  The inputFilePath to set.
! 	 * @uml.property  name="inputFilePath"
! 	 */
      public void setInputFilePath(String theFilePath) {
          inputFilePath = theFilePath;
--- 138,144 ----
  
      /**
!      * @param inputFilePath  The inputFilePath to set.
!      * @uml.property  name="inputFilePath"
!      */
      public void setInputFilePath(String theFilePath) {
          inputFilePath = theFilePath;
***************
*** 146,152 ****
  
      /**
! 	 * @param outputFilePath  The outputFilePath to set.
! 	 * @uml.property  name="outputFilePath"
! 	 */
      public void setOutputFilePath(String theFilePath) {
          outputFilePath = theFilePath;
--- 146,152 ----
  
      /**
!      * @param outputFilePath  The outputFilePath to set.
!      * @uml.property  name="outputFilePath"
!      */
      public void setOutputFilePath(String theFilePath) {
          outputFilePath = theFilePath;
***************
*** 154,160 ****
  
      /**
! 	 * @param ppsFilePath  The ppsFilePath to set.
! 	 * @uml.property  name="ppsFilePath"
! 	 */
      public void setPpsFilePath(String theFilePath) {
          ppsFilePath = theFilePath;
--- 154,160 ----
  
      /**
!      * @param ppsFilePath  The ppsFilePath to set.
!      * @uml.property  name="ppsFilePath"
!      */
      public void setPpsFilePath(String theFilePath) {
          ppsFilePath = theFilePath;
***************
*** 194,203 ****
              String rootName = inputDocument.getRootElement();
              Element root = new Element(rootName);
!             root.setNamespace(Namespace.getNamespace(inputDocument.getTargetNamespace()));
              outputDocument = new Document(root);
  
              //allPleList = 
              // Deal with the document
!             boolean insert = traiterElements(inputDocument.getFxrdElements(), root, FLAG_FC, true);
  
              if (!insert)
--- 194,205 ----
              String rootName = inputDocument.getRootElement();
              Element root = new Element(rootName);
!             root.setNamespace(Namespace.getNamespace(inputDocument
!                 .getTargetNamespace()));
              outputDocument = new Document(root);
  
              //allPleList = 
              // Deal with the document
!             boolean insert = traiterElements(
!                 inputDocument.getFxrdElements(), root, FLAG_FC, true);
  
              if (!insert)
***************
*** 225,287 ****
       * @return true if ok, false otherwise
       */
!     public boolean traiterElements(Vector pleList, Element e, String c, boolean hl) 
!     {
!     	int tpe = 0;
!     	Element lite = e;
!     	FxrdElement ple;
!     	do
!     	{
!     		ple = (FxrdElement) pleList.get(tpe);
!     		boolean insert = traiterElement(ple, lite, c, hl);
!     		if (insert)
!     		{
!     			tpe = tpe + 1;
!     		}
!     		else
!     		{
!     			do
!     			{
!     				((FxrdElement) pleList.get(tpe)).Reset();
!     				tpe = tpe -1;
!     			}
!     			while (tpe != -1 & ((FxrdElement) pleList.get(tpe)).getEp() == true);
!     		}
!     		if (tpe != -1  & tpe != pleList.size())
!     		{
!     			// Préparer le traitement ou retraitement de l'élément d'index tpe
!     			ple = (FxrdElement) pleList.get(tpe);
!     			c = FLAG_FS;
!     			//	L'élément inséré en dernier est 
!     			//	- soit la racine, 
!     			//	- soit l'élément inséré lors du traitement de l'élément d'avant le prochain à traiter    			
!     			if (tpe == 0)
!     			{
!     				lite = lite.getDocument().getRootElement();
!     			}
!     			else
!     			{
!     				lite = ((FxrdElement) pleList.get(tpe-1)).getTe();
!     			}
!     			
!     			// Retraitement
!     			if (!insert)
!     			{
!     				ple.getTe().detach();
!     			}
!     		}
!     	} while (tpe != -1 & tpe != pleList.size());
!     	
!     	/*	Le traitement a pu s'arréter pour deux raisons :
!     	|	- On est remonté jusqu'à la racine : Le document n'a pu être rendu valide
!     	|	- On a traité tous les éléménts : Le document a été rendu valide */
  
!     	if ( tpe == -1 )
!     	{
!     		return false;
!     	}
!     	else
!     	{
!     		return true;
!     	}
      }
  
--- 227,276 ----
       * @return true if ok, false otherwise
       */
!     public boolean traiterElements(
!             Vector pleList, Element e, String c, boolean hl) {
!         int tpe = 0;
!         Element lite = e;
!         FxrdElement ple;
!         do {
!             ple = (FxrdElement) pleList.get(tpe);
!             boolean insert = traiterElement(ple, lite, c, hl);
!             if (insert) {
!                 tpe = tpe + 1;
!             } else {
!                 do {
!                     ((FxrdElement) pleList.get(tpe)).Reset();
!                     tpe = tpe - 1;
!                 } while (tpe != -1
!                         & ((FxrdElement) pleList.get(tpe)).getEp() == true);
!             }
!             if (tpe != -1 & tpe != pleList.size()) {
!                 // Préparer le traitement ou retraitement de l'élément d'index tpe
!                 ple = (FxrdElement) pleList.get(tpe);
!                 c = FLAG_FS;
!                 //	L'élément inséré en dernier est 
!                 //	- soit la racine, 
!                 //	- soit l'élément inséré lors du traitement de l'élément d'avant le prochain à traiter    			
!                 if (tpe == 0) {
!                     lite = lite.getDocument().getRootElement();
!                 } else {
!                     lite = ((FxrdElement) pleList.get(tpe - 1)).getTe();
!                 }
  
!                 // Retraitement
!                 if (!insert) {
!                     ple.getTe().detach();
!                 }
!             }
!         } while (tpe != -1 & tpe != pleList.size());
! 
!         /*	Le traitement a pu s'arréter pour deux raisons :
!          |	- On est remonté jusqu'à la racine : Le document n'a pu être rendu valide
!          |	- On a traité tous les éléménts : Le document a été rendu valide */
! 
!         if (tpe == -1) {
!             return false;
!         } else {
!             return true;
!         }
      }
  
***************
*** 301,318 ****
       * @return true if ok, false otherwise
       */
!     public boolean traiterElement(FxrdElement ple, Element e, String c, boolean hl) 
!     {
          InsertReturn para;
          boolean insert;
!         
!         if (ple instanceof ParagraphElement) 
!         {
              para = traiterParagraphElement((ParagraphElement) ple, e, c, hl);
              return para.insert;
!         }
!         else 
!         {
!         	insert = traiterLayoutElement((LayoutElement) ple, e, c, hl);
!         	return insert;
          }
      }
--- 290,304 ----
       * @return true if ok, false otherwise
       */
!     public boolean traiterElement(
!             FxrdElement ple, Element e, String c, boolean hl) {
          InsertReturn para;
          boolean insert;
! 
!         if (ple instanceof ParagraphElement) {
              para = traiterParagraphElement((ParagraphElement) ple, e, c, hl);
              return para.insert;
!         } else {
!             insert = traiterLayoutElement((LayoutElement) ple, e, c, hl);
!             return insert;
          }
      }
***************
*** 335,351 ****
       * @return true if ok, false otherwise
       */
!     public InsertReturn traiterParagraphElement(ParagraphElement pe, Element e, String c, boolean hl) 
!     {
  
          boolean insert = false;
          Element ePrime = null;
!            
          Vector opeList = pe.getOutputParagraphElements();
          Vector pcList = pe.getParagraphComponents();
!         
          int tpope = pe.getLpope() + 1;
!         while (!insert & tpope != opeList.size())
!         {
!         	OutputParagraphElement ope = (OutputParagraphElement) opeList.get(tpope);        	
              String p = ope.getName();
              String ce = ope.getContainerElement();
--- 321,337 ----
       * @return true if ok, false otherwise
       */
!     public InsertReturn traiterParagraphElement(
!             ParagraphElement pe, Element e, String c, boolean hl) {
  
          boolean insert = false;
          Element ePrime = null;
! 
          Vector opeList = pe.getOutputParagraphElements();
          Vector pcList = pe.getParagraphComponents();
! 
          int tpope = pe.getLpope() + 1;
!         while (!insert & tpope != opeList.size()) {
!             OutputParagraphElement ope = (OutputParagraphElement) opeList
!                 .get(tpope);
              String p = ope.getName();
              String ce = ope.getContainerElement();
***************
*** 353,378 ****
              Element pElement = new Element(p);
  
!             if (ce != null) 
!             {
                  // insert p element into ce element
                  Element ceElement = new Element(ce);
                  ceElement.addContent(pElement);
                  ePrime = ceElement;
!             } 
!             else
!             {
!             	ePrime = pElement;
              }
!                 
              // Try to insert the element
              insert = insertElement(ePrime, e, c, hl);
!             pe.setLpope(pe.getLpope()+1);
!             
!             if (!insert)
!             {
!             	tpope = pe.getLpope()+1;
!             }
!             else
!             {
                  // insert content into paragraph
                  AddContent(pElement, pcList);
--- 339,358 ----
              Element pElement = new Element(p);
  
!             if (ce != null) {
                  // insert p element into ce element
                  Element ceElement = new Element(ce);
                  ceElement.addContent(pElement);
                  ePrime = ceElement;
!             } else {
!                 ePrime = pElement;
              }
! 
              // Try to insert the element
              insert = insertElement(ePrime, e, c, hl);
!             pe.setLpope(pe.getLpope() + 1);
! 
!             if (!insert) {
!                 tpope = pe.getLpope() + 1;
!             } else {
                  // insert content into paragraph
                  AddContent(pElement, pcList);
***************
*** 381,450 ****
          }
  
!         if (!insert)
!         {
              // No element coming from the ParagraphElement list fits
              // try an element from the target schema        	
!         	InsertReturn insertReturn;
!         	insertReturn = insertParagraphElementFromSchema(pe, e, c, opeList, hl);
!         	insert = insertReturn.insert;
!         	ePrime = insertReturn.element;
  
!         	if (insert)
!         	{
!         		// insert content into paragraph
                  AddContent(ePrime, pcList);
                  pe.setTe(ePrime);
!         	}
          }
  
!         InsertReturn insertReturn = new InsertReturn(insert, ePrime); 
          return insertReturn;
      }
!     
!     public void AddContent(Element e, Vector pcList)
!     {
!     	Content pc = null;
!     	
!     	// Insert the content of a paragraph (elements of the pcList) in the element e
!     	for (int i=0; i < pcList.size(); i++)
!     	{
!     		Object paragraphComponent = (ParagraphComponent) pcList.get(i);
!     		
!     		if (paragraphComponent instanceof TextElement) 
!     	    {
!     			String t = ((TextElement) paragraphComponent).getValue();
!     			pc = new Text(t);
!     			e.addContent(pc);
!     	    }
!     	    else 
!     	    {
!     	    	InlineElement inlineElement = (InlineElement) paragraphComponent;
!     	    	Element outputInlineElement = (Element) inlineElement.getOutputInlineElement().clone();
!     	    	// Try to insert the inline element into the current paragraph
!     	    	boolean insert;
!     	    	if (i == 0)
!     	    	{
!     	    		// Try to insert as first Child
!     	    		insert = insertElement(outputInlineElement, e, FLAG_FC, false);
!     	    	}
!     	    	else
!     	    	{
!     	    		// Try to insert as following sibling of last insert paragraph component (element or text)    	    		
!     	    		insert = insertElement(outputInlineElement, pc, FLAG_FS, false);
!     	    	}
!     	    	
!     	    	if (!insert)
!     	    	{
!     	    		// Insert the substitute texte in the current paragraph
!     	    		String t = inlineElement.getSubstituteText();
!     	    		pc = new Text(t); 
!     	    		e.addContent(pc);
!     	    	}
!     	    	else
!     	    	{
!     	    		pc = outputInlineElement;
!     	    	}
!     	    }    		
!     	}
      }
  
--- 361,421 ----
          }
  
!         if (!insert) {
              // No element coming from the ParagraphElement list fits
              // try an element from the target schema        	
!             InsertReturn insertReturn;
!             insertReturn = insertParagraphElementFromSchema(
!                 pe, e, c, opeList, hl);
!             insert = insertReturn.insert;
!             ePrime = insertReturn.element;
  
!             if (insert) {
!                 // insert content into paragraph
                  AddContent(ePrime, pcList);
                  pe.setTe(ePrime);
!             }
          }
  
!         InsertReturn insertReturn = new InsertReturn(insert, ePrime);
          return insertReturn;
      }
! 
!     public void AddContent(Element e, Vector pcList) {
!         Content pc = null;
! 
!         // Insert the content of a paragraph (elements of the pcList) in the element e
!         for (int i = 0; i < pcList.size(); i++) {
!             Object paragraphComponent = (ParagraphComponent) pcList.get(i);
! 
!             if (paragraphComponent instanceof TextElement) {
!                 String t = ((TextElement) paragraphComponent).getValue();
!                 pc = new Text(t);
!                 e.addContent(pc);
!             } else {
!                 InlineElement inlineElement = (InlineElement) paragraphComponent;
!                 Element outputInlineElement = (Element) inlineElement
!                     .getOutputInlineElement().clone();
!                 // Try to insert the inline element into the current paragraph
!                 boolean insert;
!                 if (i == 0) {
!                     // Try to insert as first Child
!                     insert = insertElement(
!                         outputInlineElement, e, FLAG_FC, false);
!                 } else {
!                     // Try to insert as following sibling of last insert paragraph component (element or text)    	    		
!                     insert = insertElement(
!                         outputInlineElement, pc, FLAG_FS, false);
!                 }
! 
!                 if (!insert) {
!                     // Insert the substitute texte in the current paragraph
!                     String t = inlineElement.getSubstituteText();
!                     pc = new Text(t);
!                     e.addContent(pc);
!                 } else {
!                     pc = outputInlineElement;
!                 }
!             }
!         }
      }
  
***************
*** 464,498 ****
       * @return true if ok, false otherwise
       */
!     public boolean traiterLayoutElement(LayoutElement le, Element e, String c, boolean hl) {
  
          boolean insert = false;
!         
!         if (!le.getPole())
!         {
! 	        Element ole = (Element) le.getOutputLayoutElement();
! 	
! 	        // Create the root layout element
! 	        Element ePrime = (Element) ole.clone();
! 	        ePrime.removeContent();
! 	
! 	        insert = insertElement(ePrime, e, c, hl);
! 	
! 	        if (insert) 
! 	        {
! 	            insert = insertOutputLayoutSubElements(ole, ePrime);
! 	            if (insert)
! 	            {
! 	            	le.setTe(ePrime);	
! 	            }
! 	        }
! 	        le.setPole(true);
          }
!         if (!insert)
!         {        	
!             insert = traiterElements(le.getSubstituteParagraphElements(), e, c, false);
!             if (insert)
!             {
!             	FxrdElement lastSubstituteParagraphElements = (FxrdElement) le.getSubstituteParagraphElements().lastElement();
!                 le.setTe(lastSubstituteParagraphElements.getTe());	
              }
              le.setEp(true);
--- 435,467 ----
       * @return true if ok, false otherwise
       */
!     public boolean traiterLayoutElement(
!             LayoutElement le, Element e, String c, boolean hl) {
  
          boolean insert = false;
! 
!         if (!le.getPole()) {
!             Element ole = (Element) le.getOutputLayoutElement();
! 
!             // Create the root layout element
!             Element ePrime = (Element) ole.clone();
!             ePrime.removeContent();
! 
!             insert = insertElement(ePrime, e, c, hl);
! 
!             if (insert) {
!                 insert = insertOutputLayoutSubElements(ole, ePrime);
!                 if (insert) {
!                     le.setTe(ePrime);
!                 }
!             }
!             le.setPole(true);
          }
!         if (!insert) {
!             insert = traiterElements(
!                 le.getSubstituteParagraphElements(), e, c, false);
!             if (insert) {
!                 FxrdElement lastSubstituteParagraphElements = (FxrdElement) le
!                     .getSubstituteParagraphElements().lastElement();
!                 le.setTe(lastSubstituteParagraphElements.getTe());
              }
              le.setEp(true);
***************
*** 515,541 ****
       * @return
       */
!     private boolean insertElement(Element ePrime, Content e, String c, boolean hl) {
  
          boolean insert = false;
!         if (e == null
!                 || (e.getParentElement() == null && c.equals(FLAG_FS)))
              return insert;
  
          PpsElement fatherElement = null;
          PpsElement eElem = null;
!         
          // Can ePrime be inserted as a sibling of e ?
          boolean canEPrimeBeSiblingOfE = false;
          String eName;
!         
!         if (e instanceof Element) 
!         	eName = ((Element) e).getName();
          else
!         	eName = PointToPointSchema.TEXT_NAME;
!         
          if (c.equals(FLAG_FS)) {
!         	fatherElement = pps.getElement(e.getParentElement().getName());
              canEPrimeBeSiblingOfE = fatherElement
!                     .isAllowedFollowingSiblingOfChild(eName, ePrime.getName());
          }
  
--- 484,510 ----
       * @return
       */
!     private boolean insertElement(
!             Element ePrime, Content e, String c, boolean hl) {
  
          boolean insert = false;
!         if (e == null || (e.getParentElement() == null && c.equals(FLAG_FS)))
              return insert;
  
          PpsElement fatherElement = null;
          PpsElement eElem = null;
! 
          // Can ePrime be inserted as a sibling of e ?
          boolean canEPrimeBeSiblingOfE = false;
          String eName;
! 
!         if (e instanceof Element)
!             eName = ((Element) e).getName();
          else
!             eName = PointToPointSchema.TEXT_NAME;
! 
          if (c.equals(FLAG_FS)) {
!             fatherElement = pps.getElement(e.getParentElement().getName());
              canEPrimeBeSiblingOfE = fatherElement
!                 .isAllowedFollowingSiblingOfChild(eName, ePrime.getName());
          }
  
***************
*** 543,548 ****
          boolean canEPrimeBeChildOfE = true;
          if (c.equals(FLAG_FC)) {
!         	eElem = pps.getElement(eName);
!             canEPrimeBeChildOfE = eElem.isAllowedFirstChild(ePrime.getName());
          }
  
--- 512,518 ----
          boolean canEPrimeBeChildOfE = true;
          if (c.equals(FLAG_FC)) {
!             eElem = pps.getElement(eName);
!             canEPrimeBeChildOfE = eElem
!                 .isAllowedFirstChild(ePrime.getName());
          }
  
***************
*** 571,575 ****
                      // if so try to insert ePrime as a sibling of e's father
                      if (fatherElement.isAllowedLastChild(eName)) {
!                         insert = insertElement(ePrime, (Element) e.getParentElement(), FLAG_FS, hl);
                      }
                  }
--- 541,546 ----
                      // if so try to insert ePrime as a sibling of e's father
                      if (fatherElement.isAllowedLastChild(eName)) {
!                         insert = insertElement(ePrime, (Element) e
!                             .getParentElement(), FLAG_FS, hl);
                      }
                  }
***************
*** 596,635 ****
       * @return
       */
!     private InsertReturn insertParagraphElementFromSchema(ParagraphElement pe, Element e, String c, Vector theOpeList, boolean hl) 
!     {
  
          boolean insert = false;
!         Element ePrime = null;       
!         if (pe.ParagraphElementsFromSchema == null)
!         {
!         	PpsElement eElem = pps.getElement(e.getName());
!             PpsElement fatherElem = pps.getElement(e.getParentElement().getName());
!             if (c.equals(FLAG_FS)) 
!             {
!             	pe.ParagraphElementsFromSchema = fatherElem.getAllowedFollowingSiblingsOfChild(e.getName());
!             } else 
!             {
                  // c=FC
!             	pe.ParagraphElementsFromSchema = eElem.getAllowedFirstChildren();
              }
              pe.setIpefs(pe.ParagraphElementsFromSchema.iterator());
          }
          Iterator iter = pe.getIpefs();
!         while (!insert & iter.hasNext())
!         {
!         	PpsElement ePrimeElem = (PpsElement) iter.next();
! 			ePrime = new Element(ePrimeElem.getName());
  
!             if (ePrimeElem.isParagraph()) 
!             {
                  insert = insertElement(ePrime, e, c, hl);
              }
          }
!         InsertReturn insertReturn = new InsertReturn(insert, ePrime); 
          return insertReturn;
      }
  
!     private boolean insertOutputLayoutSubElements(Element olse, Element e) 
!     {
          boolean insert = true;
          InsertReturn insertReturn;
--- 567,604 ----
       * @return
       */
!     private InsertReturn insertParagraphElementFromSchema(
!             ParagraphElement pe, Element e, String c, Vector theOpeList,
!             boolean hl) {
  
          boolean insert = false;
!         Element ePrime = null;
!         if (pe.ParagraphElementsFromSchema == null) {
!             PpsElement eElem = pps.getElement(e.getName());
!             PpsElement fatherElem = pps.getElement(e
!                 .getParentElement().getName());
!             if (c.equals(FLAG_FS)) {
!                 pe.ParagraphElementsFromSchema = fatherElem
!                     .getAllowedFollowingSiblingsOfChild(e.getName());
!             } else {
                  // c=FC
!                 pe.ParagraphElementsFromSchema = eElem
!                     .getAllowedFirstChildren();
              }
              pe.setIpefs(pe.ParagraphElementsFromSchema.iterator());
          }
          Iterator iter = pe.getIpefs();
!         while (!insert & iter.hasNext()) {
!             PpsElement ePrimeElem = (PpsElement) iter.next();
!             ePrime = new Element(ePrimeElem.getName());
  
!             if (ePrimeElem.isParagraph()) {
                  insert = insertElement(ePrime, e, c, hl);
              }
          }
!         InsertReturn insertReturn = new InsertReturn(insert, ePrime);
          return insertReturn;
      }
  
!     private boolean insertOutputLayoutSubElements(Element olse, Element e) {
          boolean insert = true;
          InsertReturn insertReturn;
***************
*** 639,645 ****
          List olseChildList = olse.getChildren();
          Element ePrime = null;
!         
!         for (int i = 0; i < olseChildList.size(); i++) 
!         {
  
              Element olseChild = (Element) olseChildList.get(i);
--- 608,613 ----
          List olseChildList = olse.getChildren();
          Element ePrime = null;
! 
!         for (int i = 0; i < olseChildList.size(); i++) {
  
              Element olseChild = (Element) olseChildList.get(i);
***************
*** 652,687 ****
              }
  
!             if (n.equals(FlatXmlRawData.PARAGRAPH_ELEMENT)) 
!             {
                  ParagraphElement paraElemEPrime = new ParagraphElement();
                  paraElemEPrime.load(olseChild);
  
!                 insertReturn = traiterParagraphElement(paraElemEPrime, e, c, false);
                  insert = insertReturn.insert;
                  ePrime = insertReturn.element;
!                 
                  if (!insert)
                      break;
!             } 
!             else 
!             {
!             	// Duplicate node olseChild with function importNode 
!             	// in order to be able to insert it into the output document 
                  // ePrime = (Element) outputDocument.importNode(olseChild, false);
!             	ePrime = (Element) olseChild.clone();
!             	ePrime.removeContent();
!             	
!                 if (c.equals(FLAG_FC)) 
!                 {
                      // insert ePrime as first child of e
                      e.addContent(ePrime);
!                 } 
!                 else 
!                 {
                      // insert ePrime as following sibling of e                	
                      e.getParentElement().addContent(ePrime);
                  }
                  // recurse
!                 insertOutputLayoutSubElements(olseChild, ePrime);                
              }
              e = ePrime;
--- 620,650 ----
              }
  
!             if (n.equals(FlatXmlRawData.PARAGRAPH_ELEMENT)) {
                  ParagraphElement paraElemEPrime = new ParagraphElement();
                  paraElemEPrime.load(olseChild);
  
!                 insertReturn = traiterParagraphElement(
!                     paraElemEPrime, e, c, false);
                  insert = insertReturn.insert;
                  ePrime = insertReturn.element;
! 
                  if (!insert)
                      break;
!             } else {
!                 // Duplicate node olseChild with function importNode 
!                 // in order to be able to insert it into the output document 
                  // ePrime = (Element) outputDocument.importNode(olseChild, false);
!                 ePrime = (Element) olseChild.clone();
!                 ePrime.removeContent();
! 
!                 if (c.equals(FLAG_FC)) {
                      // insert ePrime as first child of e
                      e.addContent(ePrime);
!                 } else {
                      // insert ePrime as following sibling of e                	
                      e.getParentElement().addContent(ePrime);
                  }
                  // recurse
!                 insertOutputLayoutSubElements(olseChild, ePrime);
              }
              e = ePrime;
***************
*** 706,716 ****
  
      public Element TEXT = new Element(PointToPointSchema.TEXT_NAME);
!     		
      /*private static final String ERROR_LOADING_PPS = "Error while loading PointToPointSchema file";
  
!     private static final String ERROR_LOADING_INPUT = "Error while loading input document";
  
!     private static final String ERROR_INITIALIZING_OUTPUT = "Error while initializing output document";
  
!     private static final String ERROR_GENERATING_OUTPUT = "Error while generating output document";*/
  }
--- 669,679 ----
  
      public Element TEXT = new Element(PointToPointSchema.TEXT_NAME);
! 
      /*private static final String ERROR_LOADING_PPS = "Error while loading PointToPointSchema file";
  
!      private static final String ERROR_LOADING_INPUT = "Error while loading input document";
  
!      private static final String ERROR_INITIALIZING_OUTPUT = "Error while initializing output document";
  
!      private static final String ERROR_GENERATING_OUTPUT = "Error while generating output document";*/
  }




Plus d'informations sur la liste de diffusion Castore-commits