1 /* 2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. 3 */ 4 /* 5 * Licensed to the Apache Software Foundation (ASF) under one or more 6 * contributor license agreements. See the NOTICE file distributed with 7 * this work for additional information regarding copyright ownership. 8 * The ASF licenses this file to You under the Apache License, Version 2.0 9 * (the "License"); you may not use this file except in compliance with 10 * the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 */ 20 21 package com.sun.org.apache.xml.internal.serializer; 22 23 import java.util.List; 24 25 /** 26 * This interface has methods associated with the XSLT xsl:output attribues 27 * specified in the stylesheet that effect the format of the document output. 28 * 29 * In an XSLT stylesheet these attributes appear for example as: 30 * <pre> 31 * <xsl:output method="xml" omit-xml-declaration="no" indent="yes"/> 32 * </pre> 33 * The xsl:output attributes covered in this interface are: 34 * <pre> 35 * version 36 * encoding 37 * omit-xml-declarations 38 * standalone 39 * doctype-public 40 * doctype-system 41 * cdata-section-elements 42 * indent 43 * media-type 44 * </pre> 45 * 46 * The one attribute not covered in this interface is <code>method</code> as 47 * this value is implicitly chosen by the serializer that is created, for 48 * example ToXMLStream vs. ToHTMLStream or another one. 49 * 50 * This interface is only used internally within Xalan. 51 * 52 * @xsl.usage internal 53 * @LastModified: Oct 2017 54 */ 55 interface XSLOutputAttributes { 56 /** 57 * Returns the previously set value of the value to be used as the public 58 * identifier in the document type declaration (DTD). 59 * 60 *@return the public identifier to be used in the DOCTYPE declaration in the 61 * output document. 62 */ 63 public String getDoctypePublic(); 64 65 /** 66 * Returns the previously set value of the value to be used 67 * as the system identifier in the document type declaration (DTD). 68 * @return the system identifier to be used in the DOCTYPE declaration in 69 * the output document. 70 * 71 */ 72 public String getDoctypeSystem(); 73 74 /** 75 * @return the character encoding to be used in the output document. 76 */ 77 public String getEncoding(); 78 79 /** 80 * @return true if the output document should be indented to visually 81 * indicate its structure. 82 */ 83 public boolean getIndent(); 84 85 /** 86 * @return the number of spaces to indent for each indentation level. 87 */ 88 public int getIndentAmount(); 89 90 /** 91 * @return the mediatype the media-type or MIME type associated with the 92 * output document. 93 */ 94 public String getMediaType(); 95 96 /** 97 * @return true if the XML declaration is to be omitted from the output 98 * document. 99 */ 100 public boolean getOmitXMLDeclaration(); 101 102 /** 103 * @return a value of "yes" if the <code>standalone</code> delaration is to 104 * be included in the output document. 105 */ 106 public String getStandalone(); 107 108 /** 109 * @return the version of the output format. 110 */ 111 public String getVersion(); 112 113 /** 114 * Sets the value coming from the xsl:output cdata-section-elements 115 * stylesheet property. 116 * 117 * This sets the elements whose text elements are to be output as CDATA 118 * sections. 119 * @param URI_and_localNames pairs of namespace URI and local names that 120 * identify elements whose text elements are to be output as CDATA sections. 121 * The namespace of the local element must be the given URI to match. The 122 * qName is not given because the prefix does not matter, only the namespace 123 * URI to which that prefix would map matters, so the prefix itself is not 124 * relevant in specifying which elements have their text to be output as 125 * CDATA sections. 126 */ 127 public void setCdataSectionElements(List<String> URI_and_localNames); 128 129 /** Set the value coming from the xsl:output doctype-public and doctype-system stylesheet properties 130 * @param system the system identifier to be used in the DOCTYPE declaration 131 * in the output document. 132 * @param pub the public identifier to be used in the DOCTYPE declaration in 133 * the output document. 134 */ 135 public void setDoctype(String system, String pub); 136 137 /** Set the value coming from the xsl:output doctype-public stylesheet attribute. 138 * @param doctype the public identifier to be used in the DOCTYPE 139 * declaration in the output document. 140 */ 141 public void setDoctypePublic(String doctype); 142 143 /** Set the value coming from the xsl:output doctype-system stylesheet attribute. 144 * @param doctype the system identifier to be used in the DOCTYPE 145 * declaration in the output document. 146 */ 147 public void setDoctypeSystem(String doctype); 148 149 /** 150 * Sets the character encoding coming from the xsl:output encoding stylesheet attribute. 151 * @param encoding the character encoding 152 */ 153 public void setEncoding(String encoding); 154 155 /** 156 * Sets the value coming from the xsl:output indent stylesheet 157 * attribute. 158 * @param indent true if the output document should be indented to visually 159 * indicate its structure. 160 */ 161 public void setIndent(boolean indent); 162 163 /** 164 * Sets the value coming from the xsl:output media-type stylesheet attribute. 165 * @param mediatype the media-type or MIME type associated with the output 166 * document. 167 */ 168 public void setMediaType(String mediatype); 169 170 /** 171 * Sets the value coming from the xsl:output omit-xml-declaration stylesheet attribute 172 * @param b true if the XML declaration is to be omitted from the output 173 * document. 174 */ 175 public void setOmitXMLDeclaration(boolean b); 176 177 /** 178 * Sets the value coming from the xsl:output standalone stylesheet attribute. 179 * @param standalone a value of "yes" indicates that the 180 * <code>standalone</code> delaration is to be included in the output 181 * document. 182 */ 183 public void setStandalone(String standalone); 184 185 /** 186 * Sets the value coming from the xsl:output version attribute. 187 * @param version the version of the output format. 188 */ 189 public void setVersion(String version); 190 191 /** 192 * Get the value for a property that affects seraialization, 193 * if a property was set return that value, otherwise return 194 * the default value, otherwise return null. 195 * @param name The name of the property, which is just the local name 196 * if it is in no namespace, but is the URI in curly braces followed by 197 * the local name if it is in a namespace, for example: 198 * <ul> 199 * <li> "encoding" 200 * <li> "method" 201 * <li> "{http://xml.apache.org/xalan}indent-amount" 202 * <li> "{http://xml.apache.org/xalan}line-separator" 203 * </ul> 204 * @return The value of the parameter 205 */ 206 public String getOutputProperty(String name); 207 208 /** 209 * Get the default value for a property that affects seraialization, 210 * or null if there is none. It is possible that a non-default value 211 * was set for the property, however the value returned by this method 212 * is unaffected by any non-default settings. 213 * @param name The name of the property. 214 * @return The default value of the parameter, or null if there is no default value. 215 */ 216 public String getOutputPropertyDefault(String name); 217 218 /** 219 * Set the non-default value for a property that affects seraialization. 220 * @param name The name of the property, which is just the local name 221 * if it is in no namespace, but is the URI in curly braces followed by 222 * the local name if it is in a namespace, for example: 223 * <ul> 224 * <li> "encoding" 225 * <li> "method" 226 * <li> "{http://xml.apache.org/xalan}indent-amount" 227 * <li> "{http://xml.apache.org/xalan}line-separator" 228 * </ul> 229 * @val The non-default value of the parameter 230 */ 231 public void setOutputProperty(String name, String val); 232 233 /** 234 * Set the default value for a property that affects seraialization. 235 * @param name The name of the property, which is just the local name 236 * if it is in no namespace, but is the URI in curly braces followed by 237 * the local name if it is in a namespace, for example: 238 * <ul> 239 * <li> "encoding" 240 * <li> "method" 241 * <li> "{http://xml.apache.org/xalan}indent-amount" 242 * <li> "{http://xml.apache.org/xalan}line-separator" 243 * </ul> 244 * @val The default value of the parameter 245 */ 246 public void setOutputPropertyDefault(String name, String val); 247 }