TLDX File Contents

You create a TLDX file to specify characteristics of a tag library extension. For example, a TLDX fie specifies what should happen when the contents of a tag are deleted, it names the class that provides logic for rendering the tag at design time, and so on.

The structure of a TLDX file is similar to that of a TLD file. They have a few of the same elements, and both list the same tags and attributes. However, for each tag and attribute, a TLDX file describes IDE-specific functionality.

Click the following elements to view a description of each.

<taglib>
    <uri>
    <palettegenerator>
    <link>
        <prefix>
        <uri>
    <tag>
        <name>
        <deletewhenempty>
        <requiredparent>
        <requiredchild>
        <illegalancestor>
        <bodycontent-pref>
        <output>
        <renderer>
        <whitespace>
        <data-palette-driver>
        <attribute>
            <name>
            <category>
            <propertyclass>
            <deprecated>
            <validationrule>
            <validationmessage>
            <extype>
            <reftype>

Here is an overview of the syntax for a TLDX file:

<taglib>
    <uri>uriAssociatedWithATaglib</uri>
    <palettegenerator>package.PaletteGeneratorClassName</palettegenerator>
    <link>
        <prefix>prefixUsedWhenLinkingATaglib</prefix>
        <uri>uriAssociatedWithLinkedTagLib</uri>
    </link>
    <tag>
        <name>nameOfextendedTag</name>
        <deletewhenempty>true|false</deletewhenempty>
        <requiredparent>Space separated list of tag names</requiredparent>
        <requiredchild>Space separated list of tag names</requiredchild>
        <illegalancestor>Space separated list of tag names</illegalancestor>
        <bodycontent-pref>empty|JSP</bodycontent-pref>
        <output><![CDATA[<b>Text that should be displayed in Design View.</b>]]></output>
        <renderer>package.RendererClassName</renderer>
        <whitespace>preserve|indent|inline|block</whitespace>
        <data-palette-driver>package.DataPaletteDriverClass</data-palette-driver>
        <attribute>
            <name>nameOfExtendedAttribute</name>
            <category>nameOfPropertyEditorGroup</category>
            <propertyclass>package.PropertyBuilderClass</propertyclass>
            <deprecated>true</deprecated>
            <validationrule>regularExpressionOrExpressions</validationrule>
            <validationmessage>Message to user for invalid value</validationmessage>
            <extype>java-name|java-id</extype>
            <reftype>reftype</reftype>
        </attribute>
    </tag>
</taglib>

<taglib> Element

Required. The root of this extension descriptor. The <taglib> element describes extensions to the tags in a custom tag library. Note that the <uri> child element must match the tag library you are extending. <tag> child elements correspond to tags defined in the library.

<taglib>
    <uri>
    <palettegenerator>
    <link>
    <tag>

Syntax

<taglib>
    Child elements for defining specifics of the tag library extension.
</taglib>

<uri> Element

Required. The URI from the taglib with which this TLDX is associated. This is the value of the corresponding TLD file's <uri> element.

<taglib>
    <uri>

Syntax

<uri>uriAssociatedWithATaglib</uri>

<palettegenerator> Element

Specifies a class that extends com.bea.ide.jspdesigner.PaletteGenerator, and which defines how a library's tags appear in the palette.

The tag group will also appear in the main Insert drop-down menu. manifestation in TDK: open TaglibExtDevKit/TaglibWebProject/demo.jsp in design view, and notice the "TDK tags" group in the palette. you will find the code that generates this group at TaglibExtDevKit/TldxHandlers/TDK/PaletteGenerator.java

<taglib>
    <palettegenerator>

Syntax

<palettegenerator>package.PaletteGeneratorClassName</palettegenerator> 

<link> Element

Specifies a reference to another tag library that may be used in the <requiredparent> or <requiredchild> elements. May occur multiple times in a TLDX.

<taglib>
    <link>
        <prefix>
        <uri>

Remarks

