Hide
Search Results

Yahoo! Markup Language (YML)

What is YML?

Similar in format to XML, Yahoo! Markup Language (YML) provides functionality to YAP modules in a safe and standardized fashion. As a YAP developer, you have the option of including YML in the code you write for YAP modules. YML is proprietary– it was invented by Yahoo! and runs only on YAP. Except for those written in JavaScript, YAP modules can return YML. The internal YAP module generators process the YML and convert it into HTML. If necessary, JavaScript libraries on the end-points attach dynamic behaviors in the user’s browser.

Benefits

YML offers the following benefits:

  • Dynamic and secure interactions: Some YML tags provide UI widgets and and rich interactions that normally require untrusted JavaScript.

  • Data encapsulation: YML tags allow sensitive or timely data to be presented to end-users in a uniform manner. For example, a module might emit the YML tag <yml:mailing-address userid="12345"/>

    The YML interpreter will replace this tag with user 12345’s mailing address only if the viewer has access. The application never has direct access to the raw data displayed. Another example is the tag stock <yml:stock symbol="YHOO"/>, which might be replaced with Yahoo’s stock price with a link back to Yahoo! Finance.

  • Scripting: YML may also provide relatively complex scripting capabilities, such as flow control, data access, and manipulation.

Syntax

Basic Example:

<yml:module>
  Hi.  I am a module.
  <yml:ajax-link params="foo=&quot;bar&quot;">
    Click Me
  </yml:ajax-link>
  <p>Foo=<yml:get name="foo"/></p>
</yml:module>

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 &quot; 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 39861. Avoid common mistakes such as unescaped spaces, entities (e.g. &amp;), 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 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.

Table of Contents