Спецификация Java Server Pages 1.2

B.2 XSchema-Описание для Документов JSP


Далее идёт описание, использующее XML Schema:
 

<?xml version ="1.0"?>

<!DOCTYPE schema [

<!-- Патэрны -->

<!ENTITY Identifier "(\p{L}|_|$)(\p{N}|\p{L}|_|$)*">

<!ENTITY TypeName "&Identifier;(\.&Identifier;)*">

<!ENTITY WS "\s*">

<!ENTITY Import "&TypeName;(\.\*)?">

<!ENTITY ImportList "&Import;(&WS;,&WS;&Import;)*">

<!ENTITY SetProp "(&Identifier;|\*)">

<!ENTITY RelativeURL "[^:#/\?]*(:{0,0}|[#/\?].*)">

<!ENTITY Length "[0-9]*&#x25;?">

<!ENTITY AsciiName "[A-Za-z0-9_-]*">

<!ENTITY ValidContentType

"&AsciiName;/&AsciiName;(;&WS;(charset=)?&AsciiName;)?">



<!ENTITY ValidPageEncoding "&AsciiName;/&AsciiName;">

<!ENTITY Buffer "[0-9]+kb">

<!ENTITY RTexpr "&#x25;=.*&#x25;">

]>

<!--Соответствует w3c http://www.w3.org/2001/XMLSchema -->

<xsd:schema

xmlns = "http://java.sun.com/JSP/Page"

xmlns:xsd = "http://www.w3.org/2001/XMLSchema"

xmlns:jsp = "http://java.sun.com/JSP/Page"

targetNamespace = "http://java.sun.com/JSP/Page"

elementFormDefault = "qualified"

attributeFormDefault = "unqualified">

<xsd:annotation>

<xsd:documentation>

XML Schema для JSP 1.2.

Эта схема базируется на последних (от 5 мая 2001) Рекомендациях W3C по XML Schema.

JSP-транслятор должен отбрасывать файл XML-формата, который не соответствует строго этой схеме или не соблюдает описанных здесь ограничений. Транслятор не обязан использовать эту схему для проверки либо использовать проверяющий разборщик.

</xsd:documentation>

</xsd:annotation>

<!-- Сложные Типы -->

<xsd:complexType name = "Body">

<xsd:annotation>

<xsd:documentation>

Body определяет элементы "верхнего уровня/top-level" в root и beanInfo.


Возможно есть другие элементы, которые должны его использовать.

</xsd:documentation>

</xsd:annotation>

<xsd:group ref = "Bodygroup" minOccurs = "0" maxOccurs = "unbounded"/>

</xsd:complexType>

<xsd:complexType name = "BasicType">

<xsd:simpleContent>

<xsd:extension base = "xsd:string">

<xsd:attribute ref = "jsp:id"/>

</xsd:extension>

</xsd:simpleContent>

</xsd:complexType>

<!-- группы -->

<xsd:group name = "Bodygroup">

<xsd:choice>

<xsd:element ref = "directive.page"/>

<xsd:element ref = "directive.include"/>

<xsd:element ref = "scriptlet"/>

<xsd:element ref = "declaration"/>

<xsd:element ref = "expression"/>

<xsd:element ref = "useBean"/>

<xsd:element ref = "setProperty"/>

<xsd:element ref = "getProperty"/>

<xsd:element ref = "include"/>

<xsd:element ref = "forward"/>

<xsd:element ref = "plugin"/>

<xsd:element ref = "text"/>

<xsd:any namespace="##other" processContents = "lax"/>

</xsd:choice>

</xsd:group>

<!-- jsp:id attribute -->

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

<!--Должно иметься ограничение, что jsp:id является уникальным среди всех элементов документа. -->

<!-- Далее идут простые типы -->

<xsd:simpleType name = "RTE">

<xsd:annotation>

<xsd:documentation>

Значение выражения времени запроса

</xsd:documentation>

</xsd:annotation>

<xsd:restriction base = "xsd:string">

<xsd:pattern value = "&RTexpr;"/>

</xsd:restriction>

</xsd:simpleType>

<xsd:simpleType name = "Bool">

<xsd:annotation>

<xsd:documentation>

Bool мог бы быть булевым, если бы принимал 1 и 0.



</xsd:documentation>

</xsd:annotation>

<xsd:restriction base = "xsd:NMTOKEN" >

<xsd:enumeration value = "true"/>

<xsd:enumeration value = "false"/>

<xsd:enumeration value = "yes"/>

<xsd:enumeration value = "no"/>

</xsd:restriction>

</xsd:simpleType>

<xsd:simpleType name = "Identifier">

<xsd:annotation>

<xsd:documentation>

