private void addReadingOrderGroup(Element parent, Group group, int index) /*throws XMLStreamException*/ {
		String groupElementName;
		if (group.isOrdered())
			groupElementName = index >= 0 ? DefaultXmlNames.ELEMENT_OrderedGroupIndexed : DefaultXmlNames.ELEMENT_OrderedGroup;
		else
			groupElementName = index >= 0 ? DefaultXmlNames.ELEMENT_UnorderedGroupIndexed : DefaultXmlNames.ELEMENT_UnorderedGroup;
		
		
		Element groupNode = doc.createElementNS(getNamespace(), groupElementName);
		parent.appendChild(groupNode);
			
		//ID
		addAttribute(groupNode, DefaultXmlNames.ATTR_id, group.getId().toString());
		
		//Index
		if (index >= 0)
			addAttribute(groupNode, DefaultXmlNames.ATTR_index, Integer.toString(index));
			//eventWriter.add(eventFactory.createAttribute(DefaultXmlNames.ATTR_index, Integer.toString(index)));
	
		//Children
		GroupMember member;
		for (int i=0; i<group.getSize(); i++) {
			member = group.getMember(i);
			if (member instanceof Group)
				addReadingOrderGroup(groupNode, (Group)member, group.isOrdered() ? i : -1);
			else if (member instanceof RegionRef) 
				addRegionRef(groupNode, ((RegionRef)member).getRegionId().toString(), group.isOrdered() ? i : -1);
		}
	}