|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2003, 2021 Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2003, 2024 Oracle and/or its affiliates. All rights reserved. |
3 | 3 | *
|
4 | 4 | * This program and the accompanying materials are made available under the
|
5 | 5 | * terms of the Eclipse Distribution License v. 1.0, which is available at
|
|
24 | 24 | *
|
25 | 25 | * <p>
|
26 | 26 | * <i>Assume the following setup code for all following code fragments:</i>
|
27 |
| - * <blockquote> |
28 |
| - * <pre> |
29 |
| - * JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" ); |
30 |
| - * Unmarshaller u = jc.createUnmarshaller(); |
31 |
| - * Object element = u.unmarshal( new File( "foo.xml" ) ); |
32 |
| - * Marshaller m = jc.createMarshaller(); |
33 |
| - * </pre> |
34 |
| - * </blockquote> |
| 27 | + * {@snippet : |
| 28 | + * JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" ); |
| 29 | + * Unmarshaller u = jc.createUnmarshaller(); |
| 30 | + * Object element = u.unmarshal( new File( "foo.xml" ) ); |
| 31 | + * Marshaller m = jc.createMarshaller(); |
| 32 | + * } |
35 | 33 | *
|
36 | 34 | * <p>
|
37 | 35 | * Marshalling to a File:
|
38 |
| - * <blockquote> |
39 |
| - * <pre> |
40 |
| - * OutputStream os = new FileOutputStream( "nosferatu.xml" ); |
41 |
| - * m.marshal( element, os ); |
42 |
| - * </pre> |
43 |
| - * </blockquote> |
| 36 | + * {@snippet : |
| 37 | + * OutputStream os = new FileOutputStream( "nosferatu.xml" ); |
| 38 | + * m.marshal( element, os ); |
| 39 | + * } |
44 | 40 | *
|
45 | 41 | * <p>
|
46 | 42 | * Marshalling to a SAX ContentHandler:
|
47 |
| - * <blockquote> |
48 |
| - * <pre> |
49 |
| - * // assume MyContentHandler instanceof ContentHandler |
50 |
| - * m.marshal( element, new MyContentHandler() ); |
51 |
| - * </pre> |
52 |
| - * </blockquote> |
| 43 | + * {@snippet : |
| 44 | + * // assume MyContentHandler instanceof ContentHandler |
| 45 | + * m.marshal( element, new MyContentHandler() ); |
| 46 | + * } |
53 | 47 | *
|
54 | 48 | * <p>
|
55 | 49 | * Marshalling to a DOM Node:
|
56 |
| - * <blockquote> |
57 |
| - * <pre> |
58 |
| - * DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); |
59 |
| - * dbf.setNamespaceAware(true); |
60 |
| - * DocumentBuilder db = dbf.newDocumentBuilder(); |
61 |
| - * Document doc = db.newDocument(); |
| 50 | + * {@snippet : |
| 51 | + * DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); |
| 52 | + * dbf.setNamespaceAware(true); |
| 53 | + * DocumentBuilder db = dbf.newDocumentBuilder(); |
| 54 | + * Document doc = db.newDocument(); |
62 | 55 | *
|
63 |
| - * m.marshal( element, doc ); |
64 |
| - * </pre> |
65 |
| - * </blockquote> |
| 56 | + * m.marshal( element, doc ); |
| 57 | + * } |
66 | 58 | *
|
67 | 59 | * <p>
|
68 | 60 | * Marshalling to a java.io.OutputStream:
|
69 |
| - * <blockquote> |
70 |
| - * <pre> |
71 |
| - * m.marshal( element, System.out ); |
72 |
| - * </pre> |
73 |
| - * </blockquote> |
| 61 | + * {@snippet : |
| 62 | + * m.marshal( element, System.out ); |
| 63 | + * } |
74 | 64 | *
|
75 | 65 | * <p>
|
76 | 66 | * Marshalling to a java.io.Writer:
|
77 |
| - * <blockquote> |
78 |
| - * <pre> |
79 |
| - * m.marshal( element, new PrintWriter( System.out ) ); |
80 |
| - * </pre> |
81 |
| - * </blockquote> |
| 67 | + * {@snippet : |
| 68 | + * m.marshal( element, new PrintWriter( System.out ) ); |
| 69 | + * } |
82 | 70 | *
|
83 | 71 | * <p>
|
84 | 72 | * Marshalling to a javax.xml.transform.SAXResult:
|
85 |
| - * <blockquote> |
86 |
| - * <pre> |
87 |
| - * // assume MyContentHandler instanceof ContentHandler |
88 |
| - * SAXResult result = new SAXResult( new MyContentHandler() ); |
| 73 | + * {@snippet : |
| 74 | + * // assume MyContentHandler instanceof ContentHandler |
| 75 | + * SAXResult result = new SAXResult( new MyContentHandler() ); |
89 | 76 | *
|
90 |
| - * m.marshal( element, result ); |
91 |
| - * </pre> |
92 |
| - * </blockquote> |
| 77 | + * m.marshal( element, result ); |
| 78 | + * } |
93 | 79 | *
|
94 | 80 | * <p>
|
95 | 81 | * Marshalling to a javax.xml.transform.DOMResult:
|
96 |
| - * <blockquote> |
97 |
| - * <pre> |
98 |
| - * DOMResult result = new DOMResult(); |
| 82 | + * {@snippet : |
| 83 | + * DOMResult result = new DOMResult(); |
99 | 84 | *
|
100 |
| - * m.marshal( element, result ); |
101 |
| - * </pre> |
102 |
| - * </blockquote> |
| 85 | + * m.marshal( element, result ); |
| 86 | + * } |
103 | 87 | *
|
104 | 88 | * <p>
|
105 | 89 | * Marshalling to a javax.xml.transform.StreamResult:
|
106 |
| - * <blockquote> |
107 |
| - * <pre> |
108 |
| - * StreamResult result = new StreamResult( System.out ); |
| 90 | + * {@snippet : |
| 91 | + * StreamResult result = new StreamResult( System.out ); |
109 | 92 | *
|
110 |
| - * m.marshal( element, result ); |
111 |
| - * </pre> |
112 |
| - * </blockquote> |
| 93 | + * m.marshal( element, result ); |
| 94 | + * } |
113 | 95 | *
|
114 | 96 | * <p>
|
115 | 97 | * Marshalling to a javax.xml.stream.XMLStreamWriter:
|
116 |
| - * <blockquote> |
117 |
| - * <pre> |
118 |
| - * XMLStreamWriter xmlStreamWriter = |
119 |
| - * XMLOutputFactory.newInstance().createXMLStreamWriter( ... ); |
| 98 | + * {@snippet : |
| 99 | + * XMLStreamWriter xmlStreamWriter = |
| 100 | + * XMLOutputFactory.newInstance().createXMLStreamWriter( ... ); |
120 | 101 | *
|
121 |
| - * m.marshal( element, xmlStreamWriter ); |
122 |
| - * </pre> |
123 |
| - * </blockquote> |
| 102 | + * m.marshal( element, xmlStreamWriter ); |
| 103 | + * } |
124 | 104 | *
|
125 | 105 | * <p>
|
126 | 106 | * Marshalling to a javax.xml.stream.XMLEventWriter:
|
127 |
| - * <blockquote> |
128 |
| - * <pre> |
129 |
| - * XMLEventWriter xmlEventWriter = |
130 |
| - * XMLOutputFactory.newInstance().createXMLEventWriter( ... ); |
| 107 | + * {@snippet : |
| 108 | + * XMLEventWriter xmlEventWriter = |
| 109 | + * XMLOutputFactory.newInstance().createXMLEventWriter( ... ); |
131 | 110 | *
|
132 |
| - * m.marshal( element, xmlEventWriter ); |
133 |
| - * </pre> |
134 |
| - * </blockquote> |
| 111 | + * m.marshal( element, xmlEventWriter ); |
| 112 | + * } |
135 | 113 | *
|
136 | 114 | * <p>
|
137 | 115 | * <a id="elementMarshalling"></a>
|
|
269 | 247 | * <p>
|
270 | 248 | * Class defined event callback methods allow any Jakarta XML Binding mapped class to specify
|
271 | 249 | * its own specific callback methods by defining methods with the following method signatures:
|
272 |
| - * <blockquote> |
273 |
| - * <pre> |
274 |
| - * // Invoked by Marshaller after it has created an instance of this object. |
275 |
| - * boolean beforeMarshal(Marshaller); |
| 250 | + * {@snippet : |
| 251 | + * // Invoked by Marshaller after it has created an instance of this object. |
| 252 | + * boolean beforeMarshal(Marshaller); |
276 | 253 | *
|
277 |
| - * // Invoked by Marshaller after it has marshalled all properties of this object. |
278 |
| - * void afterMarshal(Marshaller); |
279 |
| - * </pre> |
280 |
| - * </blockquote> |
| 254 | + * // Invoked by Marshaller after it has marshalled all properties of this object. |
| 255 | + * void afterMarshal(Marshaller); |
| 256 | + * } |
281 | 257 | * The class defined event callback methods should be used when the callback method requires
|
282 | 258 | * access to non-public methods and/or fields of the class.
|
283 | 259 | * <p>
|
|
0 commit comments