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.

Figure 5-3: The XmlL<strong>in</strong>kedNode class's NextSibl<strong>in</strong>g method lets applications navigatethrough the children of each node.Scroll<strong>in</strong>g <strong>for</strong>ward through the list of child nodes is fast and effective. The same can't besaid <strong>for</strong> backward scroll<strong>in</strong>g. The list of nodes is not double-l<strong>in</strong>ked, and each nodedoesn't also store a po<strong>in</strong>ter to the previous one <strong>in</strong> the list. For this reason,PreviousSibl<strong>in</strong>g reaches the target node by walk<strong>in</strong>g through the list from the beg<strong>in</strong>n<strong>in</strong>gto the node that precedes the current one.TipTo summarize, when you are process<strong>in</strong>g <strong>XML</strong> subtrees, try tom<strong>in</strong>imize calls to PreviousSibl<strong>in</strong>g, Item, and Count because theyalways walk through the entire collection of subnodes to get theirexpected output. Whenever possible, design your code to takeadvantage of <strong>for</strong>ward-only movements and per<strong>for</strong>m them us<strong>in</strong>gNextSibl<strong>in</strong>g.Methods of the XmlNode ClassTable 5-5 lists the methods exposed by the XmlNode class.Table 5-5: Methods of the XmlNode ClassMethodAppendChildCloneCloneNodeGetEnumeratorDescriptionAdds the specified node to the list of children ofthe current node. The node is <strong>in</strong>serted at thebottom of the list.Creates a duplicate of the current node. Forelement nodes, duplication <strong>in</strong>cludes child nodesand attributes.Creates a duplicate of the current node. Takes aBoolean argument <strong>in</strong>dicat<strong>in</strong>g whether clon<strong>in</strong>gshould proceed recursively. If this argument istrue, call<strong>in</strong>g the CloneNode method is equivalentto call<strong>in</strong>g Clone. Entity and notation nodes can'tbe cloned.Returns an <strong>in</strong>ternal and node-specific object thatimplements the IEnumerator <strong>in</strong>terface. Thereturned object provides the support needed toarrange <strong>for</strong>-each iterations.180

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

Saved successfully!

Ooh no, something went wrong!