共用方式為


txt element 

Specifies that the text contained within this element should be rendered on the associated device according to the alignment, wrap, and color characteristics provided by the corresponding attributes.

Element Information

Element type: TextType complexType

Namespace: https://schemas.microsoft.com/sideshow/2006/scf

Schema name: Simple Content Format

Elements and Attributes

Parent Elements

content element

dialog element

Child Elements

em element

clr element

br element

Attributes

Attribute

Type

Required

Description

Possible values

align

Alignment (simple type)

Optional

Specifies the horizontal alignment of the contained text on the page, although devices need not conform to the setting of this property. If not specified, the default is "l" for left alignment.

  • "l" (left)
  • "r" (right)
  • "c" (center)

wrap

TextWrap (simple type)

Optional

Specifies whether the contained text must fit on a single line, truncated if necessary, or whether the contained text is allowed to wrap onto multiple lines. If not specified, the default is "1" for text wrapping.

  • "0" for single line text that may require truncation.
  • "1" for text that will wrap onto multiple lines if necessary.

rgb

ColorRGB (simple type)

Optional

Specifies the RGB value of the color to use for the contained text. Devices need not conform to the setting of this attribute.

Hexadecimal numbers containing from one through six digits, inclusive.

Remarks

Devices determine the font to use for the contained text.

If the optional align attribute is not specified, the default behavior is that the text is left-aligned.

If the optional wrap attribute is not specified, the default behavior is that the text wraps onto multiple lines, if necessary.

The txt element uses the TextType complex type to define the type that allows for one or more instances of the clr element, the em element, and the br element to occur within it, interspersed with text. Further, the clr element and the em element, are defined so that they can occur within each other.

The TextType complex type element uses Text group element to define the set of possible child elements for the txt element as an unbounded sequence of zero or more of the following child elements: em, clr, and br.

The TextType complex type element uses the Alignment simple type element to define the type that contains valid values for the align attribute of the txt element. The valid values are "l", "r", and "c", designating alignment to the left, to the right, and to the center, respectively.

The TextType complex type element uses TextWrap simple type element to define the type that contains valid values for the wrap attribute of the txt element. The valid values are "0" and "1", designating that text wrapping is disallowed (resulting in truncation of the text) and that text wrapping onto multiple lines is allowed, respectively.

The TextType complex type element uses ColorRGB simple type element to define the type that contains valid values for the rgb attribute of the txt element. The valid values are hexadecimal numbers containing from one through six digits, inclusive. The digits are interpreted in pairs, with two hexadecimal values for each of the colors: red, green, and blue, respectively.

Usage Example

The following code example displays content for a media player.

<body>
    <content id="200" title="Now Playing" bg="50" bgfit="s" menuid="1000">
        <txt align="c" wrap="0">Title: <em>Song Title</em></txt>
        <br/>
        <txt align="c" wrap="0">Artist: <clr rgb="F0F0F0">Song Artist</clr></txt>
        <br/>
        <txt align="c" wrap="0" rgb="0F0F0F">00:00:00</txt>
        <br/>
        <img align="l" id="16" alt="[Album Cover]" />
    </content>
</body>

Schema Definition

The following schema defines complex, simple, and group types.

<xsd:element name="txt" type="TextType" />

<xsd:complexType name="TextType" mixed="true">
    <xsd:group ref="Text" minOccurs="0" maxOccurs="unbounded" />
    <xsd:attribute name="align" type="Alignment" use="optional" />
    <xsd:attribute name="wrap" type="TextWrap" use="optional" />
    <xsd:attribute name="rgb" type="ColorRGB" use="optional" />
</xsd:complexType>

<xsd:group name="Text">
    <xsd:choice>
        <xsd:element ref="em" />
        <xsd:element ref="clr" />
        <xsd:element ref="br" />
    </xsd:choice>
</xsd:group>

<xsd:simpleType name="Alignment">
    <xsd:restriction base="xsd:string">
        <xsd:pattern value="l|r|c" />
    </xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="TextWrap">
    <xsd:restriction base="xsd:nonNegativeInteger">
        <xsd:minInclusive value="0" />
        <xsd:maxInclusive value="1" />
    </xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="ColorRGB">
    <xsd:restriction base="xsd:hexBinary">
        <xsd:minLength value="1" />
        <xsd:maxLength value="6" />
    </xsd:restriction>
</xsd:simpleType>

See Also

Concepts

content element
dialog element
em element
clr element
br element