59
59
*/
60
60
public abstract class AbstractMarshaller implements Marshaller , Unmarshaller {
61
61
62
- /**
63
- * Logger available to subclasses.
64
- */
62
+ /** Logger available to subclasses. */
65
63
protected final Log logger = LogFactory .getLog (getClass ());
66
64
67
- private boolean validating = false ;
68
-
69
- private boolean namespaceAware = true ;
70
-
71
65
private DocumentBuilderFactory documentBuilderFactory ;
72
66
73
- /**
74
- * Set whether or not the XML parser should be XML namespace aware. Default is <code>true</code>.
75
- */
76
- public void setNamespaceAware (boolean namespaceAware ) {
77
- this .namespaceAware = namespaceAware ;
78
- }
79
-
80
- /**
81
- * Set if the XML parser should validate the document. Default is <code>false</code>.
82
- */
83
- public void setValidating (boolean validating ) {
84
- this .validating = validating ;
85
- }
86
-
87
- /**
88
- * Returns whether the XML parser should validate the document. Default is <code>false</code>.
89
- */
90
- public boolean isValidating () {
91
- return validating ;
92
- }
93
-
94
67
/**
95
68
* Marshals the object graph with the given root into the provided <code>javax.xml.transform.Result</code>.
96
69
* <p/>
@@ -103,9 +76,9 @@ public boolean isValidating() {
103
76
* @throws IOException if an I/O exception occurs
104
77
* @throws IllegalArgumentException if <code>result</code> if neither a <code>DOMResult</code>,
105
78
* <code>SAXResult</code>, <code>StreamResult</code>
106
- * @see #marshalDomResult(Object, javax.xml.transform.dom.DOMResult)
107
- * @see #marshalSaxResult(Object, javax.xml.transform.sax.SAXResult)
108
- * @see #marshalStreamResult(Object, javax.xml.transform.stream.StreamResult)
79
+ * @see #marshalDomResult(Object,javax.xml.transform.dom.DOMResult)
80
+ * @see #marshalSaxResult(Object,javax.xml.transform.sax.SAXResult)
81
+ * @see #marshalStreamResult(Object,javax.xml.transform.stream.StreamResult)
109
82
*/
110
83
public final void marshal (Object graph , Result result ) throws XmlMappingException , IOException {
111
84
if (result instanceof DOMResult ) {
@@ -183,8 +156,8 @@ protected DocumentBuilder createDocumentBuilder(DocumentBuilderFactory factory)
183
156
*/
184
157
protected DocumentBuilderFactory createDocumentBuilderFactory () throws ParserConfigurationException {
185
158
DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance ();
186
- factory .setValidating (validating );
187
- factory .setNamespaceAware (namespaceAware );
159
+ factory .setValidating (false );
160
+ factory .setNamespaceAware (true );
188
161
return factory ;
189
162
}
190
163
@@ -246,7 +219,7 @@ else if (staxResult.getXMLEventWriter() != null) {
246
219
* @param graph the root of the object graph to marshal
247
220
* @param saxResult the <code>SAXResult</code>
248
221
* @throws XmlMappingException if the given object cannot be marshalled to the result
249
- * @see #marshalSaxHandlers(Object, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler)
222
+ * @see #marshalSaxHandlers(Object,org.xml.sax.ContentHandler,org.xml.sax.ext.LexicalHandler)
250
223
*/
251
224
protected void marshalSaxResult (Object graph , SAXResult saxResult ) throws XmlMappingException {
252
225
ContentHandler contentHandler = saxResult .getHandler ();
@@ -340,7 +313,7 @@ else if (staxSource.getXMLEventReader() != null) {
340
313
* @return the object graph
341
314
* @throws XmlMappingException if the given source cannot be mapped to an object
342
315
* @throws IOException if an I/O Exception occurs
343
- * @see #unmarshalSaxReader(org.xml.sax.XMLReader, org.xml.sax.InputSource)
316
+ * @see #unmarshalSaxReader(org.xml.sax.XMLReader,org.xml.sax.InputSource)
344
317
*/
345
318
protected Object unmarshalSaxSource (SAXSource saxSource ) throws XmlMappingException , IOException {
346
319
if (saxSource .getXMLReader () == null ) {
0 commit comments