1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package javax.xml.bind;
18
19 import java.io.OutputStream;
20 import java.io.Writer;
21 import java.io.File;
22
23 import javax.xml.bind.annotation.adapters.XmlAdapter;
24 import javax.xml.bind.attachment.AttachmentMarshaller;
25 import javax.xml.validation.Schema;
26 import javax.xml.transform.Result;
27 import javax.xml.stream.XMLEventWriter;
28 import javax.xml.stream.XMLStreamWriter;
29
30 import org.w3c.dom.Node;
31
32 import org.xml.sax.ContentHandler;
33
34 public interface Marshaller {
35
36 String JAXB_ENCODING = "jaxb.encoding";
37 String JAXB_FORMATTED_OUTPUT = "jaxb.formatted.output";
38 String JAXB_FRAGMENT = "jaxb.fragment";
39 String JAXB_NO_NAMESPACE_SCHEMA_LOCATION = "jaxb.noNamespaceSchemaLocation";
40 String JAXB_SCHEMA_LOCATION = "jaxb.schemaLocation";
41
42 abstract class Listener {
43 public void beforeMarshal(Object source) {
44 }
45 public void afterMarshal(Object source) {
46 }
47 }
48
49 <A extends XmlAdapter> A getAdapter(Class<A> type);
50
51 AttachmentMarshaller getAttachmentMarshaller();
52
53 ValidationEventHandler getEventHandler() throws JAXBException;
54
55 Listener getListener();
56
57 Node getNode(Object contentTree) throws JAXBException;
58
59 Object getProperty(String name) throws PropertyException;
60
61 Schema getSchema();
62
63 void marshal(Object jaxbElement, ContentHandler handler) throws JAXBException;
64
65 void marshal(Object jaxbElement, File file) throws JAXBException;
66
67 void marshal(Object jaxbElement, Node node) throws JAXBException;
68
69 void marshal(Object jaxbElement, OutputStream os) throws JAXBException;
70
71 void marshal(Object jaxbElement, Result result) throws JAXBException;
72
73 void marshal(Object jaxbElement, Writer writer) throws JAXBException;
74
75 void marshal(Object jaxbElement, XMLEventWriter writer) throws JAXBException;
76
77 void marshal(Object jaxbElement, XMLStreamWriter writer) throws JAXBException;
78
79 <A extends XmlAdapter> void setAdapter(Class<A> type, A adapter);
80
81 void setAdapter(XmlAdapter adapter);
82
83 void setAttachmentMarshaller(AttachmentMarshaller am);
84
85 void setEventHandler(ValidationEventHandler handler) throws JAXBException;
86
87 void setListener(Listener listener);
88
89 void setProperty(String name, Object value) throws PropertyException;
90
91 void setSchema(Schema schema);
92
93 }