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.

Both XmlL<strong>in</strong>kedNode and XmlCharacterData are abstract classes that provide basicfunctionality <strong>for</strong> more specialized types of nodes. L<strong>in</strong>ked nodes are nodes that youmight f<strong>in</strong>d as constituent elements of an <strong>XML</strong> document just l<strong>in</strong>ked to a preced<strong>in</strong>g or afollow<strong>in</strong>g node. Character data nodes, on the other hand, are nodes that conta<strong>in</strong> andmanipulate only text.Properties of the XmlNode ClassTable 5-4 lists the properties of the XmlNode class that derived classes can override ifnecessary. For example, not all node types support attributes and not all have childnodes or sibl<strong>in</strong>gs. For situations such as this, the overridden properties can simplyreturn null or the empty str<strong>in</strong>g. By design, all node types must provide a concreteimplementation <strong>for</strong> each property.Table 5-4: Properties of the XmlNode ClassPropertyAttributesBaseURIChildNodesFirstChildHasChildNodesInnerTextInnerXmlIsReadOnlyItemLastChildDescriptionReturns a collection conta<strong>in</strong><strong>in</strong>g the attributes of thecurrent node. The collection is of typeXmlAttributeCollection.Gets the base URI of the current node.Returns an enumerable list object that allows you toaccess all the children of the current node. The objectreturned derives from the base class XmlNodeList,which is a l<strong>in</strong>ked list connect<strong>in</strong>g all the nodes with thesame parent and the same depth level (sibl<strong>in</strong>gs). No<strong>in</strong><strong>for</strong>mation is cached (not even the objects count), andany changes to the nodes are detected <strong>in</strong> real time.Returns the first child of the current node or null. Theorder of child nodes reflects the order <strong>in</strong> which theyhave been added. In turn, the <strong>in</strong>sertion order reflects thevisit<strong>in</strong>g algorithm implemented by the reader. (SeeChapter 2.)Indicates whether the current node has children.Gets or sets the text of the current node and all itschildren. Sett<strong>in</strong>g this property replaces all the childrenwith the contents of the given str<strong>in</strong>g. If the str<strong>in</strong>gconta<strong>in</strong>s markup, the text will be escaped first.Gets or sets the markup represent<strong>in</strong>g the body of thecurrent node. The contents of the node is replaced withthe contents of the given str<strong>in</strong>g. Any markup text will beparsed and result<strong>in</strong>g nodes <strong>in</strong>serted.Indicates whether the current node is read-only.Indexer property that gets the child element node withthe specified (qualified) name.Gets the last child of the current node. Aga<strong>in</strong>, whichnode is the last one depends ultimately on the visit<strong>in</strong>galgorithm implemented by the reader. Normally, it is thelast child node <strong>in</strong> the source document.178

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

Saved successfully!

Ooh no, something went wrong!