001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the "License"); 007 * you may not use this file except in compliance with the License. 008 * You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 /* 019 * $Id: XSLOutputAttributes.java 468654 2006-10-28 07:09:23Z minchau $ 020 */ 021 package org.apache.xml.serializer; 022 023 import java.util.Vector; 024 025 /** 026 * This interface has methods associated with the XSLT xsl:output attribues 027 * specified in the stylesheet that effect the format of the document output. 028 * 029 * In an XSLT stylesheet these attributes appear for example as: 030 * <pre> 031 * <xsl:output method="xml" omit-xml-declaration="no" indent="yes"/> 032 * </pre> 033 * The xsl:output attributes covered in this interface are: 034 * <pre> 035 * version 036 * encoding 037 * omit-xml-declarations 038 * standalone 039 * doctype-public 040 * doctype-system 041 * cdata-section-elements 042 * indent 043 * media-type 044 * </pre> 045 * 046 * The one attribute not covered in this interface is <code>method</code> as 047 * this value is implicitly chosen by the serializer that is created, for 048 * example ToXMLStream vs. ToHTMLStream or another one. 049 * 050 * This interface is only used internally within Xalan. 051 * 052 * @xsl.usage internal 053 */ 054 interface XSLOutputAttributes 055 { 056 /** 057 * Returns the previously set value of the value to be used as the public 058 * identifier in the document type declaration (DTD). 059 * 060 *@return the public identifier to be used in the DOCTYPE declaration in the 061 * output document. 062 */ 063 public String getDoctypePublic(); 064 /** 065 * Returns the previously set value of the value to be used 066 * as the system identifier in the document type declaration (DTD). 067 * @return the system identifier to be used in the DOCTYPE declaration in 068 * the output document. 069 * 070 */ 071 public String getDoctypeSystem(); 072 /** 073 * @return the character encoding to be used in the output document. 074 */ 075 public String getEncoding(); 076 /** 077 * @return true if the output document should be indented to visually 078 * indicate its structure. 079 */ 080 public boolean getIndent(); 081 082 /** 083 * @return the number of spaces to indent for each indentation level. 084 */ 085 public int getIndentAmount(); 086 /** 087 * @return the mediatype the media-type or MIME type associated with the 088 * output document. 089 */ 090 public String getMediaType(); 091 /** 092 * @return true if the XML declaration is to be omitted from the output 093 * document. 094 */ 095 public boolean getOmitXMLDeclaration(); 096 /** 097 * @return a value of "yes" if the <code>standalone</code> delaration is to 098 * be included in the output document. 099 */ 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 }