KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > icl > saxon > style > SAXONDoctype


1 package com.icl.saxon.style;
2 import com.icl.saxon.tree.AttributeCollection;
3 import com.icl.saxon.*;
4 import com.icl.saxon.expr.*;
5 import com.icl.saxon.output.*;
6 import javax.xml.transform.*;
7
8 import java.io.*;
9 import java.util.*;
10
11 /**
12 * A saxon:doctype element in the stylesheet.<BR>
13 */

14
15 public class SAXONDoctype extends StyleElement {
16
17     /**
18     * Determine whether this node is an instruction.
19     * @return true - it is an instruction
20     */

21
22     public boolean isInstruction() {
23         return true;
24     }
25
26     /**
27     * Determine whether this type of element is allowed to contain a template-body
28     * @return true: yes, it may contain a template-body
29     */

30
31     public boolean mayContainTemplateBody() {
32         return true;
33     }
34
35     public void prepareAttributes() throws TransformerConfigurationException {
36
37         AttributeCollection atts = getAttributeList();
38         for (int a=0; a<atts.getLength(); a++) {
39             int nc = atts.getNameCode(a);
40             checkUnknownAttribute(nc);
41         }
42
43     }
44
45     public void validate() throws TransformerConfigurationException {
46         checkWithinTemplate();
47     }
48
49     public void process(Context context) throws TransformerException
50     {
51         Controller c = context.getController();
52         Outputter old = c.getOutputter();
53         Properties props = old.getOutputProperties();
54         
55         DTDEmitter emitter = new DTDEmitter();
56         emitter.setUnderlyingEmitter(old.getEmitter());
57         
58         c.changeOutputDestination(props, emitter);
59
60         processChildren(context);
61
62         c.resetOutputDestination(old);
63
64         //old.write(emitter.getDTD());
65
}
66
67 }
68 //
69
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
70
// you may not use this file except in compliance with the License. You may obtain a copy of the
71
// License at http://www.mozilla.org/MPL/
72
//
73
// Software distributed under the License is distributed on an "AS IS" basis,
74
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
75
// See the License for the specific language governing rights and limitations under the License.
76
//
77
// The Original Code is: all this file.
78
//
79
// The Initial Developer of the Original Code is
80
// Michael Kay of International Computers Limited (mhkay@iclway.co.uk).
81
//
82
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
83
//
84
// Contributor(s): none.
85
//
86
Popular Tags