Identifier это неквалифицированный Java-идентификатор.

</xsd:documentation>

</xsd:annotation>

<xsd:restriction base = "xsd:string">

<xsd:pattern value = "&Identifier;"/>

</xsd:restriction>

</xsd:simpleType>

<xsd:simpleType name = "TypeName">

<xsd:annotation>

<xsd:documentation>

TypeName это один или более Java-идентификаторов, разделённых точками без пробелов.

</xsd:documentation>

</xsd:annotation>

<xsd:restriction base = "xsd:string">

<xsd:pattern value = "&TypeName;"/>

</xsd:restriction>

</xsd:simpleType>

<xsd:simpleType name = "ImportList">

<xsd:annotation>

<xsd:documentation>

ImportList это один или более typeNames, разделённых запятыми.

Допускаются пробелы до и после запятой.

</xsd:documentation>

</xsd:annotation>

<xsd:restriction base = "xsd:string">

<xsd:pattern value = "&ImportList;"/>

</xsd:restriction>

</xsd:simpleType>

<xsd:simpleType name = "SetProp">

<xsd:annotation>

<xsd:documentation>

SetProp это Identifier или *.

</xsd:documentation>

</xsd:annotation>

<xsd:restriction base = "xsd:string">

<xsd:pattern value = "&SetProp;"/>

</xsd:restriction>

</xsd:simpleType>

<xsd:simpleType name = "RelativeURL">

<xsd:annotation>

<xsd:documentation>



RelativeURL это uriReference без символов двоеточия до первой  /, ? или #, если имеются (RFC2396).

</xsd:documentation>

</xsd:annotation>

<xsd:restriction base = "xsd:anyURI">

<xsd:pattern value = "&RelativeURL;"/>

</xsd:restriction>

</xsd:simpleType>

<xsd:simpleType name = "RTERelativeURL">

<xsd:union memberTypes = "RelativeURL RTE"/>

</xsd:simpleType>

<xsd:simpleType name = "Length">

<xsd:annotation>

<xsd:documentation>

Length это nn или nn%.

</xsd:documentation>

</xsd:annotation>

<xsd:restriction base = "xsd:string">

<xsd:pattern value = "&Length;"/>

</xsd:restriction>

</xsd:simpleType>

<xsd:simpleType name = "ExplicitBufferSize">

<xsd:annotation>

<xsd:documentation>

Размер Буфера с точным значением.

</xsd:documentation>

</xsd:annotation>

<xsd:restriction base = "xsd:string">

<xsd:pattern value = "&Buffer;"/>

</xsd:restriction>

</xsd:simpleType>

<xsd:simpleType name = "NoneBufferSize">

<xsd:annotation>

<xsd:documentation>

Размер Буфера/Buffer Size со значением "none".

</xsd:documentation>

</xsd:annotation>

<xsd:restriction base = "xsd:string">

<xsd:enumeration value = "none"/>

</xsd:restriction>

</xsd:simpleType>

<xsd:simpleType name = "BufferSize">

<xsd:annotation>

<xsd:documentation>

Размер Буфера имеет значение xkb или none.

</xsd:documentation>

</xsd:annotation>

<xsd:union memberTypes = "ExplicitBufferSize NoneBufferSize"/>

</xsd:simpleType>

<xsd:simpleType name = "ContentType">

<xsd:annotation>

<xsd:documentation>

Contetn Type/Тип Содержимого для данной страницы.

</xsd:documentation>

</xsd:annotation>



<xsd:restriction base = "xsd:string">

<xsd:pattern value = "&ValidContentType;"/>

</xsd:restriction>

</xsd:simpleType>

<xsd:simpleType name = "PageEncoding">

<xsd:annotation>

<xsd:documentation>

Кодировка Страницы/ Page Encoding для данной страницы. По умолчанию - та же, что и в ContentType.

</xsd:documentation>

</xsd:annotation>

<xsd:restriction base = "xsd:string">

<xsd:pattern value = "&ValidPageEncoding;"/>

</xsd:restriction>

</xsd:simpleType>

<xsd:simpleType name = "Scope">

<xsd:annotation>

<xsd:documentation>

верные значения scope

</xsd:documentation>

</xsd:annotation>

<xsd:restriction base = "xsd:NMTOKEN">

<xsd:enumeration value = "page"/>

<xsd:enumeration value = "session"/>

<xsd:enumeration value = "request"/>

<xsd:enumeration value = "application"/>

</xsd:restriction>

</xsd:simpleType>

<xsd:simpleType name = "PlugInType">

<xsd:annotation>

<xsd:documentation>

верные значения типа plugin'а

</xsd:documentation>

</xsd:annotation>

<xsd:restriction base = "xsd:NMTOKEN">

