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