[XMLBEANS-548] support adding standalone flag to xml declaration
git-svn-id: https://svn.apache.org/repos/asf/xmlbeans/trunk@1869599 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/store/org/apache/xmlbeans/impl/store/Saver.java b/src/store/org/apache/xmlbeans/impl/store/Saver.java
index 7250ed7..2f289b2 100755
--- a/src/store/org/apache/xmlbeans/impl/store/Saver.java
+++ b/src/store/org/apache/xmlbeans/impl/store/Saver.java
@@ -911,9 +911,16 @@
if (version == null)
version = "1.0";
+ Boolean standalone = null;
+ if (props != null && props.get(XmlDocumentProperties.STANDALONE) != null)
+ standalone = Boolean.valueOf("yes".equals(props.get(XmlDocumentProperties.STANDALONE)));
+
emit("<?xml version=\"");
emit(version);
- emit("\" encoding=\"" + encoding + "\"?>" + _newLine);
+ emit( "\" encoding=\"" + encoding + "\"");
+ if (standalone != null)
+ emit( " standalone=\"" + (standalone.booleanValue() ? "yes" : "no") + "\"");
+ emit( "?>" + _newLine );
}
}