Java certainly has APIs for writing XML. Start with a Document:
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.newDocument();
//Create the root Customers element
Element rootElement = doc.createElement("Customers");
doc.appendChild(rootElement);
//Create Marker element
Element markerElement = doc.createElement("Marker");
markerElement.setAttribute("category","Production");
rootElement.appendChild(markerElement);
and so on.
A nice little tutorial can be found here
This is just one way of many, but it's probably the best one to get started with.