My model looks like this:

class Table {
  List<Row> rows;
  List<Column> columns;
  List<Cell> cells;
}
class Row {
   List<Cell> cells;
}
class Column {
   List<Cell> cells;
}
class Cell {
  Row row;
  Column column;
}


When I xstream this to XML with ID_REFERENCE, I get something ugly like this:

<table>
   <!-- rows -->
   <row id="1"><!-- row 1 -->
      <cell id="2">
         <row ref="1">
         <column id="3">
            <cell ref="2"/>
            <cell id="4">
                <row id="5"> <!-- row 2 -->
                   ... <!-- VERY DEEP INDENTATION, up to depth cellSize -->
                       <!-- All cells get initialized here !!! -->
                </row>
                <column ref="3"/>
             </cell>
             <cell ref="..."/>
             ...
          </column>
     <cell ref="..."/>
     ...
   </row>
   <row ref="5"/>
   ... (other rows, refs only)

   <!-- columns -->
   <column ref="3"/>
   <column ref=""/>
   ... (other columns, also refs only)

   <!-- cells -->
   <cell ref="2"/>
   ... (other cells, also refs only)
<table/>


The indentation of that beast is ugly
and it scales poorly in memory & disk space.
How do I avoid that (without removing the bi-directional relationships in my classes)? Preferably, I 'd like it to write all rows, first, then all columns and then all cells.




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to