@Override
	protected String getFirstRow() throws SQLException 
	{
		if ( this.rs == null ) 
		{
			throw new SQLException("Rs is not initialized.");
		}

		ResultSetMetaData md = rs.getMetaData() ;
		int totalCol = md.getColumnCount();
		String[] cols = new String[totalCol];
		int[] types = new int[totalCol];
		for ( int i=0; i<totalCol; i++ ) 
		{
			cols[i] = md.getColumnLabel(i+1);
			types[i] = md.getColumnType(i+1);
		}
		
		StringBuilder strBuf = new StringBuilder();
		String className = null;
		if ( null != docName ) className = docName;
		else className = classToFill.getName();

		if (! this.rs.next()) return null; 
		
		if (this.writeAttributes) 
		{
			this.recordAsAttributes(totalCol, cols, strBuf, className);
		} 
		else 
		{
			this.recordAsTags(totalCol, cols, types, strBuf, className);
		}

		if ( LOG.isDebugEnabled()) LOG.debug(strBuf.toString());
		String xmlRec = strBuf.toString();
		if (this.out != null) this.out.println(xmlRec);
		return xmlRec;
	}