You can use this element, along with <requiredparent> or <requiredchild>, to enforce that a tag in the current library requires a tag in another library as its parent or child. For an example, see the netui-tags-html.tldx file installed with WebLogic Workshop. In that file, the following <link> element specifies the prefix and URI for the other tag library:

<link>
    <prefix>data</prefix>
    <uri>http://www.bea.com/workshop/netui-tags-databinding-1.0</uri> 
</link> 
With this prefix specified in the <link> element, it is used in the <requiredparent> element. The following TLDX code lists several tags which must be parents, including three from the databinding library specified above.
 <requiredparent>label select textArea textBox data:anchorColumn data:basicColumn data:expressionColumn</requiredparent> 

<prefix> Element

Prefix that will be used in the list of tag names for <requiredparent> or <requiredchild> elements.

<taglib>
    <link>
        <prefix>

Syntax

<prefix>prefixUsedWhenLinkingATaglib</prefix>

<uri> Element

Specifies the URI from the other tag library.

<taglib>
    <link>
        <uri>

Syntax

<uri>uriAssociatedWithLinkedTagLib</uri>

<tag> Element

Describes extensions for a tag defined in the corresponding TLD file. There must be a <tag> element in the TLDX for each <tag> element in the TLD.

<taglib>
    <tag>
        <name>
        <deletewhenempty>
        <requiredparent>
        <requiredchild>
        <illegalancestor>
        <bodycontent-pref>
        <output>
        <renderer>
        <whitespace>
        <data-palette-driver>
        <attribute>

Syntax

<tag>
    Child elements describing extensions for a specific tag.
</tag>

<name> Element

Required. The name of the tag being extended. This value must match the name of the tag defined in the corresponding TLD.

<taglib>
    <tag>
        <name>

Syntax

<name>nameOfextendedTag</name>

<deletewhenempty> Element

Optional. true if the extended tag should be deleted from the JSP page at design time when one of the following occurs:

<taglib>
    <tag>
        <deletewhenempty>

Syntax

<deletewhenempty>true | false</deletewhenempty>

<requiredchild> Element

Optional. A space-separated list of tags which can be a child of this tag; only tags listed here may be children of the tag specified by the <name> element. In addition, there are two special values for this element:

<taglib>
    <tag>
        <requiredchild>

Syntax

<requiredchild>Space separated list of tag names</requiredchild>

<requiredparent> Element

Optional. A space-separated list of names of tags which can be a parent of this tag. This element allows you to enforce a list of tags that are valid tags for a given tag. An invalid parent tag will give a warning in the source editor, such as "WARNING: Invalid parent tag."

If these tags are from this tag library, then the names need not have a prefix. If they are from another tag library, then the name must include a prefix specified by one of the <link> elements in this TLDX file. If this element is not present, then the tag may have any tag as its parent.

<taglib>
    <tag>
        <requiredparent>

Syntax

<requiredparent>Space separated list of tag names</requiredparent>

<illegalancestor> Element

Optional. A space-separated list of tags that are not allowed to be an ancestor of this tag. For example, <form> tags cannot be nested within each other.

This affects drag/drop behavior, but does not result in warnings in the source code.

<taglib>
    <tag>
        <illegalancestor>

Syntax

<illegalancestor>Space separated list of tag names</illegalancestor>

<bodycontent-pref> Element

Optional. Indicates whether this tag should be closed with /> or </tagname> when the tag is inserted in Source view. Possible values:

<taglib>
    <tag>
        <bodycontent-pref>

Syntax

<bodycontent-pref>empty | JSP</bodycontent-pref>

<output> Element

Optional. Specifies the HTML that represents this tag in the designer. Enclose the HTML value in a CDATA tag to ensure that this TLDX file remains a valid XML document.

<taglib>
    <tag>
        <output>

Syntax

<output><![CDATA[<b>Text that should be displayed in Design View.</b>]]></output>

<renderer> Element

Specifies the class that should be used to provide a customized display for this tag in Design View. This class must extend com.bea.ide.jspdesigner.Renderer.

