package org.gcube.common.resources.gcore.common; import java.io.StringWriter; import java.util.ArrayList; import java.util.List; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlMixed; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.gcube.common.resources.gcore.utils.Utils; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class AnyMixedWrapper { //this is the element we return to client for modifications private Element root = Utils.newDocument().getDocumentElement(); //these are the nodes we deserialise @XmlAnyElement @XmlMixed private List nodes; public Element root() { Element response = root; NodeList list = root.getChildNodes(); if (list.getLength()==1) { Node child = list.item(0); if (child instanceof Element) response = (Element) child; } return response; } public String asString() { StringBuilder builder = new StringBuilder(); NodeList list = root.getChildNodes(); for (int i=0; i(); NodeList list = root.getChildNodes(); for (int i=0;i