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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Nancy...For example, assume that you marked the employeeid column as hidden, as shownhere:DataColumn col = ds.Tables["Employees"].Columns["employeeid"];col.ColumnMapp<strong>in</strong>g = Mapp<strong>in</strong>gType.Hidden;The employeeid column is not rendered as an element or an employeeidattribute, but a custom attribute is always used. The name of this attribute ishiddenXXX, where XXX represents the name of the column—<strong>in</strong> this case,hiddenemployeeid. The new attribute belongs to the msdata namespace.NoteIn the context of the DiffGram, the msdata:hiddenXXX attribute is afull replacement <strong>for</strong> the hidden column—<strong>in</strong> other words, the<strong>in</strong><strong>for</strong>mation is not hidden at all, but the name of the column is a bitcamouflaged.DiffGram Format AnnotationsAnother remarkable difference between the ADO.<strong>NET</strong> <strong>XML</strong> normal <strong>for</strong>m and theDiffGram's data <strong>in</strong>stance is that the latter <strong>in</strong>cludes extra attributes such as id,hasChanges, hasErrors, and rowOrder. The extra attributes come from a couple ofcustom namespaces that are referenced at the beg<strong>in</strong>n<strong>in</strong>g of the DiffGram. Thesespecial attributes are used to flag nodes, thus relat<strong>in</strong>g elements across the varioussections—data <strong>in</strong>stance, changes, and errors.Table 10-1 lists all the DiffGram special attributes, also commonly referred to asannotations.Table 10-1: DiffGram AnnotationsAttributeDescriptiondiffgr:errorConta<strong>in</strong>s the text that describes the error <strong>for</strong> the rowor a column on the row.diffgr:hasChanges Indicates that the row has been modified or <strong>in</strong>serted.diffgr:hasErrorsIndicates that the row conta<strong>in</strong>s an error.diffgr:idReturns the unique ID used to couple rows acrosssections.diffgr:parentIdReturns the unique ID <strong>for</strong> the parent row.msdata:hiddenXXX Replacement attribute <strong>for</strong> columns marked as hidden.XXX denotes the actual name of the column.msdata:rowOrder Tracks the ord<strong>in</strong>al position of the row <strong>in</strong> the DataSetobject.There's no special reason <strong>for</strong> annotations to come from different namespaces—it's justa more rational categorization. Attributes <strong>in</strong> the diffgr namespace relate elements from365

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

Saved successfully!

Ooh no, something went wrong!