private void addLayers(Element parent, Layers layers) /*throws XMLStreamException*/ {
		if (layers == null || layers.getSize() == 0)
			return;
		
		//Check if there are non-empty layers
		boolean foundNonEmptyLayer = false;
		for (int i=0; i<layers.getSize(); i++) {
			if (layers.getLayer(i).getSize() != 0)
			{
				foundNonEmptyLayer = true;
				break;
			}
		}
		if (!foundNonEmptyLayer) //Only empty layers -> skip the whole layers element
			return;

		
		Element layersNode = doc.createElementNS(getNamespace(), DefaultXmlNames.ELEMENT_Layers);
		parent.appendChild(layersNode);

		Layer layer;
		for (int i=0; i<layers.getSize(); i++) {
			layer = layers.getLayer(i);
			if (layer.getSize() > 0)
				addLayer(layersNode, layer);
		}
	}