13.07.2015 Views

Applied XML Programming for Microsoft .NET.pdf - Csbdu.in

Applied XML Programming for Microsoft .NET.pdf - Csbdu.in

Applied XML Programming for Microsoft .NET.pdf - Csbdu.in

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Some of the attributes and nodes that <strong>for</strong>m a DiffGram come from a couple of <strong>Microsoft</strong>proprietary namespaces. The default prefixes are msdata and diffgr. In particular, themsdata namespace conta<strong>in</strong>s a number of attributes that are annotations <strong>for</strong> the data <strong>in</strong>the stream. We'll look at these attributes and the entire structure of the DiffGram <strong>in</strong> thesection "DiffGram Format Annotations," on page 448.The Current Data InstanceThe first section of the DiffGram represents the current <strong>in</strong>stance of the data. Althoughit's not strictly mandatory from a syntax standpo<strong>in</strong>t, of the three constituent subtrees,the data <strong>in</strong>stance is the only subtree that you will always f<strong>in</strong>d <strong>in</strong> a DiffGram. A DiffGramwithout data is just the representation of an empty DataSet object. The and subtrees are not present if the source DataSet object has nopend<strong>in</strong>g changes and errors.A DiffGram is stateful and is like a superset of the ADO.<strong>NET</strong> <strong>XML</strong> normal <strong>for</strong>m. Thedata <strong>in</strong>stance is nearly identical to the normal <strong>for</strong>m, which is a simple, statelesssnapshot of data. The major difference between the DiffGram's data <strong>in</strong>stance and thenormal <strong>for</strong>m is that the DiffGram <strong>for</strong>mat does not <strong>in</strong>clude schema <strong>in</strong><strong>for</strong>mation. To makethe overall DiffGram <strong>for</strong>mat truly stateful, you must comb<strong>in</strong>e the data with two othersubtrees—the orig<strong>in</strong>al data and the pend<strong>in</strong>g errors. By comb<strong>in</strong><strong>in</strong>g the contents of thethree subtrees, a client can rebuild a faithful representation of the orig<strong>in</strong>al DataSetcontents.NoteLike the normal <strong>for</strong>m, not even the DiffGram can be considered aserialization <strong>for</strong>mat <strong>for</strong> the DataSet as an object. The DiffGram is aserialization <strong>for</strong>mat <strong>for</strong> the contents of a DataSet object. To be avalid serialization of the DataSet object itself, the DiffGram wouldneed to conta<strong>in</strong> schema <strong>in</strong><strong>for</strong>mation. Incidentally, theimplementation of the ISerializable <strong>in</strong>terface that both the DataSetobject and the DataTable object provide manages to return aspecial version of the DiffGram <strong>for</strong>mat that differs from this becauseit <strong>in</strong>corporates schema <strong>in</strong><strong>for</strong>mation. You'll learn how to buildDiffGram documents that conta<strong>in</strong> a schema <strong>in</strong> the section "TheDiffGram Viewer Application," on page 457.Data Generator ObjectsAs mentioned, the data subtree <strong>in</strong> a DiffGram is similar to the ADO.<strong>NET</strong> normal <strong>for</strong>m <strong>for</strong><strong>XML</strong> we looked at <strong>in</strong> Chapter 9. In both cases, the <strong>XML</strong> code be<strong>in</strong>g generated by theWriteXml method represents a snapshot of the data currently stored <strong>in</strong> the DataSet363

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!