private void printTable(ORASSNode node, int indentation) throws MainException{
		try{
			String tableName = node.getName();
			CachedRowSet data = tableData.get(tableName);

			List<String> keyCols = keyMaps.get(tableName);
			//List<String> cols = colMaps.get(tableName);
			List<ColumnDetail> entityCols = node.getEntityAttributes();
			boolean firstPrint = true;

			List<String> entityColNames = new ArrayList<String>();
			for(int i=0; i< entityCols.size(); i++){
				String currName = entityCols.get(i).getName();
				entityColNames.add(currName);
			}
			data.next();
			List<String> prevVals = getSelectedVals(tableName, entityColNames, data);
			data.previous();
			List<ORASSNode> children = node.getChildren();
			List<ORASSNode> supertypes = node.getSupertypeNode();
			ORASSNode regularEntity = node.getNormalEntityNode();

			if(supertypes.size()>0){
				List<ColumnDetail> filteredEntityCols = new ArrayList<ColumnDetail>();
				for(int i=0; i<supertypes.size(); i++){
					ORASSNode supertype = supertypes.get(i);
					String supertypeName = supertype.getName();
					List<String> supertypeCols = colMaps.get(supertypeName);
					for(int j = 0; j<entityCols.size(); j++){
						ColumnDetail col = entityCols.get(j);
						if(!supertypeCols.contains(col.getName())){
							filteredEntityCols.add(col);
						}
					}
				}
				entityCols = filteredEntityCols;
			}
			String prevId = "";

			while(data.next()){
				List<String> keyVals = getSelectedVals(tableName, keyCols, data);
				String id = getTupleID(tableName, keyVals);
				// Print opening tag
				if(!id.equals(prevId)){
					printTabs(indentation);
					writer.println("<"+tableName+" "+ tableName +"#=\"" + id+"\">");
					firstPrint= true;
				}
				// Print columns
				for(int i=0;i<entityCols.size();i++){
					ColumnDetail col = entityCols.get(i);
					String colName = col.getName();
					String nextData = data.getString(colName);
					String prevColVal = prevVals.get(i);

					boolean hasFKref = col.hasForeignRef();
					if((firstPrint || !prevColVal.equals(nextData)) && !hasFKref){
						printTabs(indentation+1);
						if (data.wasNull()){
							writer.print("<"+colName);
							writer.print(" xsi:nil=\"true\">");
						}else{
							writer.print("<"+colName+">"+nextData);
						}
						writer.println("</"+colName+">");
					}
				}

				if(firstPrint){
					// Print regular relationships
					for(int i=0; i<children.size(); i++){
						ORASSNode child = children.get(i);
						if(node.hasRelation(child)){
							String relName = node.getRelation(child);
							if(nRels.keySet().contains(relName)){
								List<String> entityOrder = nRels.get(relName);
								String topEntity = entityOrder.get(0);
								if(topEntity.equals(tableName)){
									List<NodeRelationship> nodeRels = getNaryRelationship(relName);
									CachedRowSet naryCrs = getNaryRelationshipData(nodeRels);
									printNaryRelationship(node, child, entityOrder, nodeRels, naryCrs, id, indentation+1);
								}
							}else{
								List<NodeRelationship> nodeRels = getNodeRelationship(node,child);
								CachedRowSet crs = getRelationshipData(node, child, nodeRels);
								printRelationship(node, child, nodeRels, crs, id, indentation+1);
								crs.close();
							}
						}else{
							List<NodeRelationship> nodeRels = getNodeRelationship(node,child);
							CachedRowSet crs = getRelationshipData(node, child, nodeRels);
							printRelationship(node, child, nodeRels, crs, id, indentation+1);
							crs.close();
						}
					}

					// Print IS-A relationships
					for(int i=0; i<supertypes.size(); i++){
						ORASSNode supertype = supertypes.get(i);
						List<NodeRelationship> nodeRels = getNodeRelationship(node,supertype);
						//logger.info("is-a nodeRels size="+nodeRels.size());
						String supertypeName = supertype.getOriginalName();
						if(node.getOriginalName().equals(supertypeName)){
							printSpecialRelationship(supertype, keyVals, indentation+1);
						}else{
							CachedRowSet crsIsA = getRelationshipData(node, supertype, nodeRels);
							printRelationship(node, supertype, nodeRels, crsIsA, id, indentation+1);
							crsIsA.close();
						}
					}

					// Print ID/EX relationships
					if(regularEntity!=null){
						List<NodeRelationship> nodeRels = getNodeRelationship(node,regularEntity);
						//logger.info("weak nodeRels size="+nodeRels.size());
						CachedRowSet crsWeak = getRelationshipData(node, regularEntity, nodeRels);
						printRelationship(node, regularEntity, nodeRels, crsWeak, id, indentation+1);
						crsWeak.close();
					}
				}
				firstPrint= false;
				prevId = id;
				prevVals = getSelectedVals(tableName, entityColNames, data);
				printClosingTag(node, data, keyCols, keyVals, indentation);
			}

			for(int i=0; i<children.size(); i++){
				ORASSNode child = children.get(i);
				printTable(child, 1);
			}
		}catch(SQLException ex){
			throw new MainException("Print table " + node.getName()+" : "+ ex.getMessage());
		}
	}