public static void writeGISElementContainer(Element xmlNode, GISElementContainer<?> primitive,
			String elementNodeName, XMLBuilder builder, PathBuilder pathBuilder, XMLResources resources) throws IOException {
		URL url;
		boolean saveElements = true;

		url = primitive.getElementGeometrySourceURL();
		if (url != null) {
			xmlNode.setAttribute(MapElementLayer.ATTR_ELEMENT_GEOMETRY_URL,
					resources.add(url, MimeName.MIME_SHAPE_FILE.getMimeConstant()));
			saveElements = false;
		}

		MapMetricProjection mapProjection = primitive.getElementGeometrySourceProjection();
		if (mapProjection == null) {
			mapProjection = MapMetricProjection.getDefault();
		}
		xmlNode.setAttribute(MapElementLayer.ATTR_ELEMENT_GEOMETRY_PROJECTION, mapProjection.name());

		url = primitive.getElementAttributeSourceURL();
		if (!saveElements && url != null) {
			xmlNode.setAttribute(MapElementLayer.ATTR_ELEMENT_ATTRIBUTES_URL,
					resources.add(url, MimeName.MIME_DBASE_FILE.getMimeConstant()));
		}

		if (saveElements) {
			final Element elementList = builder.createElement(NODE_ELEMENTS);
			for (final MapElement element : primitive) {
				final Element e = XMLGISElementUtil.writeMapElement(element, elementNodeName, builder, resources);
				if (e != null) {
					elementList.appendChild(e);
				}
			}
			if (elementList.getChildNodes().getLength() > 0) {
				xmlNode.appendChild(elementList);
			}
		}
	}
public static void writeGISElementContainer ( Element xmlNode , GISElementContainer < ? > primitive , String elementNodeName , XMLBuilder builder , PathBuilder pathBuilder , XMLResources resources ) throws IOException { URL url ; boolean saveElements = true ; url = primitive . getElementGeometrySourceURL ( ) ; if ( url != null ) { xmlNode . setAttribute ( MapElementLayer . ATTR_ELEMENT_GEOMETRY_URL , resources . add ( url , MimeName . MIME_SHAPE_FILE . getMimeConstant ( ) ) ) ; saveElements = false ; } MapMetricProjection mapProjection = primitive . getElementGeometrySourceProjection ( ) ; if ( mapProjection == null ) { mapProjection = MapMetricProjection . getDefault ( ) ; } xmlNode . setAttribute ( MapElementLayer . ATTR_ELEMENT_GEOMETRY_PROJECTION , mapProjection . name ( ) ) ; url = primitive . getElementAttributeSourceURL ( ) ; if ( ! saveElements && url != null ) { xmlNode . setAttribute ( MapElementLayer . ATTR_ELEMENT_ATTRIBUTES_URL , resources . add ( url , MimeName . MIME_DBASE_FILE . getMimeConstant ( ) ) ) ; } if ( saveElements ) { final Element elementList = builder . createElement ( NODE_ELEMENTS ) ; for ( final MapElement element : primitive ) { final Element e = XMLGISElementUtil . writeMapElement ( element , elementNodeName , builder , resources ) ; if ( e != null ) { elementList . appendChild ( e ) ; } } if ( elementList . getChildNodes ( ) . getLength ( ) > 0 ) { xmlNode . appendChild ( elementList ) ; } } }
Write the XML description for the given container of map elements.

@param xmlNode is the XML node to fill with the container data.
@param primitive is the container of map elements to output.
@param elementNodeName is the name of the XML node that should contains the map element data.
It may be {@code null} to use the default name.
@param builder is the tool to create XML nodes.
@param pathBuilder is the tool to make paths relative.
@param resources is the tool that permits to gather the resources.
@throws IOException in case of error.