<xsd:enumeration value = "bean"/>

<xsd:enumeration value = "applet"/>

</xsd:restriction>

</xsd:simpleType>

<xsd:simpleType name = "AlignType">

<xsd:annotation>

<xsd:documentation>

Размер буфера - xkb.

</xsd:documentation>

</xsd:annotation>

<xsd:restriction base = "xsd:NMTOKEN">

<xsd:enumeration value = "top"/>

<xsd:enumeration value = "middle"/>

<xsd:enumeration value = "bottom"/>

<xsd:enumeration value = "left"/>

<xsd:enumeration value = "right"/>

</xsd:restriction>

</xsd:simpleType>



<!-- Элементы -->

<xsd:element name = "root">

<xsd:annotation>

<xsd:documentation>

Корневой элемент всех JSP-документов называется root.

Авторы могут, если хотят, включать информацию о месте размещения схемы.

Если специфицирована, информация может появляться как атрибут элемента root так:

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/JSP/Page xsd-file-location"

Документы не должны специфицировать системный идентификатор DTD/ОТД

- Определении Типа Данных - в объявлении DOCTYPE.

</xsd:documentation>

</xsd:annotation>

<xsd:complexType>

<xsd:complexContent>

<xsd:extension base = "Body">

<xsd:attribute name = "version" fixed = "1.2" type = "xsd:string"/>

</xsd:extension>

</xsd:complexContent>

</xsd:complexType>

</xsd:element>

<xsd:element name = "directive.page">

<xsd:annotation>

<xsd:documentation>

directive.page это "директива page".

</xsd:documentation>

</xsd:annotation>

<xsd:complexType>

<xsd:attribute ref = "jsp:id"/>

<xsd:attribute name = "language" default = "java" type = "xsd:string"/>

<xsd:attribute name = "extends" type = "TypeName"/>

<xsd:attribute name = "contentType"

default = "text/html; ISO-8859-1" type = "ContentType"/>

<xsd:attribute name = "pageEncoding"

use = "optional" type = "PageEncoding"/>

<xsd:attribute name = "import" type = "ImportList"/>

<xsd:attribute name = "session" default = "true" type = "Bool"/>

<xsd:attribute name = "buffer" default = "8kb" type = "BufferSize"/>

<xsd:attribute name = "autoFlush" default = "true" type = "Bool"/>



<xsd:attribute name = "isThreadSafe" default = "true" type = "Bool"/>

<xsd:attribute name = "info" type = "xsd:string"/>

<xsd:attribute name = "errorPage" type = "RelativeURL"/>

<xsd:attribute name = "isErrorPage" default = "false" type = "Bool"/>

</xsd:complexType>

</xsd:element>

<xsd:element name = "directive.include">

<xsd:annotation>

<xsd:documentation>

directive.include это "директива include".

Этот элемент не появляется в XML-просмотре JSP-страниц.

</xsd:documentation>

</xsd:annotation>

<xsd:complexType>

<xsd:attribute ref = "jsp:id"/>

<xsd:attribute name = "file" use = "required" type = "RelativeURL"/>

</xsd:complexType>

</xsd:element>

<xsd:element name = "scriptlet" type = "BasicType">

<xsd:annotation>

<xsd:documentation>

Представление скриптлета.

</xsd:documentation>

</xsd:annotation>

</xsd:element>

<xsd:element name = "declaration" type = "BasicType">

<xsd:annotation>

<xsd:documentation>

Представление объявления.

</xsd:documentation>

</xsd:annotation>

</xsd:element>

<xsd:element name = "expression" type = "BasicType">

<xsd:annotation>

<xsd:documentation>

Представление выражения.

</xsd:documentation>

</xsd:annotation>

</xsd:element>

<xsd:element name = "text" type = "BasicType">

<xsd:annotation>

<xsd:documentation>

Точно переданный шаблонный текст.

</xsd:documentation>

</xsd:annotation>

</xsd:element>

<xsd:element name = "useBean">

<xsd:annotation>

<xsd:documentation>

useBean инстанциирует или имеет доступ к bean в специфицированной области видимости.



Ограничение: Допустимыми комбинациями атрибутов являются:

class [type] | type [( class | beanName)]

</xsd:documentation>

</xsd:annotation>

<xsd:complexType>

<xsd:complexContent>

<xsd:extension base="Body">

<xsd:attribute ref = "jsp:id"/>

<xsd:attribute name = "id" use = "required" type = "Identifier"/>

<xsd:attribute name = "class" type = "TypeName"/>

<xsd:attribute name = "type" type = "TypeName"/>

<xsd:attribute name = "beanName" type = "TypeName"/>

<xsd:attribute name = "scope" default = "page" type = "Scope"/>

