Skip to content
Snippets Groups Projects
Commit 1f23824a authored by Sören Henning's avatar Sören Henning
Browse files

added simple JAXB marshaling test

parent 942249fe
No related branches found
No related tags found
1 merge request!17Get impletemented stages and Java 8
package kieker.analysis.graph; package kieker.analysis.graph;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import org.graphdrawing.graphml.EdgeType;
import org.graphdrawing.graphml.GraphType;
import org.graphdrawing.graphml.GraphmlType;
import org.graphdrawing.graphml.KeyType;
import org.graphdrawing.graphml.NodeType;
import org.graphdrawing.graphml.ObjectFactory;
import kieker.analysis.graph.impl.GraphImpl; import kieker.analysis.graph.impl.GraphImpl;
public class GraphTester { public class GraphTester {
...@@ -73,23 +85,27 @@ public class GraphTester { ...@@ -73,23 +85,27 @@ public class GraphTester {
System.out.println(edge.getId()); System.out.println(edge.getId());
} }
// GraphmlType graphmlType = new GraphmlType(); GraphmlType graphmlType = new GraphmlType();
// graphmlType.getKey().add(new KeyType()); graphmlType.getKey().add(new KeyType());
// graphmlType.getGraphOrData().add(new GraphType()); GraphType graphType = new GraphType();
graphType.getDataOrNodeOrEdge().add(new NodeType());
// ERROR als Element ist nicht möglich, weil eine @XmlRootElement-Annotation fehlt graphType.getDataOrNodeOrEdge().add(new NodeType());
graphType.getDataOrNodeOrEdge().add(new EdgeType());
/* graphmlType.getGraphOrData().add(graphType);
* try {
* JAXBContext context = JAXBContext.newInstance(GraphmlType.class); try {
* Marshaller m = context.createMarshaller(); JAXBContext context = JAXBContext.newInstance(GraphmlType.class);
* m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); Marshaller m = context.createMarshaller();
* m.marshal(graphmlType, System.out); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
* } catch (JAXBException e) {
* // TODO Auto-generated catch block ObjectFactory objectFactory = new ObjectFactory();
* e.printStackTrace(); JAXBElement<GraphmlType> element = objectFactory.createGraphml(graphmlType);
* }
*/ m.marshal(element, System.out);
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Use object factory // Use object factory
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment