KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > icl > saxon > output > SaxonOutputKeys


1 package com.icl.saxon.output;
2 import javax.xml.transform.OutputKeys JavaDoc;
3
4 /**
5  * Provides string constants that can be used to set
6  * output properties for a Transformer, or to retrieve
7  * output properties from a Transformer or Templates object.
8  *
9  * These keys are private Saxon keys that supplement the standard keys
10  * defined in javax.xml.transform.OutputKeys
11  */

12  
13 public class SaxonOutputKeys {
14
15     /**
16      * indentSpaces = integer.
17      *
18      * <p>Defines the number of spaces used for indentation of output</p>
19      */

20      
21     public static final String JavaDoc INDENT_SPACES = "{http://icl.com/saxon}indent-spaces";
22
23     /**
24      * include-html-meta-tag = "yes" | "no".
25      *
26      * <p>Indicates whether the META tag is to be added to HTML output</p>
27      */

28      
29     public static final String JavaDoc OMIT_META_TAG = "{http://icl.com/saxon}omit-meta-tag";
30
31     /**
32      * representation = rep1[;rep2].
33      *
34      * <p>Indicates the preferred way of representing non-ASCII characters in HTML
35      * and XML output. rep1 is for characters in the range 128-256, rep2 for those
36      * above 256.</p>
37      */

38     public static final String JavaDoc CHARACTER_REPRESENTATION = "{http://icl.com/saxon}character-representation";
39
40     /**
41      * saxon:next-in-chain = URI.
42      *
43      * <p>Indicates that the output is to be piped into another XSLT stylesheet
44      * to perform another transformation. The auxiliary property NEXT_IN_CHAIN_BASE_URI
45      * records the base URI of the stylesheet element where this attribute was found.</p>
46      */

47     public static final String JavaDoc NEXT_IN_CHAIN = "{http://icl.com/saxon}next-in-chain";
48     public static final String JavaDoc NEXT_IN_CHAIN_BASE_URI = "{http://icl.com/saxon}next-in-chain-base-uri";
49
50     /**
51     * Check that a supplied output key is valid
52     */

53     
54     public static final boolean isValidOutputKey(String JavaDoc key) {
55         if (key.startsWith("{")) {
56             if (key.startsWith("{http://icl.com/saxon}")) {
57                 return
58                     key.equals(INDENT_SPACES) ||
59                     key.equals(OMIT_META_TAG) ||
60                     key.equals(CHARACTER_REPRESENTATION) ||
61                     key.equals(NEXT_IN_CHAIN) ||
62                     key.equals(NEXT_IN_CHAIN_BASE_URI) ;
63             } else {
64                 return true;
65             }
66         } else {
67             return
68                 key.equals(OutputKeys.CDATA_SECTION_ELEMENTS) ||
69                 key.equals(OutputKeys.DOCTYPE_PUBLIC) ||
70                 key.equals(OutputKeys.DOCTYPE_SYSTEM) ||
71                 key.equals(OutputKeys.ENCODING) ||
72                 key.equals(OutputKeys.INDENT) ||
73                 key.equals(OutputKeys.MEDIA_TYPE) ||
74                 key.equals(OutputKeys.METHOD) ||
75                 key.equals(OutputKeys.OMIT_XML_DECLARATION) ||
76                 key.equals(OutputKeys.STANDALONE) ||
77                 key.equals(OutputKeys.VERSION);
78         }
79     }
80
81 }
82
Popular Tags