KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > xdoclet > tagshandler > XmlTagsHandler


1 /*
2  * Copyright (c) 2001, 2002 The XDoclet team
3  * All rights reserved.
4  */

5 package xdoclet.tagshandler;
6
7 import xdoclet.XDocletException;
8 import xdoclet.XDocletMessages;
9 import xdoclet.XDocletTagSupport;
10 import xdoclet.XmlSubTask;
11 import xdoclet.util.Translator;
12
13 /**
14  * XML template support tags.
15  *
16  * @author <a HREF="mailto:stevensa@users.sourceforge.net">Andrew Stevens</a>
17  * @created Dec 20, 2001
18  * @xdoclet.taghandler namespace="Xml"
19  * @version $Revision: 1.7 $
20  */

21 public class XmlTagsHandler extends XDocletTagSupport
22 {
23     /**
24      * Returns the DTD's public ID for an XML template.
25      *
26      * @return The public ID
27      * @exception XDocletException Description of Exception
28      * @see xdoclet.XmlSubTask#getPublicId()
29      * @doc.tag type="content"
30      */

31     public String JavaDoc publicId() throws XDocletException
32     {
33         try {
34             XmlSubTask subTask = (XmlSubTask) getDocletContext().getActiveSubTask();
35
36             return subTask.getPublicId();
37         }
38         catch (ClassCastException JavaDoc ex) {
39             throw new XDocletException(ex, Translator.getString(XDocletMessages.class, XDocletMessages.NO_XML_TAGS_ALLOWED));
40         }
41     }
42
43
44     /**
45      * Returns the DTD's system ID for an XML template.
46      *
47      * @return The system ID
48      * @exception XDocletException Description of Exception
49      * @see xdoclet.XmlSubTask#getSystemId()
50      * @doc.tag type="content"
51      */

52     public String JavaDoc systemId() throws XDocletException
53     {
54         try {
55             XmlSubTask subTask = (XmlSubTask) getDocletContext().getActiveSubTask();
56
57             return subTask.getSystemId();
58         }
59         catch (ClassCastException JavaDoc ex) {
60             throw new XDocletException(ex, Translator.getString(XDocletMessages.class, XDocletMessages.NO_XML_TAGS_ALLOWED));
61         }
62     }
63
64
65     /**
66      * Returns the schema for an XML template.
67      *
68      * @return The schema
69      * @exception XDocletException Description of Exception
70      * @see xdoclet.XmlSubTask#getSchema()
71      * @doc.tag type="content"
72      */

73     public String JavaDoc schema() throws XDocletException
74     {
75         try {
76             XmlSubTask subTask = (XmlSubTask) getDocletContext().getActiveSubTask();
77
78             return subTask.getSchema();
79         }
80         catch (ClassCastException JavaDoc ex) {
81             throw new XDocletException(ex, Translator.getString(XDocletMessages.class, XDocletMessages.NO_XML_TAGS_ALLOWED));
82         }
83     }
84 }
85
Popular Tags