KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > xml > xmlc > metadata > HTMLTagSet


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: HTMLTagSet.java,v 1.1.1.1 2003/03/10 16:36:23 taweili Exp $
22  */

23
24 package org.enhydra.xml.xmlc.metadata;
25
26 import org.enhydra.xml.xmlc.XMLCError;
27 import org.w3c.dom.Document JavaDoc;
28
29 /**
30  * Add a predefined set of proprietary HTML tag and attributes to the list of
31  * valid HTML tags. This option is only used by the <CODE>tidy</CODE> parser.
32  */

33 public class HTMLTagSet extends MetaDataElement {
34     /**
35      * Element name.
36      */

37     public static final String JavaDoc TAG_NAME = "htmlTagSet";
38
39     /**
40      * Attribute names.
41      */

42     private static final String JavaDoc TAGSET_ATTR = "tagSet";
43
44     /**
45      * Constructor.
46      */

47     public HTMLTagSet(Document JavaDoc ownerDoc) {
48         super(ownerDoc, TAG_NAME);
49     }
50
51     /**
52      * Get the tagSet to use.
53      */

54     public HTMLTagSetType getTagSet() {
55         return HTMLTagSetType.getType(getAttributeNull(TAGSET_ATTR));
56     }
57
58     /**
59      * Set the tagSet to use.
60      */

61     public void setTagSet(HTMLTagSetType value) {
62         if (value == null) {
63             removeAttribute(TAGSET_ATTR);
64         } else {
65             setAttribute(TAGSET_ATTR, value.getName());
66         }
67     }
68
69     /**
70      * Get the HTMLTagSetDef object for the tag set in the element.
71      */

72     public HTMLTagSetDef getTagSetDef() {
73         HTMLTagSetType tagSet = getTagSet();
74         if (tagSet == null) {
75             throw new XMLCError("HTML tag set not defined");
76         } else if (tagSet == HTMLTagSetType.CYBERSTUDIO) {
77             return HTMLCyberStudioTagSet.getTagSet();
78         } else {
79             throw new XMLCError("Bug: Unknown HTML tag set");
80         }
81     }
82 }
83
Popular Tags