</xsd:extension>

</xsd:complexContent>

</xsd:complexType>

</xsd:element>

<xsd:element name = "setProperty">

<xsd:annotation>

<xsd:documentation>

setProperty изменяет значение  свойства объекта.

Ограничение: Именованный объект обязан быть

"представлен" JSP-процессору через использование либо

акции jsp:useBean, либо специальной акции с ассоциированным

входом VariableInfo для этого имени.

Точные верные комбинации не выражаются в XML Schema.

Это:

name="Identifier" property="*"

name="Identifier" property="Identfiier" param="string"

name="Identifier" property="Identifier" value="string"

</xsd:documentation>

</xsd:annotation>

<xsd:complexType>

<xsd:attribute ref = "jsp:id"/>

<xsd:attribute name = "name" use = "required" type = "Identifier"/>

<xsd:attribute name = "property" use = "required" type = "SetProp"/>

<xsd:attribute name = "param" type = "xsd:string"/>

<xsd:attribute name = "value" type = "xsd:string"/>

</xsd:complexType>

</xsd:element>



<xsd:element name = "getProperty">

<xsd:annotation>

<xsd:documentation>

getProperty получает значение свойства объекта.

Ограничение: Именованный объект обязан быть

"представлен" JSP-процессору через использование либо

акции jsp:useBean, либо специальной акции с ассоциированным

входом VariableInfo для этого имени.

</xsd:documentation>

</xsd:annotation>

<xsd:complexType>

<xsd:attribute ref = "jsp:id"/>

<xsd:attribute name = "name" use = "required" type = "Identifier"/>

<xsd:attribute name = "property" use = "required" type = "Identifier"/>

</xsd:complexType>

</xsd:element>

<xsd:element name = "include">

<xsd:complexType>

<xsd:sequence>

<xsd:element ref = "param" minOccurs = "0" maxOccurs = "unbounded"/>

</xsd:sequence>

<xsd:attribute ref = "jsp:id"/>

<xsd:attribute name = "flush" default = "false" type = "Bool"/>

<xsd:attribute name = "page" use = "required" type = "RTERelativeURL"/>

</xsd:complexType>

</xsd:element>

<xsd:element name = "forward">

<xsd:complexType>

<xsd:sequence>

<xsd:element ref = "param" minOccurs = "0" maxOccurs = "unbounded"/>

</xsd:sequence>

<xsd:attribute ref = "jsp:id"/>

<xsd:attribute name = "page" use = "required" type = "RTERelativeURL"/>

</xsd:complexType>

</xsd:element>

<xsd:element name = "plugin">

<xsd:complexType> <!-- content only! -->

<xsd:sequence>

<xsd:element ref = "params" minOccurs = "0" maxOccurs = "1"/>

<xsd:element name = "fallback"

minOccurs = "0" maxOccurs = "1" type = "Body"/>

</xsd:sequence>



<xsd: attribute ref = "jsp:id"/>

<xsd:attribute name = "type" use = "required" type = "PlugInType"/>

<xsd:attribute name = "code" type = "xsd:anyURI"/>

<xsd:attribute name = "codebase" type = "xsd:anyURI"/>

<xsd:attribute name = "align" type = "AlignType"/>

<xsd:attribute name = "archive">

<xsd:simpleType>

<xsd:list itemType="xsd:anyURI"/>

</xsd:simpleType>

</xsd:attribute>

<xsd:attribute name = "height" type = "Length"/>

<xsd:attribute name = "hspace" type = "xsd:int"/>

<xsd:attribute name = "jreversion" default = "1.2" type = "xsd:string"/>

<xsd:attribute name = "name" type = "xsd:NMTOKEN"/>

<xsd:attribute name = "vspace" type = "xsd:int"/>

<xsd:attribute name = "width" type = "Length"/>

<xsd:attribute name = "nspluginurl" type = "xsd:anyURI"/>

<xsd:attribute name = "iepluginurl" type = "xsd:anyURI"/>

</xsd:complexType>

</xsd:element>

<xsd:element name = "params">

<xsd:complexType>

<xsd:sequence>

<xsd:element ref = "param" minOccurs = "1" maxOccurs = "unbounded"/>

</xsd:sequence>

<xsd:attribute ref = "jsp:id"/>

</xsd:complexType>

</xsd:element>

<xsd:element name = "param">

<xsd:complexType>

<xsd:attribute ref = "jsp:id"/>

<xsd:attribute name = "name" use = "required" type = "xsd:NMTOKEN"/>

<xsd:attribute name = "value" use = "required" type = "xsd:string"/>

</xsd:complexType>

</xsd:element>

</xsd:schema>


Содержание раздела