01: // Copyright 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package org.apache.tapestry.internal.parser;
16:
17: import org.apache.tapestry.ioc.Location;
18:
19: /**
20: * Represents the presence of a Document Type declaration within a template. The Document type
21: * declaration will be output to the client. In the event that multiple declarations are encountered
22: * (a page and one or more nested components all declare a document type), the first document type
23: * declared will be used.
24: */
25: public class DTDToken extends TemplateToken {
26: private final String _name;
27:
28: private final String _publicId;
29:
30: private final String _systemId;
31:
32: public DTDToken(String name, String publicId, String systemId,
33: Location location) {
34: super (TokenType.DTD, location);
35:
36: _name = name;
37: _publicId = publicId;
38: _systemId = systemId;
39: }
40:
41: /** Returns the doctype name (the name of the document root element) */
42: public String getName() {
43: return _name;
44: }
45:
46: /** Returns the public identifier of the DTD */
47: public String getPublicId() {
48: return _publicId;
49: }
50:
51: /** Returns the system identifier of the DTD */
52: public String getSystemId() {
53: return _systemId;
54: }
55:
56: public String toString() {
57: return String.format("DTD[name=%s; publicId=%s; systemId=%s]",
58: _name, _publicId, _systemId);
59: }
60: }
|