Home > Articles > Web Services > XML

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

3.27 log

Element type

log (2.0)

Attributes

expr | label

Parents

block | catch | error | filled | help | if | noinput | nomatch

Children

PCDATA | value

Description

When the interpreter encounters this element, it will write a message to its log. The message will consist either of the contents of this element or of the evaluation of the expr attribute. Developers can use log to trace the execution of their VoiceXML programs.

DTD

<!ELEMENT log (#PCDATA | value)* >
<!ATTLIST log
  label CDATA        #IMPLIED
  expr  %expression; #IMPLIED >

Language model

03fig27.gif

Attributes

  • expr : expression

    An optional ECMAScript expression evaluating to string whose value is to be written to the log file.

  • label : CDATA

    Indicates the category for this log message. This is useful when sifting through lengthy log files.

Children

  • PCDATA or value elements

    To be written to the log file.

Examples

Example 3-31 Application that produces logging data

<?xml version="1.0" encoding="iso-8859-1"?>
<vxml version="2.0">
  <form id="test">
    <field name="ssno" type="digits">
      <prompt>
        Please enter your social security number.
      </prompt>
      <filled>
        <if cond="ssno.length!=9">
          <prompt>
            I'm sorry. That is not a valid social security number.
          </prompt>
          <log label="user_error">
            Bad SS#: <value expr="ssno"/>
          </log>
          <clear namelist="ssno"/>
          <reprompt/>
        </if>
      </filled>
    </field>
  </form>
</vxml>
  • + Share This
  • 🔖 Save To Your Account