![]() | ![]() ![]() ![]() |
![]() | |
![]() | |
![]() |
The XUpdateResolver component converts changes made to the data in your application into XUpdate statements that can be processed by an external data source. XUpdate is a standard for describing changes that are made to an XML document and is supported by a variety of XML databases, such as Xindice and XHive.
Note: You can also use the XUpdateResolver component to send data updates to any external data source that can parse the XUpdate languagefor example, an ASP page, a Java servlet, or a ColdFusion component. For more information, see the XUpdate specification.
The XUpdateResolver component communicates with the DataSet component using the DataSetDeltaToXUpdateDelta encoder. This encoder is responsible for creating XPath statements that uniquely identify nodes within an XML file based on the information contained within the DataSet component's DeltaPacket. This information is used by the XUpdateResolver component to generate XUpdate statements. For more information on the DataSetDeltaToXUpdateDelta encoder, see Schema encoders (Flash Professional only).
The XUpdateResolver component works only with Flash Player 7.
The XUpdateResolver component has one parameter, the includeDeltaPacketInfo
parameter (Boolean type). When this parameter is set to true
, the update packet includes additional information from the data set that can be used by an external data source to generate results that can be sent back to your application. This information includes a unique transaction and operation ID that is used internally by the data set.
Note: The additional information that is included in the update packet invalidates the XUpdate. This is expected behavior. You would choose to add this information only if you were going to store it within a server object and use it to generate a result packet. In this scenario, your server object would pull the information out of the update packet for it s own needs and then pass on the (now valid) XUpdate to the database.
Example (with false
setting):
<xupdate:modifications version="1.0" xmlns:xupdate="http://www.xmldb.org/xupdate"> <xupdate:remove select="/datapacket/row[@id='100']"/> </xupdate:modifications>
Example (with true
setting):
<xupdate:modifications version="1.0" xmlns:xupdate="http://www.xmldb.org/xupdate" transId="46386292065:Wed Jun 25 15:52:34 GMT-0700 2003"> <xupdate:remove select="/datapacket/row[@id='100']" opId="0123456789"/> </xupdate:modifications>
The typical workflow for the XUpdateResolver component is as follows.
Note: You may need to create a virtual schema for your XML file if you want to access a subelement of the array that you are binding to the data set. For more information, see Virtual XML schemas.
dataProvider
property of the DataSet component.deltaPacket
component property selected, use the Schema Attributes pane to set the encoder
property to the DataSetDeltaToXUpdateDelta encoder.rowNodeKey
value that uniquely identifies the row node within the XML file.
Note: The rowNodeKey
value combines an XPath statement with a field parameter to define how unique XPath statements should be generated for the update data contained within the DeltaPacket. See information on the DataSetDeltaToXUpdateDelta encoder in Schema encoders (Flash Professional only).
deltaPacket
property and the DataSet component's deltaPacket
property.xupdatePacket
property to the second XMLConnector component to send the data back to the external data source.
Note: The xupdatePacket
property contains the formatted DeltaPacket (XUpdate statements) that will be sent to the server.
Note: In addition to these steps, you an also create bindings to apply the result packet sent back from the server to the data set via the XUpdateResolver component.
For more information, see XUpdateResolver component.
Update packets sent to the server are in XUpdate format. The following is a sample XUpdate packet:
<?xml version="1.0"?> <xupdate:modifications version="1.0" xmlns:xupdate="http://www.xmldb.org/xupdate"> <xupdate:insert-after select="/addresses/address[1]" > <xupdate:element name="address"> <xupdate:attribute name="id">2</xupdate:attribute> <fullname>Lars Martin</fullname> <born day='2' month='12' year='1974'/> <town>Leizig</town> <country>Germany</country> </xupdate:element> </xupdate:insert-after> </xupdate:modifications>
Once the server has finished with the update packet, either successfully or unsuccessfully, it should send back a result packet containing errors or additional XML updates resulting from the update operation. If there are no messages, the results packet should still be sent, but it will have no operation result nodes.
The following is a sample result packet for an update packet that has no errors and contains no XML updates:
<results_packet nullValue="{_NULL_}" transID="46386292065:Wed Jun 25 15:52:34 GMT-0700 2003"/>
A sample results packet (with XML updates) follows:
<results_packet nullValue="{_NULL_}" transID="46386292065:Wed Jun 25 15:52:34 GMT-0700 2003"> <operation op="remove" id="11295627479" msg="The record could not be found"/> <operation op="update" id="02938027477"> <attribute name="id" curValue="105" msg="Invalid field value" /> </operation> </results_packet>
The results packet can contain an unlimited number of operation nodes. Operation nodes contain the results of operations from the update packet. Each operation node should have the following attributes/child nodes:
op
: An attribute describing the type of operation that was attempted. Must be insert, delete, or update.id:
An attribute that holds the ID from the operation node that was sent outfield
: 0, 1, or more child nodes that give field-level specific information. Each field node, at a minimum, should have a name
attribute, which contains the field name, and a msg
attribute, which gives the field-level message. It may also optionally contain a curValue
attribute, which holds the most up-to-date value for that field in that row on the server.![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |