summaryrefslogtreecommitdiff
path: root/utils/src/main/java/at/gv/egiz/marshal/MarshallerFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'utils/src/main/java/at/gv/egiz/marshal/MarshallerFactory.java')
-rw-r--r--utils/src/main/java/at/gv/egiz/marshal/MarshallerFactory.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/utils/src/main/java/at/gv/egiz/marshal/MarshallerFactory.java b/utils/src/main/java/at/gv/egiz/marshal/MarshallerFactory.java
index ccebcc81..3ac0a86e 100644
--- a/utils/src/main/java/at/gv/egiz/marshal/MarshallerFactory.java
+++ b/utils/src/main/java/at/gv/egiz/marshal/MarshallerFactory.java
@@ -31,13 +31,17 @@ public class MarshallerFactory {
private static final Log log = LogFactory.getLog(MarshallerFactory.class);
- public static Marshaller createMarshaller(JAXBContext ctx, boolean formattedOutput) throws JAXBException {
+ public static Marshaller createMarshaller(JAXBContext ctx, boolean formattedOutput, boolean fragment) throws JAXBException {
Marshaller m = ctx.createMarshaller();
try {
if (formattedOutput) {
log.trace("setting marshaller property FORMATTED_OUTPUT");
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
}
+ if (fragment) {
+ log.trace("setting marshaller property FRAGMENT");
+ m.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
+ }
log.trace("setting marshaller property NamespacePrefixMapper");
m.setProperty("com.sun.xml.bind.namespacePrefixMapper", new NamespacePrefixMapperImpl());
} catch (PropertyException ex) {
@@ -45,8 +49,12 @@ public class MarshallerFactory {
}
return m;
}
+
+ public static Marshaller createMarshaller(JAXBContext ctx, boolean formattedOutput) throws JAXBException {
+ return createMarshaller(ctx, formattedOutput, false);
+ }
public static Marshaller createMarshaller(JAXBContext ctx) throws JAXBException {
- return createMarshaller(ctx, false);
+ return createMarshaller(ctx, false, false);
}
}