| CallXML 3.0 Development Guide | Home | Frameset Home |
|
<block> container element<block> element, which groups all of our action and event handling elements into logical 'blocks' of code. CallXML 3.0 adds intelligent naming syntaxes to this element, that allows us to christen our containers so that they are more representative of what will be occurring in the section of code. To explain, all of the below elements are for all purposes equivalent:<block><case><do><if><switch><with><if>, or possibly <case>, to make our code more readable at a glance. If we decided that our section of code would output some media, or perform a specific action based on a user's input, we might choose to name our container element <do>. Again, there is no requirement of any kind as to what container name you use; this entirely dependent on the developer's coding style and sensibilities. <do> alias to populate the values of it's own 'child' elements. Again, in our last tutorial we used the <prompt> element to output our pre-recorded audio file to the caller. We will do the same thing here, but we will also add in some Text-To-Speech, and a <log> statement that will be visible in the application debugger window. The trick of it is, we are going to use the inherent ability of container elemnts to set our values but once, and have this populate all of our 'child' elements, as we covered above. Our starting point is going to be with our initial XML declarations,just like in the last tutorial. Remember, that as we are using the 3.0 version of the markup, the only suitable 'version' setting will be, (you guessed it), "3.0":
<?xml version="1.0" encoding="UTF-8"?>
<callxml version="3.0">
</callxml>
<?xml version="1.0" encoding="UTF-8"?>
<callxml version="3.0">
<do value="helloworld">
<prompt/>
<say/>
<log/>
</do>
</callxml>
<prompt>, <say>, and <log>), but per our definitions above, we know that these values will be generated from the container element. We can map this application, as-is, and call it, and the following will occur:<prompt> element will play the "helloworld.wav" file<say> element will render "helloworld" to the caller via TTS.<log> element will print out "helloworld" in the application debugger
<?xml version="1.0" encoding="UTF-8"?>
<callxml version="3.0">
<do>
<prompt value="helloworld"/>
<say>hello world</say>
<log value="helloworld">
</do>
</callxml>
<?xml version="1.0" encoding="UTF-8"?>
<callxml version="3.0">
<do value="helloworld">
<prompt/>
<say/>
<log/>
<say>we are now done with our humble application</say>
<log value="*** APPLICATION EXITING ***"/>
</do>
</callxml>
<say> and <log> element to the mix, this time with predefined values. You'll note that these values are not changed by the container element at all, and will execute as you see them above. Once again, nothing too fancy about adding in a few more media elements to hammer home the fact that container inheritance only applies to child elements that do not have a value defined.| ANNOTATIONS: EXISTING POSTS |
awirtz
|
|
| I notice you define "value" in the container tag and that is inherited as the "value" attribute of the "log" tag, but what about the "say" tag? According to the documentation on "say", there is no "value" attribute per se. Is "value" an undocumented attribute of "say" when used as a singleton tag, or is "value" a universally magic attribute that will be used in the absence of textual content in other tags as well?
Additionally, if "value" is universally magic, does it go the other way too? E.g. can I use text content inside a pair of "log" tags instead of a "value" attribute in a singleton "log" tag? -Aaron |
|
voxeojeff
|
|
| Hello Aaron,
I, too, noticed that 'value' is not listed as a valid attribute of the <say> element. However, per my testing, it appears to work. I have spoken with our CallXML 3.0 gurus about this, and they have informed me that it does indeed work for now, but if it is not listed in the documentation, then it is not guaranteed to continue working in the future as updated versions come out. I hope this helps clarify things. :-) Best regards, Jeff Menkel Voxeo Corporation |
|
visionik
|
|
| Actually Aaron, you're half right.
There are a few CallXML tags where the value attribute and the text content of that tag serve the same purpose. "Say" is one of them, so these are the same: <say>hello</say> <say value="hello"/> You might ask why this behavior is present on a few elements. In short, you're seeing a few places where we "prototyped" this behavior with an eye towards some CallXML 4 features we're testing. As voxeojeff said, because its undocumented - and because the underlying reason for its implementation was an experiment - it may go away. |
| login |
|