|
|
@@ -0,0 +1,138 @@
|
|
|
+/*
|
|
|
+ * @author Ranides Atterwim <ranides@gmail.com>
|
|
|
+ * @copyright Ranides Atterwim
|
|
|
+ * @license WTFPL
|
|
|
+ * @url http://ranides.net/projects/assira
|
|
|
+ */
|
|
|
+
|
|
|
+package net.ranides.assira.xml;
|
|
|
+
|
|
|
+import javax.xml.transform.OutputKeys;
|
|
|
+
|
|
|
+/**
|
|
|
+ *
|
|
|
+ * @author Ranides Atterwim <ranides@gmail.com>
|
|
|
+ */
|
|
|
+public enum XMLOptions {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @see OutputKeys#CDATA_SECTION_ELEMENTS
|
|
|
+ */
|
|
|
+ CDATA_SECTION_ELEMENTS(OutputKeys.CDATA_SECTION_ELEMENTS),
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @see OutputKeys#DOCTYPE_PUBLIC
|
|
|
+ */
|
|
|
+ DOCTYPE_PUBLIC(OutputKeys.DOCTYPE_PUBLIC),
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @see OutputKeys#DOCTYPE_SYSTEM
|
|
|
+ */
|
|
|
+ DOCTYPE_SYSTEM(OutputKeys.DOCTYPE_SYSTEM),
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @see OutputKeys#ENCODING
|
|
|
+ */
|
|
|
+ ENCODING(OutputKeys.ENCODING),
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @see OutputKeys#INDENT
|
|
|
+ */
|
|
|
+ INDENT(OutputKeys.INDENT),
|
|
|
+
|
|
|
+ /**
|
|
|
+ * The non-standard property key to use to set the
|
|
|
+ * number of whitepaces to indent by, per indentation level,
|
|
|
+ * if indent="yes".
|
|
|
+ */
|
|
|
+ INDENT_AMOUNT(true, "indent-amount"),
|
|
|
+
|
|
|
+ /**
|
|
|
+ * The non-standard property key to use to set the
|
|
|
+ * line separator if indent="yes"
|
|
|
+ */
|
|
|
+ INDENT_ENDL(true, "line-separator"),
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @see OutputKeys#MEDIA_TYPE
|
|
|
+ */
|
|
|
+ MEDIA_TYPE(OutputKeys.MEDIA_TYPE),
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @see OutputKeys#METHOD
|
|
|
+ */
|
|
|
+ METHOD(OutputKeys.METHOD),
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @see OutputKeys#OMIT_XML_DECLARATION
|
|
|
+ */
|
|
|
+ OMIT_XML_DECLARATION(OutputKeys.OMIT_XML_DECLARATION),
|
|
|
+
|
|
|
+ /**
|
|
|
+ * This non-standard property key is used to set a value of "yes"
|
|
|
+ * if the META tag should be omitted where it would otherwise be supplied.
|
|
|
+ */
|
|
|
+ OMIT_META_TAG(true, "omit-meta-tag"),
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @see OutputKeys#STANDALONE
|
|
|
+ */
|
|
|
+ STANDALONE(OutputKeys.STANDALONE),
|
|
|
+
|
|
|
+ /**
|
|
|
+ * This non-standard, Oracle-impl only property key is used as if OutputKeys.STANDALONE is specified but
|
|
|
+ * without writing it out in the declaration; It can be used to reverse the change by Xalan patch 1495.
|
|
|
+ * Since Xalan patch 1495 can cause incompatible behavior, this property is add for application to neutralize
|
|
|
+ * the effect of Xalan patch 1495
|
|
|
+ */
|
|
|
+ STANDALONE_DEFAULT("http://www.oracle.com/xml/is-standalone"),
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @see OutputKeys#VERSION
|
|
|
+ */
|
|
|
+ VERSION(OutputKeys.VERSION),
|
|
|
+
|
|
|
+ /**
|
|
|
+ * This non-standard property key is used to set the name of the fully qualified
|
|
|
+ * Java class that implements the ContentHandler interface.
|
|
|
+ *
|
|
|
+ * Fully qualified name of class with a default constructor that
|
|
|
+ * implements the ContentHandler interface, where the result tree events
|
|
|
+ * will be sent to.
|
|
|
+ */
|
|
|
+ CONTENT_HANDLER(true, "content-handler"),
|
|
|
+
|
|
|
+ /**
|
|
|
+ * This non-standard property key is used to specify
|
|
|
+ * the name of the property file that specifies character to entity reference mappings.
|
|
|
+ */
|
|
|
+ ENTITIES(true, "entities"),
|
|
|
+
|
|
|
+ /**
|
|
|
+ * This non-standard property key is used to set a value of "yes"
|
|
|
+ * if the href values for HTML serialization should use %xx escaping.
|
|
|
+ */
|
|
|
+ USE_URL_ESCAPING(true, "use-url-escaping"),
|
|
|
+
|
|
|
+ ;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @see com.sun.org.apache.xml.internal.serializer.OutputPropertiesFactory
|
|
|
+ */
|
|
|
+ private static final String NS = "{http://xml.apache.org/xalan}";
|
|
|
+
|
|
|
+ private final String key;
|
|
|
+
|
|
|
+ private XMLOptions(String key) {
|
|
|
+ this.key = key;
|
|
|
+ }
|
|
|
+
|
|
|
+ private XMLOptions(boolean prefix, String key) {
|
|
|
+ this.key = prefix ? NS + key : key;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String key() {
|
|
|
+ return key;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|