web-jsptaglibrary_2_1.xsd

<?xml version="1.0" encoding="UTF-8"?>

<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<!--
  ** This XSD contains only the programatic elements required for an implementation.
  ** For the XSD from Sun that includes documentation and other copyrighted information
  ** please refer to http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd for a fully documented and latest
  **  XSD.
-->

<xsd:schema targetNamespace="http://java.sun.com/xml/ns/javaee"
            xmlns:javaee="http://java.sun.com/xml/ns/javaee"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            elementFormDefault="qualified"
            attributeFormDefault="unqualified"
            version="2.1">

    <xsd:include schemaLocation="javaee_5.xsd" />

    <xsd:element name="taglib" type="javaee:tldTaglibType">
        <xsd:unique name="tag-name-uniqueness">
            <xsd:selector xpath="javaee:tag|javaee:tag-file" />
            <xsd:field xpath="javaee:name" />
        </xsd:unique>

        <xsd:unique name="function-name-uniqueness">
            <xsd:selector xpath="javaee:function" />
            <xsd:field xpath="javaee:name" />
        </xsd:unique>
    </xsd:element>

    <xsd:complexType name="body-contentType">
        <xsd:simpleContent>
            <xsd:restriction base="javaee:string">
                <xsd:enumeration value="tagdependent" />
                <xsd:enumeration value="JSP" />
                <xsd:enumeration value="empty" />
                <xsd:enumeration value="scriptless" />
            </xsd:restriction>
        </xsd:simpleContent>
    </xsd:complexType>

    <xsd:complexType name="extensibleType" abstract="true">
        <xsd:attribute name="id" type="xsd:ID" />
    </xsd:complexType>

    <xsd:complexType name="functionType">
        <xsd:sequence>
            <xsd:group ref="javaee:descriptionGroup" />
            <xsd:element name="name" type="javaee:tld-canonical-nameType"></xsd:element>
            <xsd:element name="function-class" type="javaee:fully-qualified-classType"></xsd:element>
            <xsd:element name="function-signature" type="javaee:string"></xsd:element>
            <xsd:element name="example" type="javaee:xsdStringType" minOccurs="0"></xsd:element>
            <xsd:element name="function-extension" type="javaee:tld-extensionType" minOccurs="0" maxOccurs="unbounded"></xsd:element>

        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:ID" />
    </xsd:complexType>

    <xsd:complexType name="tagFileType">
        <xsd:sequence>
            <xsd:group ref="javaee:descriptionGroup" />
            <xsd:element name="name" type="javaee:tld-canonical-nameType" />
            <xsd:element name="path" type="javaee:pathType" />
            <xsd:element name="example" type="javaee:xsdStringType" minOccurs="0"></xsd:element>
            <xsd:element name="tag-extension" type="javaee:tld-extensionType" minOccurs="0" maxOccurs="unbounded"></xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:ID" />
    </xsd:complexType>

    <xsd:complexType name="tagType">
        <xsd:sequence>
            <xsd:group ref="javaee:descriptionGroup" />
            <xsd:element name="name" type="javaee:tld-canonical-nameType" />
            <xsd:element name="tag-class" type="javaee:fully-qualified-classType"></xsd:element>
            <xsd:element name="tei-class" type="javaee:fully-qualified-classType" minOccurs="0"></xsd:element>
            <xsd:element name="body-content" type="javaee:body-contentType"></xsd:element>
            <xsd:element name="variable" type="javaee:variableType" minOccurs="0" maxOccurs="unbounded" />
            <xsd:element name="attribute" type="javaee:tld-attributeType" minOccurs="0" maxOccurs="unbounded" />
            <xsd:element name="dynamic-attributes" type="javaee:generic-booleanType" minOccurs="0" />
            <xsd:element name="example" type="javaee:xsdStringType" minOccurs="0" />
            <xsd:element name="tag-extension" type="javaee:tld-extensionType" minOccurs="0" maxOccurs="unbounded" />
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:ID" />
    </xsd:complexType>

    <xsd:complexType name="tld-attributeType">
        <xsd:sequence>
            <xsd:element name="description" type="javaee:descriptionType" minOccurs="0" maxOccurs="unbounded" />

            <xsd:element name="name" type="javaee:java-identifierType" />
            <xsd:element name="required" type="javaee:generic-booleanType" minOccurs="0"></xsd:element>
            <xsd:choice>

                <xsd:sequence>
                    <xsd:sequence minOccurs="0">
                        <xsd:element name="rtexprvalue" type="javaee:generic-booleanType"></xsd:element>

                        <xsd:element name="type" type="javaee:fully-qualified-classType" minOccurs="0"></xsd:element>
                    </xsd:sequence>

                    <xsd:choice>
                        <xsd:element name="deferred-value" type="javaee:tld-deferred-valueType" minOccurs="0"></xsd:element>
                        <xsd:element name="deferred-method" type="javaee:tld-deferred-methodType" minOccurs="0"></xsd:element>
                    </xsd:choice>
                </xsd:sequence>

                <xsd:element name="fragment" type="javaee:generic-booleanType" minOccurs="0"></xsd:element>

            </xsd:choice>

        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:ID" />
    </xsd:complexType>

    <xsd:complexType name="tld-canonical-nameType">
        <xsd:simpleContent>
            <xsd:restriction base="javaee:xsdNMTOKENType" />
        </xsd:simpleContent>
    </xsd:complexType>

    <xsd:complexType name="tld-deferred-methodType">
        <xsd:sequence>
            <xsd:element name="method-signature" type="javaee:string" minOccurs="0"></xsd:element>
        </xsd:sequence>

        <xsd:attribute name="id" type="xsd:ID" />

    </xsd:complexType>

    <xsd:complexType name="tld-deferred-valueType">

        <xsd:sequence>
            <xsd:element name="type" type="javaee:fully-qualified-classType" minOccurs="0"></xsd:element>

        </xsd:sequence>

        <xsd:attribute name="id" type="xsd:ID" />
    </xsd:complexType>

    <xsd:complexType name="tld-extensionType">
        <xsd:sequence>
            <xsd:element name="extension-element" type="javaee:extensibleType" maxOccurs="unbounded" />
        </xsd:sequence>

        <xsd:attribute name="namespace" use="required" type="xsd:anyURI" />
        <xsd:attribute name="id" type="xsd:ID" />

    </xsd:complexType>

    <xsd:complexType name="tldTaglibType">
        <xsd:sequence>
            <xsd:group ref="javaee:descriptionGroup" />
            <xsd:element name="tlib-version" type="javaee:dewey-versionType"></xsd:element>

            <xsd:element name="short-name" type="javaee:tld-canonical-nameType">

            </xsd:element>

            <xsd:element name="uri" type="javaee:xsdAnyURIType" minOccurs="0">

            </xsd:element>
            <xsd:element name="validator" type="javaee:validatorType" minOccurs="0">

            </xsd:element>
            <xsd:element name="listener" type="javaee:listenerType" minOccurs="0" maxOccurs="unbounded"></xsd:element>
            <xsd:element name="tag" type="javaee:tagType" minOccurs="0" maxOccurs="unbounded" />
            <xsd:element name="tag-file" type="javaee:tagFileType" minOccurs="0" maxOccurs="unbounded" />
            <xsd:element name="function" type="javaee:functionType" minOccurs="0" maxOccurs="unbounded" />
            <xsd:element name="taglib-extension" type="javaee:tld-extensionType" minOccurs="0" maxOccurs="unbounded"></xsd:element>
        </xsd:sequence>
        <xsd:attribute name="version" type="javaee:dewey-versionType" fixed="2.1" use="required"></xsd:attribute>
        <xsd:attribute name="id" type="xsd:ID" />
    </xsd:complexType>

    <xsd:complexType name="validatorType">
        <xsd:sequence>
            <xsd:element name="description" type="javaee:descriptionType" minOccurs="0" maxOccurs="unbounded" />
            <xsd:element name="validator-class" type="javaee:fully-qualified-classType"></xsd:element>
            <xsd:element name="init-param" type="javaee:param-valueType" minOccurs="0" maxOccurs="unbounded"></xsd:element>

        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:ID" />
    </xsd:complexType>

    <xsd:complexType name="variable-scopeType">
        <xsd:simpleContent>

            <xsd:restriction base="javaee:string">
                <xsd:enumeration value="NESTED" />
                <xsd:enumeration value="AT_BEGIN" />
                <xsd:enumeration value="AT_END" />
            </xsd:restriction>
        </xsd:simpleContent>
    </xsd:complexType>

    <xsd:complexType name="variableType">
        <xsd:sequence>
            <xsd:element name="description" type="javaee:descriptionType" minOccurs="0" maxOccurs="unbounded" />

            <xsd:choice>
                <xsd:element name="name-given" type="javaee:java-identifierType"></xsd:element>

                <xsd:element name="name-from-attribute" type="javaee:java-identifierType"></xsd:element>
            </xsd:choice>
            <xsd:element name="variable-class" type="javaee:fully-qualified-classType" minOccurs="0"></xsd:element>

            <xsd:element name="declare" type="javaee:generic-booleanType" minOccurs="0"></xsd:element>
            <xsd:element name="scope" type="javaee:variable-scopeType" minOccurs="0"></xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:ID" />
    </xsd:complexType>
