This feature enables designers to configure a text field to dynamically pull data from a web URL. This allows designer to incorporate live information such as product information, text updates, stock quotes, and queue numbers directly from a web link.
The dynamic text field is located in the PROPERTY section, and the following table describes the function of each item:
|Dynamic Text||Checkbox to toggle activation of Dynamic Text feature.|
|Text Source||Text entry field to enter the URL address of the text to be fetched. It is expected that the URL returns either a plain text content or XML content.|
|Refresh Interval||Designates the time interval (measured in seconds) for the widget to fetch new data from the URL.|
|Max Words||Defines the maximum number of words that can be displayed in the widget window.|
|Delimiter||Enables the input of customized symbols or words to mark the end of a delimited text.|
Using Dynamic Text Fields
From an existing plain text widget’s editing page, select the Dynamic Text checkbox to activate the dynamic text field feature.
Key in the text source and set the refresh interval. You can also set the max number of words to be displayed. Add a delimiter if necessary. Click Apply to confirm your settings and click close window once you have finished.
Click update to update the editor with your text source. By default, null is displayed.
Xpath Expressions in Dynamic Text
This feature enables designers to include customized Xpath (XML Path Language) expressions when creating dynamic queries from XML files via the properties of a text widget.
Sample XML (taken from www.w3schools.com/dom/books.xml)
<bookstore> <book category="cooking"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> <book category="children"> <title lang="en">Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book> <book category="web"> <title lang="en">XQuery Kick Start</title> <author>James McGovern</author> <author>Per Bothner</author> <author>Kurt Cagle</author> <author>James Linn</author> <author>Vaidyanathan Nagarajan</author> <year>2003</year> <price>49.99</price> </book> <book category="web" cover="paperback"> <title lang="en">Learning XML</title> <author>Erik T. Ray</author> <year>2003</year> <price>39.95</price> </book> </bookstore>
Sample Xpath: /bookstore/book/title
Output: Everyday Italian
Using Xpath Expressions in Dynamic Text
From the PROPERTIES tab of the widget editing page, click on the Add New Property button. Enter the correct details in the Key and Value sections and click OK to save the entry. Click Finish to complete the process.
In this example, custom.text.dynamic.xmlquery was assigned as the Key, and /bookstore/book/title was assigned as the Value. This expression fetches the title from the first book.