Skip to content

Commit 3d6dcb7

Browse files
committed
Fixed SWS-133: CastorMarshaller ignoreExtraAttributes & Elements
1 parent 4d14a0b commit 3d6dcb7

File tree

8 files changed

+295
-221
lines changed

8 files changed

+295
-221
lines changed

oxm/build-maven2.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</target>
3333

3434
<target name="generate-test-castor" depends="generate-test-init" unless="skip">
35-
<taskdef name="castor-srcgen" classname="org.exolab.castor.tools.ant.taskdefs.CastorSourceGenTask"
35+
<taskdef name="castor-srcgen" classname="org.castor.anttask.CastorCodeGenTask"
3636
classpathref="maven.test.classpath"/>
3737
<castor-srcgen types="j2" warnings="false" file="${schema}" todir="${generate.target.directory}"
3838
package="org.springframework.oxm.castor"/>

oxm/pom.xml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
34
<parent>
45
<artifactId>spring-ws</artifactId>
56
<groupId>org.springframework.ws</groupId>
@@ -29,8 +30,8 @@
2930
<configuration>
3031
<tasks>
3132
<ant antfile="${basedir}/build-maven2.xml" inheritRefs="true">
32-
<property name="maven.test.skip" value="${maven.test.skip}" />
33-
<target name="generate-test-sources" />
33+
<property name="maven.test.skip" value="${maven.test.skip}"/>
34+
<target name="generate-test-sources"/>
3435
</ant>
3536
</tasks>
3637
<testSourceRoot>${project.build.directory}/generated-sources/test/java</testSourceRoot>
@@ -45,8 +46,8 @@
4546
<configuration>
4647
<tasks>
4748
<ant antfile="${basedir}/build-maven2.xml" inheritRefs="true">
48-
<property name="maven.test.skip" value="${maven.test.skip}" />
49-
<target name="test-compile" />
49+
<property name="maven.test.skip" value="${maven.test.skip}"/>
50+
<target name="test-compile"/>
5051
</ant>
5152
</tasks>
5253
</configuration>
@@ -55,6 +56,13 @@
5556
</goals>
5657
</execution>
5758
</executions>
59+
<dependencies>
60+
<dependency>
61+
<groupId>org.codehaus.castor</groupId>
62+
<artifactId>castor-codegen-anttask</artifactId>
63+
<version>1.1</version>
64+
</dependency>
65+
</dependencies>
5866
</plugin>
5967
</plugins>
6068
</build>

oxm/src/main/java/org/springframework/oxm/AbstractMarshaller.java

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -59,38 +59,11 @@
5959
*/
6060
public abstract class AbstractMarshaller implements Marshaller, Unmarshaller {
6161

62-
/**
63-
* Logger available to subclasses.
64-
*/
62+
/** Logger available to subclasses. */
6563
protected final Log logger = LogFactory.getLog(getClass());
6664

67-
private boolean validating = false;
68-
69-
private boolean namespaceAware = true;
70-
7165
private DocumentBuilderFactory documentBuilderFactory;
7266

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-
9467
/**
9568
* Marshals the object graph with the given root into the provided <code>javax.xml.transform.Result</code>.
9669
* <p/>
@@ -103,9 +76,9 @@ public boolean isValidating() {
10376
* @throws IOException if an I/O exception occurs
10477
* @throws IllegalArgumentException if <code>result</code> if neither a <code>DOMResult</code>,
10578
* <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)
10982
*/
11083
public final void marshal(Object graph, Result result) throws XmlMappingException, IOException {
11184
if (result instanceof DOMResult) {
@@ -183,8 +156,8 @@ protected DocumentBuilder createDocumentBuilder(DocumentBuilderFactory factory)
183156
*/
184157
protected DocumentBuilderFactory createDocumentBuilderFactory() throws ParserConfigurationException {
185158
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
186-
factory.setValidating(validating);
187-
factory.setNamespaceAware(namespaceAware);
159+
factory.setValidating(false);
160+
factory.setNamespaceAware(true);
188161
return factory;
189162
}
190163

@@ -246,7 +219,7 @@ else if (staxResult.getXMLEventWriter() != null) {
246219
* @param graph the root of the object graph to marshal
247220
* @param saxResult the <code>SAXResult</code>
248221
* @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)
250223
*/
251224
protected void marshalSaxResult(Object graph, SAXResult saxResult) throws XmlMappingException {
252225
ContentHandler contentHandler = saxResult.getHandler();
@@ -340,7 +313,7 @@ else if (staxSource.getXMLEventReader() != null) {
340313
* @return the object graph
341314
* @throws XmlMappingException if the given source cannot be mapped to an object
342315
* @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)
344317
*/
345318
protected Object unmarshalSaxSource(SAXSource saxSource) throws XmlMappingException, IOException {
346319
if (saxSource.getXMLReader() == null) {

0 commit comments

Comments
 (0)