</xsd:schema>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,以下是myTaglib.tld文件的示例代码,用于配置自定义函数的标签库: ```xml <?xml version="1.0" encoding="UTF-8"?> <taglib version="2.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_0.xsd"> <tlib-version>1.0</tlib-version> <short-name>myTaglib</short-name> <uri>http://www.example.com/tags/myTaglib</uri> <function> <name>triangle</name> <function-class>util.com.Triangle</function-class> <function-signature>boolean triangle(double a, double b, double c)</function-signature> </function> </taglib> ``` 在以上代码中,我们定义了一个名为“myTaglib”的标签库,它的URI为“http://www.example.com/tags/myTaglib”。其中,<function>标签用于定义自定义函数,<name>标签定义函数的名称,<function-class>标签定义函数所在的类,<function-signature>标签定义函数的返回类型和参数列表。 在这个示例中,我们定义了一个名为“triangle”的函数,它的返回类型为boolean,参数列表为三个double类型的数值a、b、c。该函数将会在util.com包中的Triangle类中实现。在JSP页面中,我们可以使用以下标签引用该函数: ```jsp <%@ taglib prefix="my" uri="http://www.example.com/tags/myTaglib" %> ... <c:if test="${my:triangle(a, b, c)}"> 可以构成三角形,面积为${util:area(a, b, c)} </c:if> <c:if test="${!my:triangle(a, b, c)}"> 无法构成三角形 </c:if> ``` 在以上代码中,我们使用了JSP的<c:if>标签来根据函数的返回值进行条件判断。注意,我们需要使用前缀“my”来引用该标签库。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值