# File: laszlo.rnc # # lzx.rnc is in the RELAXNG Compact syntax: # http://www.thaiopensource.com/relaxng/compact/syntax.html # # lzx.rng is a RELAXNG schema: # http://www.oasis-open.org/committees/relax-ng/ # # Note: This is the master schema. lzx.dtd, lzx.rng, lzx.xsd, and lzxdoc.rng # are all generated from this file. # * P_LZ_COPYRIGHT_BEGIN ****************************************************** # * Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. * # * Use is subject to license terms. * # * P_LZ_COPYRIGHT_END ******************************************************** default namespace = "http://www.laszlosystems.com/2003/05/lzx" namespace rng = "http://relaxng.org/ns/structure/1.0" namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0" datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes" namespace lza = "http://www.laszlosystems.com/annotations/1.0" # Literals booleanLiteral = xsd:boolean colorLiteral = string numberLiteral = xsd:double sizeLiteral = xsd:double {minInclusive="0"} inheritableBooleanLiteral = booleanLiteral | "inherit" constraint = xsd:string {pattern="$(style|path|immediately|once|always)?\{.*\}"} # Attribute value types boolean = booleanLiteral | constraint booleanOrNull = boolean | "null" color = colorLiteral | constraint script = string expression = string reference = string number = numberLiteral | constraint size = sizeLiteral | constraint numberExpression = string sizeExpression = string css = string opacity = xsd:double {minInclusive="0.0" maxInclusive="1.0"} | constraint percentage = xsd:string {pattern="(\d+(.\d?)|.\d+)%"} # Grammar start = canvas | viewElement | library canvas = element canvas { idAttribute? & oninitAttribute? & ## The width of the canvas. [a:defaultValue="500"] attribute width {sizeLiteral | percentage}? & ## The height of the canvas. [a:defaultValue="400"] attribute height {sizeLiteral | percentage}? & ## The background color of the canvas. [a:defaultValue="white"] attribute bgcolor {colorLiteral}? & ## The string that is used in the browser window. [a:defaultValue="OpenLaszlo Application"] attribute title {string}? & ## The default font for views in this application. [a:defaultValue="lztahoe8"] attribute font {string}? & ## The default size for views in this application. [a:defaultValue="8"] attribute fontsize {size}? & ## The default font style for views in this application. The empty string ## is interpreted as 'plain'. [a:defaultValue=""] attribute fontstyle {"bold" | "italic" | "bold italic" | "plain" | ""}? & attribute layout {css}? & ## If false, disables validation against the schema during compilation [a:defaultValue="true"] attribute validate {booleanLiteral}? & [a:defaultValue="inherit"] attribute proxied {inheritableBooleanLiteral}? & [a:defaultValue="false"] attribute debug {booleanLiteral}? & [a:defaultValue="false"] attribute backtrace {booleanLiteral}? & ## If present, specifies the maximum width in pixels of any output text field. ## Text which extends beyond this width will be clipped. ## If this attribute is omitted, it defaults to the canvas width. attribute maxtextwidth {sizeLiteral}? & ## If present, specifies the maximum height in pixels of any output text field. ## Text which extends beyond this height will be clipped. ## If this attribute is omitted, it defaults to the canvas height. attribute maxtextheight {sizeLiteral}? & attribute dataloadtimeout {numberExpression}? & attribute medialoadtimeout {numberExpression}? & ## A list of names for libraries that are included in the application. [a:defaultValue=""] attribute libraries {string}? & [a:defaultValue="true"] attribute embedfonts {booleanLiteral}? & connection? & splash? & datapathChildren & toplevelElements & [a:defaultValue="1.1"] attribute version {string}? & [a:defaultValue="false"] attribute accessible {booleanLiteral}? } library = element library { [lza:visibility="private"] attribute href {xsd:anyURI} | ([lza:visibility="private"] attribute includes {string}? & [a:defaultValue="inherit"] attribute proxied {booleanLiteral | "inherit"}? & (toplevelElements & [a:defaultValue="true"] attribute validate {booleanLiteral}? & datapointer*)) } toplevelElements = ( (viewElement | scriptElement | styleSheetElement | asset | font)* & datarequest* & datasource* & connectiondatasource* & dataset* & debugger? & command* & objectElements & class* & interface* & trait* & includeElement* & importElement* & library* & layout* & security* & toplevelSwitch* ) debugger = [lza:since="1.1"] element debug { viewAttributes & attribute showInternalProperties {boolean}? } includeElement = element include { attribute href {xsd:anyURI} & [a:defaultValue="xml"] attribute type {"text" | "xml"}? } toplevelSwitch = element switch { element when { attribute runtime {xsd:string}? & toplevelElements }* & element otherwise { toplevelElements }? } # # Attributes # idAttribute = [lza:modifiers="final"] attribute id {xsd:ID} srcAttribute = ## The path of a file that contains the source for this object. [lza:modifiers="final"] attribute src {xsd:anyURI} nameAttribute = ## The name of a variable that will be set to this object when the ## application is started. If this element is directly within a @e{canvas} ## or @e{library} element, the global variable and the canvas ## property with this name will be set to this object. If this ## element is within another object, that object's property with ## this name will be set to this object. [lza:modifiers="final"] attribute name {token} oninitAttribute = ## The oninit script is executed once, after the element's ## children, if any, have been initialized. attribute oninit {script} initstageAttribute = [a:defaultValue="normal" lza:modifiers="final"] attribute initstage {"early" | "normal" | "late" | "immediate" | "defer"} datapathAttribute = attribute datapath {string} placementAttribute = [lza:modifiers="final"] attribute placement {string} classAttribute = ## The CSS class of a node [lza:modifiers="final"] attribute class {token} ignoreplacementAttribute = [lza:modifiers="final"] attribute ignoreplacement {boolean} objectAttributes = ( idAttribute?, nameAttribute?, classAttribute?, oninitAttribute?, datapathAttribute?, placementAttribute?, ignoreplacementAttribute?, initstageAttribute? ) viewAttributes = ( nodeAttributes, [a:defaultValue="1.0"] attribute opacity {opacity}?, attribute bgcolor {color}?, attribute cursor {token}?, attribute clickable {boolean}?, attribute clickregion {string}?, attribute focustrap {boolean}?, attribute focusable {boolean}?, [a:defaultValue="0"] attribute frame {numberExpression}?, attribute fgcolor {color}?, attribute font {string}?, attribute fontstyle {string}?, attribute fontsize {size}?, attribute resource {string}?, [lza:visibility="private"] attribute source {expression}?, [a:defaultValue="false" lza:modifiers="final"] attribute clip {boolean}?, [a:defaultValue="left" lza:modifiers="final"] attribute align {"left" | "center" | "right" | constraint}?, [a:defaultValue="top"] attribute valign {"top" | "middle" | "bottom" | constraint}?, attribute layout {css}?, [a:defaultValue="false" lza:modifiers="final"] attribute pixellock {booleanLiteral}?, [a:defaultValue="0"] attribute rotation {numberExpression}?, [a:defaultValue="0"] attribute xoffset {numberExpression}?, [a:defaultValue="0"] attribute yoffset {numberExpression}?, [a:defaultValue="true"] attribute play {boolean}?, #[a:defaultValue="true"] attribute selectiontype {"none" | "single" | "toggle" | "multi" | "range"}?, attribute stretches {"width" | "height" | "both"}?, [a:defaultValue="true"] attribute visible {booleanOrNull}?, [a:defaultValue="visible"] attribute visibility {string}?, attribute width {sizeExpression}?, attribute height {sizeExpression}?, [lza:visibility="private"] attribute textwidth {sizeExpression}?, [lza:visibility="private"] attribute textheight {sizeExpression}?, [a:defaultValue="0"] attribute x {numberExpression}?, [a:defaultValue="0"] attribute y {numberExpression}?, attribute aaname {string}?, attribute aaactive {boolean}?, attribute aadescription {string}?, attribute aatabindex {number}?, attribute aasilent {boolean}?, attribute showhandcursor {boolean}?, [lza:modifiers="final"] attribute options {css}?, eventAttributes ) eventAttributes = attribute onclick {script}?, attribute ondblclick {script}?, attribute onmousedown {script}?, attribute onmouseup {script}?, attribute onmouseover {script}?, attribute onmouseout {script}?, attribute onfocus {script}?, attribute onblur {script}?, attribute onkeydown {script}?, attribute onkeyup {script}?, attribute onselect {script}?, attribute ondata {script}? # # View Content # viewContent = viewAttributes & viewContentElements viewContentElements = nodeElements viewContentElements &= includeElement* & viewElement* & element dataselectionmanager { idAttribute? & nameAttribute? & attribute toggle {boolean}? & oninitAttribute? & objectElements }? & element selectionmanager { idAttribute? & nameAttribute? & attribute toggle {boolean}? & oninitAttribute? & objectElements }* & layout* viewContentElements &= command* command = element command { idAttribute?, nameAttribute?, attribute onselect {script}?, attribute active {boolean}?, attribute key {expression}?, oninitAttribute?, objectElements } animator = element animator {animatorContent} animatorgroup = element animatorgroup { [a:defaultValue="sequential"] attribute process {"sequential" | "simultaneous"}? & animatorContent} animatorContent = objectAttributes & objectElements & attribute attribute {token}? & [a:defaultValue="true"] attribute start {boolean}? & attribute from {number}? & attribute to {number}? & attribute duration {xsd:float {minInclusive="0"} | constraint}? & [a:since="1.1" a:defaultValue="false"] attribute indirect {boolean}? & [a:defaultValue="false"] attribute relative {boolean}? & [a:defaultValue="easeboth"] attribute motion {"linear" | "easein" | "easeout" | "easeboth"}? & attribute onstart {script}? & attribute onstop {script}? & [lza:since="1.1"] attribute repeat {expression}? & [a:defaultValue="false"] attribute paused {boolean}? & attribute target {reference}? # # View elements # viewElement = ( element view {viewContent} | element text { viewContent & textAttributes & attribute embedfonts {boolean}? & (attribute text {xsd:string} | htmlText*) } | element inputtext { viewContent & textAttributes & attribute embedfonts {boolean}? & attribute resizable {boolean}? & ## If true, the input text field acts like a password input ## field; any text typed in appears as "****" characters in the ## current font. [a:defaultValue="false"] attribute password {boolean}? & (attribute text {xsd:string} | text?) } ) textAttributes = [a:defaultValue="false" lza:modifiers="final"] attribute multiline {boolean}? & [a:defaultValue="false"] attribute resize {booleanLiteral}? & [a:defaultValue="false"] attribute selectable {booleanLiteral}? & [a:defaultValue="null"] attribute maxlength {numberExpression}? & attribute pattern {string}? & attribute label {string}? & [a:defaultValue="advanced"] attribute antiAliasType {"normal" | "advanced"}? & [a:defaultValue="subpixel"] attribute gridFit {"none" | "pixel" | "subpixel"}? & [a:defaultValue="0"] attribute sharpness {numberExpression}? & [a:defaultValue="0"] attribute thickness {numberExpression}? textContent = (attribute text {xsd:string} | text?) htmlContent = (attribute text {xsd:string} | htmlText?) htmlText = (text | element pre { htmlText } | element a { ## The link target. attribute href {xsd:anyURI} & ## The value of this attribute determines where the link target ## will be displayed. The interpretation is the same as in HTML, ## where the "current frame" is the frame containing the LZX ## application. The value must be a name beginning with an ## alphabetic character, or one of the following: ## ##
#FF0000.
# The CSS syntaxes red, #F00, and
# rgb(1.0, 0, 0) are not recognized.
& attribute color {colorLiteral}?
& htmlText}
|
element i {htmlText}
|
element p {htmlText}
|
element br {empty}
|
element u {htmlText})*
#
# Assets
#
asset =
element audio {srcAttribute & idAttribute? & nameAttribute}
asset |= resource
resource =
element resource {
nameAttribute &
(srcAttribute
|
element frame {nameAttribute? & srcAttribute}*)
}
#
# Data
#
datasource = element datasource {
idAttribute?
& nameAttribute?
& attribute timeout {number}?
& [a:defaultValue="false"
lza:visibility="private"]
attribute secure {booleanLiteral}?
& [a:defaultValue="inherit"] attribute proxied {booleanLiteral | "inherit"}?
& ## A dataset element within a @e{datasource} element defines a set
## of data that is retrieved from that datasource. The name
## of the dataset can be used in the datapath attribute of
## a view.
[lza:name="datasource dataset"]
element dataset {datasetAttributes & anyXML}*
& oninitAttribute?
& objectElements
}
connectiondatasource =
## A connection datasource to receive messages from the persistent connection.
element connectiondatasource {
idAttribute?
& nameAttribute?
& ## The onconnect script is executed when the application is connected.
attribute onconnect {script}?
& attribute oninit {script}?
& ## The ondata script is executed when the application receives a persistent
## connection message.
attribute ondata {script}?
& ## The onerror script is executed whenever there's a connection failure.
attribute onerror {script}?
& ## The ontimeout script is executed whenever a timeout is encountered with
## the persistent connection.
attribute ontimeout {script}?
& ## The ondisconnect script is executed whenever the application disconnects.
attribute ondisconnect {script}?
& ## The onuserdisconnect script is executed whenever a user disconnects. See
## the receiveuserdisconnect attribute.
attribute onuserdisconnect {script}?
& ## A dataset element within a @e{connectiondatasource} element names a
## unique dataset whose content is shared with other clients that define a
## dataset with the same name on the same server.
[lza:name="persistent connection dataset"]
element dataset {datasetAttributes}*
& method*
}
agent =
element agent {
attribute url {string}
}
connection =
element connection {
## The interval value in milliseconds that the server will send a message to
## the application to ensure the connection is kept alive by the client.
## The default value of a heartbeat is 5000 milliseconds.
attribute heartbeat {xsd:integer}?
& attribute timeout {number}?
& ## If true, creates a secure persistent connection through https. Otherwise
## the connection uses http.
attribute secure {booleanLiteral}?
& ## Connection port.
attribute secureport {xsd:integer}?
& ## Tells server to send an onuserdisconnect event every time a user
## disconnects. Default is false.
[a:defaultValue="false"]
attribute receiveuserdisconnect {booleanLiteral}?
& ## Connection group name.
attribute group {string}?
& ## Class name of server-side java authenticator
attribute authenticator {string}?
& ## Authenticator parameters.
attribute authparam {string}?
& ## The onconnect script is executed when the application is connected.
attribute onconnect {script}?
& ## The ondata script is executed when the application receives a persistent
## connection message.
attribute ondata {script}?
& ## The onerror script is executed whenever there's a connection failure.
attribute onerror {script}?
& ## The ontimeout script is executed whenever a timeout is encountered with
## the persistent connection.
attribute ontimeout {script}?
& ## The ondisconnect script is executed whenever the application disconnects.
attribute ondisconnect {script}?
& ## The onuserdisconnect script is executed whenever a user disconnects. See
## the receiveuserdisconnect attribute.
attribute onuserdisconnect {script}?
& agent*
& method*
& handler*
}
dataset =
[lza:name="top-level dataset"]
element dataset {
datasetAttributes & anyXML
}
datasetAttributes = objectAttributes &
## If true, namespace prefixes are preserved in XML tag and attribute names
## defaults to false in proxied apps, but SOLO apps currently only support
## a value of 'true' (namespace prefixes are always attached to
## element and attribute names)
[lza:defaultValue="true"]
attribute nsprefix {boolean}? &
## If true, enable a response to be encoded via the clients Accept-Encoding
## HTTP header. This allows the server to gzip the response.
[lza:since="1.1"
lza:defaultValue="false"]
attribute acceptencodings {boolean}? &
## msecs to time out for load requests
attribute timeout {number}? &
## If false, use flash native XML loader/parser
[a:defaultValue="inherit"] attribute proxied {booleanLiteral | "inherit"}? &
## If this is a URL, it defines a request for an XML datasource that
## is initiated when the dataset's content is requested.
## If this is a pathname, it specifies an XML file whose content
## is compiled into the application as the value of the dataset.
attribute src {xsd:anyURI | constraint}? &
## Request this dataset when the app starts.
[lza:since="1.1"
lza:defaultValue="false"]
attribute request {boolean}? &
## If true, every change to the dataset source or query params will
## cause a new request to be made automatically
[lza:since="4.1"
lza:defaultValue="false"]
attribute autorequest {boolean}? &
## If true, the client should ensure that each request is made,
## rather than just making and reporting the last request.
[lza:since="1.1"
lza:defaultValue="false"]
attribute queuerequests {boolean}? &
## This string is appended to the request.
[lza:since="1.1"]
attribute querystring {xsd:string}? &
## If set to "http", then the dataset will interpret its src attribute as an
## url from which to load its content, rather than as a static xml file to
## inline.
attribute type {xsd:string}? &
## If true, initial literal XML data is taken from child node
attribute datafromchild {boolean}? &
[lza:visibility="private"]
attribute endpoint {xsd:string}? &
[lza:visibility="private"]
attribute namespace {xsd:string}? &
[lza:visibility="private"]
attribute method {xsd:string}?
& ## specifies whether or not the app-LPS connection is secure
[a:defaultValue="false"]
attribute secure {booleanLiteral}?
& ## Sets the port number to use to connect to the LPS for a secure
## connection.
[a:defaultValue="443"
lza:since="1.1"]
attribute secureport {xsd:integer {minInclusive="0"}}?
&
## If true, include response headers (This is specific to HTTP datasets).
[a:defaultValue="true"]
attribute getresponseheaders {boolean}?
&
## If true, trim whitespace around XML text content
[a:defaultValue="false"]
attribute trimwhitespace {boolean}?
&
## Enables caching of the data response on both the LPS server
## and the client. There are security issues with enabling this.
## You usually want the getresponseheaders attribute to be false when
## you set this to true.
[a:defaultValue="false"]
attribute cacheable {boolean}? &
## The ondata script is executed when data arrives
[lza:since="1.1"]
attribute ondata {script}? &
## The onerror script is executed when an error occurs
[lza:since="1.1"]
attribute onerror {script}? &
## The ontimeout script is executed when a request times out
[lza:since="1.1"]
attribute ontimeout {script}? &
## HTTP request method = post | get
attribute querytype {"get" | "post" | "GET" | "POST" | "put" | "PUT" | "delete" | "DELETE"}?
anyXML = mixed {
element * {
attribute * {string}* &
anyXML
}*
}
dataptrAttributes =
attribute ondata {script}? &
attribute onerror {script}? &
attribute ontimeout {script}? &
attribute rerunxpath {boolean}? &
attribute xpath {string}? &
## This controls the spacing between elements if lazy replication is
## true.
[a:defaultValue="0"]
attribute spacing {size}?
datapointer =
element datapointer {
objectAttributes &
dataptrAttributes &
attribute p {expression}? &
objectElements
}
datapath =
element datapath {
objectAttributes &
dataptrAttributes &
## If pooling is true, views that are data-bound to this datapath
## are recycled if the dataset changes. Otherwise, views are deleted
## when the data nodes they are bound to disappear, and created
## when new data nodes match the datapath.
[a:since="1.1"
a:defaultValue="false"]
attribute pooling {boolean}? &
attribute axis {"x" | "y" }? &
attribute sortpath {string}? &
attribute sortorder {string}? &
attribute replication {"normal" | "lazy" | "resize" }? &
[lza:visibility="private"]
attribute p {expression}? &
objectElements
}
datapathChildren =
datapath?
& datapointer*
#
# Fonts
#
deviceAttribute = attribute device {boolean}?
font =
element font {
nameAttribute &
deviceAttribute? &
((srcAttribute & styleAttribute? & faceElement*)
| faceElement+)?
}
faceElement =
## Defines a font face or style within the font family that the
## outer element defines.
element face {styleAttribute? & srcAttribute}
styleAttribute =
## Corresponds to the fontstyle attribute of a view.
attribute style {"bold" | "italic" | "bold italic" | "italic bold" | "plain" } # TBD: actually, a list of "bold" or "italic"
#
# Class system
#
objectElements = method*
& handler*
& event*
& attributeElement*
& state*
& node*
& animator*
& animatorgroup*
attributeElement =
element attribute {
[lza:modifiers="final"]
attribute name {token}
& (attribute value {string} ?
& [lza:since="1.1"]
([a:defaultValue="immediately"]
attribute when { "immediately" | "once" | "always" }
)?
)?
& [a:defaultValue="expression"
lza:modifiers="final"]
attribute type {"boolean" | "color" | "expression" | "number" | "size" |
"string" | "text" | "html"}?
& [a:defaultValue="false"]
attribute required {booleanLiteral}?
& [lza:since="1.1"]
attribute setter {script}?
}
class =
element class {
## The name of a new tag that this element defines.
[lza:modifiers="final"]
attribute name {token} &
## The name of the tag that this tag extends.
[a:defaultValue="view"
lza:modifiers="final"]
attribute extends {token}? &
## The comma-separated list of mixins, applied in order
attribute with {string}? &
## Any attribute can occur, depending on superclass.
## We need to handle this in a preprocessing step.
attribute * - (name|extends|with) {string}*
& docElement?
& viewContentElements
}
interface =
element interface {
## The name of a new tag that this element defines.
[lza:modifiers="final"]
attribute name {token} &
## The name of the tag that this tag extends.
[a:defaultValue="view"
lza:modifiers="final"]
attribute extends {token}? &
## Any attribute can occur, depending on superclass.
## We need to handle this in a preprocessing step.
attribute * - (name|extends|traits) {string}*
& docElement?
& viewContentElements
}
docElement =
element doc {
# it actually has more structure than this,
# but the DTD compiler chokes if we get too descriptive here.
any
}
any = (text | element * { attribute * { text }*, any })*
trait =
element trait {
## The name of a new tag that this element defines.
[lza:modifiers="final"]
attribute name {token} &
## Any attribute can occur
## We need to handle this in a preprocessing step.
attribute * - (name) {string}*
& viewContentElements
}
handler =
element handler {
nameAttribute
& [a:defaultValue="this"]
attribute reference {reference}?
& (([a:defaultValue=""
lza:modifiers="final"]
attribute args {string}? &
text) |
(attribute method {string}))
}
event =
element event {
nameAttribute
}
method =
element method {
(nameAttribute |
(nameAttribute? &
attribute event {string} &
[a:defaultValue="this"]
attribute reference {reference}?)) &
[a:defaultValue=""
lza:modifiers="final"]
attribute args {string}? &
text
}
importElement =
element import {
viewContent &
## A reference to a target file whose content is treated as a loadable module
attribute href {xsd:anyURI}
& attribute stage {"late" | "defer" }
& attribute onload {script}?
& [a:defaultValue="inherit"] attribute proxied {booleanLiteral | "inherit"}?
& attribute onerror {script}?
& attribute ontimeout {script}?
}
state =
element state {
viewContent
& attribute apply {boolean}?
& ## If pooling is true, views that are created by the state are not
## destroyed when the state is removed -- instead they just act
## as if they were by sending the onremovesubview event and setting
## their visibility to false.
[a:since="1.1"
a:defaultValue="false"]
attribute pooling {boolean}?
& ## Script that is executed when the state is applied to its parent.
attribute onapply {script}?
& ## Script that is executed when the state is removed from its parent.
attribute onremove {script}?
}
nodeAttributes = (
objectAttributes,
## The view in which a child is placed by default
attribute defaultplacement {string}?
)
nodeElements =
objectElements
& datapathChildren
& element data {
datasetAttributes & anyXML
}*
& element dataset {
datasetAttributes & anyXML
}*
nodeContent =
nodeAttributes &
nodeElements
node =
element node {nodeContent}
datarequest =
element datarequest {nodeContent}
layout =
element layout {
nodeContent &
attribute locked {booleanLiteral}?
}
#
# Application Configuration
#
splash =
element splash {
[lza:visibility="private"]
attribute hideafterinit {booleanLiteral}? &
[a:defaultValue="false"]
attribute persistent {booleanLiteral}? &
[lza:name="splash view"]
element view {
attribute name {token}? &
attribute resource {xsd:anyURI} &
attribute ratio {xsd:string}? &
[a:defaultValue="0"]
attribute x {numberLiteral}? &
[a:defaultValue="0"]
attribute y {numberLiteral}? &
[a:defaultValue="false"]
attribute center {booleanLiteral}?
}*
}
scriptElement =
element script {
## The pathname of a JavaScript file. This pathname is resolved
## relative to the file that contains the