Chapter 6. Yahoo! Markup Language (YML)

In this Chapter

Introduction to YML

What is YML?

Similar in format to XML, Yahoo! Markup Language (YML) provides functionality to Open Applications in a safe and standardized fashion. You include YML tags in the HTML code of an Open Application. At runtime, YAP processes YML tags and converts them into HTML. If necessary, JavaScript libraries on the endpoints attach dynamic behaviors in the user's browser.

Benefits

YML offers the following benefits:

  • Social data: YML tags make it easy for you to create applications that access social data, such as a list of the user's friends.
  • Dynamic and secure interactions: Several YML tags provide UI widgets and and rich interactions that normally require untrusted JavaScript.
  • Data encapsulation: YML tags allow sensitive and timely data to be presented to end users in a uniform manner. The YML interpreter will replace tags with data only if the viewer has the proper access.

Syntax Rules

YML tags must conform to the following rules:

  • YML tags are namespaced with yml:. However, since YML documents are not actually XML, no formal namespace declaration is required.
  • All attributes must be enclosed in double quotes. To specify double quotes within an attribute value, enter the " character reference.
  • If the data type of an attribute is boolean, allowed values are "true" and "false", which must be enclosed in double quotes.
  • Singleton tags (that is, tags with no closing tags) must end with /> .
  • White space and indentations are passed through, but ignored in the interpretation phase.
  • YML tags accept and produce characters in UTF-8 only.

URL Parameter Encoding and Relative Paths

Some YML tags (including yml:a, yml:form, yml:include, and yml:message) have an attribute called params. The value of this attribute must conform to RFC 3986. Avoid common mistakes such as unescaped spaces, entities (e.g. &), and reverse encoding (percent-encoding of reserved characters used as delimiters or failure to percent-encode reserved characters used as data). Nonconforming syntax can cause runtime errors.

Unless otherwise documented, the params attribute specifies a path relative to your application's full-view URL, subject to the following rules:

  • If the first character in the value of params is "?", the value of params is simply appended to the URL.
  • If the value of params begins with any character other than "?", the URL is truncated to the last slash; then the value of params is appended.
  • If the URL ends with a trailing slash, it is not truncated.

The following examples illustrate how relative paths are constructed from params and the application URL.

Full-View URL Specified Parameters Result
http://example.com/my-full-view params="?x=1" http://example.com/my-full-view?x=1
http://example.com/my-full-view params="fetch-abc?x=1" http://example.com/fetch-abc?x=1
http://example.com/my-full-view/ params="fetch-abc?x=1" http://example.com/my-full-view/fetch-abc?x=1

YML Lite

YML Lite is a subset of YML designed for improved performance. The Small View of an Open Application can contain only HTML or YML Lite tags, which are:

  • yml:a
  • yml:audio
  • yml:form
  • yml:if-env
  • yml:include
  • yml:name
  • yml:profile-pic
  • yml:pronoun
  • yml:swf
  • yml:user-badge

Table of Contents