To see an example, open the TaglibExtDevKit sample application. There, under TaglibWebProject, open demo.jsp in design view. Notice the custom view of the <tdk:barcode> tag. Also, if you select the tag and modify the value attribute in the Property Editor, you'll see that Design View re-renders the tag. The code that renders this tag is contained in the same application, in TldxHandlers/TDK/Renderer.java.

<taglib>
    <tag>
        <renderer>

Syntax

<renderer>package.RendererClassName</renderer>

<whitespace> Element

Optional. Specifies how whitespace should be treated when reformatting the source code of the document. Possible values are:

<taglib>
    <tag>
        <whitespace>

Syntax

<whitespace>preserve | indent | inline | block</whitespace>

<data-palette-driver> Element

Optional. Specifies the class that should be used to provide custom population of the Data Palette on a tag-by-tag basis. This class must extend com.bea.ide.jspdesigner.DataPaletteTagDriver.

To see an example, open the TaglibExtDevKit sample application. There, in the TaglibWebProject project, open a JSP page and insert a NetUI Form. When the Form Wizard appears, select Create New, then click Create. The data-palette-driver places the new action under the Actions category in the Data Palette.

<taglib>
    <tag>
        <data-palette-driver>

Syntax

<data-palette-driver>package.DataPaletteDriverClass</data-palette-driver>

<attribute> Element

Describes extensions for a tag attribute defined in the corresponding TLD file. There must be an <attribute> element in the TLDX for each <attribute> element in the TLD.

<taglib>
    <tag>
        <attribute>
            <name>
            <category>
            <propertyclass>
            <deprecated>
            <validationrule>
            <validationmessage>
            <extype>
            <reftype>

Syntax

<attribute>
    Child elements describing extensions for a specific attribute.
</attribute>

<name> Element

Required. The name of the attribute being extended. This value must match the name of the attribute as defined in the corresponding TLD.

<taglib>
    <tag>
        <attribute>
            <name>

Syntax

<name>nameOfExtendedAttribute</name>

<category> Element

The name of the group that this attribute should appear under in the Property Editor.

<taglib>
    <tag>
        <attribute>
            <category>

Syntax

<category>nameOfPropertyEditorGroup</category>

<propertyclass> Element

Specifies the class that defines an attribute's custom builder available from the Property Editor; this class must extend com.bea.ide.jspdesigner.PropertyClass.

To see an example, open the TaglibExtDevKit sample application. There, in the TaglibWebProject project, open a JSP page and insert a NetUI Anchor. In the Property Editor, under General, next to the href attribute, click the ... button. The Open dialog that appears is the builder for this attribute.

<taglib>
    <tag>
        <attribute>
            <propertyclass>

Syntax

<propertyclass>package.PropertyBuilderClass</propertyclass>

<deprecated> Element

true if this attribute has been deprecated.

<taglib>
    <tag>
        <attribute>
            <deprecated>

Syntax

<propertyclass>true | false</propertyclass>

<validationrule> Element

The regular expression to use to validate this attribute's value. If the <validationrule> element's value is of the form expression1|expression2|expression3, then the IDE will display a dropdown list in Source View and the property sheet.

<taglib>
    <tag>
        <attribute>
            <validationrule>

Syntax

<validationrule>regularExpressionOrExpressions</validationrule>

<validationmessage> Element

Specifies the message to be displayed when this attribute's value is invalid.

<taglib>
    <tag>
        <attribute>
            <validationmessage>

Syntax

<validationmessage>Message to user for invalid value</validationmessage>

<extype> Element

Specifies the extended type information for validation. Currently supports:

<taglib>
    <tag>
        <attribute>
            <extype>

Syntax

<extype>java-name | java-id</extype>

<reftype> Element

Specifies the name passed to com.bea.language.jsp.IFileReferences.getTransform() for
use in transforming this attribute into a file reference.

<taglib>
    <tag>
        <attribute>
            <reftype>

Syntax

<reftype>reftype</reftype>

Related Topics

None.