Advanced topics in data integration
445
For example, the schema for Animals.xml file described in
“Connecting to XML data with the
XMLConnector component (Flash Professional only)” on page 416
defines an array of objects
called Bird. Each object contains two fields (
name
and
url
). They also contain a sub-element
with one field called
id
. If you bind the Bird array to a DataSet component (using the
dataProvider
property) with three fields—
name
,
url
, and
id
—each item that is returned
from the array is constructed in the following way, for each item in the XML file:
■
Create an empty item.
■
Loop through the defined schema properties, extracting the values for each property from
the XML data, and assign these values to the created item. The Name and URL fields will
have values.
■
Provide this item to the DataSet component.
The ID field does not exist on the item, and the DataSet component has a blank entry for
each item assigned.
The solution is to create a new schema field under the object within the Bird array. The
new schema field is named
id
. Every schema field has a property called
path
that accepts
an XPath statement that points to the data in your XML file. In this case the XPath
expression would be
key/@id
. When you get to the second bullet in the above process,
data binding finds an
id
field for the object. It looks at the
path
property and uses the
XPath statement to get the correct data from the XML file. The correct data is then passed
to the DataSet component.
Summary of Contents for FLASH 8-FLASH
Page 1: ...Using Flash ...
Page 12: ...12 Contents ...
Page 110: ...110 Using Symbols Instances and Library Assets ...
Page 128: ...128 Working with Color Strokes and Fills ...
Page 156: ...156 Drawing ...
Page 190: ...190 Working with Text ...
Page 224: ...224 Working with Graphic Objects ...
Page 270: ...270 Creating Motion ...
Page 310: ...310 Working with Video ...
Page 362: ...362 Working with Screens Flash Professional Only ...
Page 386: ...386 Creating Multilanguage Text ...
Page 454: ...454 Data Integration Flash Professional Only ...
Page 500: ...500 Publishing ...
Page 534: ...534 Creating Accessible Content ...