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.

Table 4-4: Writ<strong>in</strong>g Methods of the XmlWriter ClassMethodWriteNmTokenWriteProcess<strong>in</strong>gInstructionWriteQualifiedNameWriteStartAttributeDescriptionvalid name accord<strong>in</strong>g to the W3C <strong>XML</strong> 1.0recommendation.Writes the specified name, ensur<strong>in</strong>g that it is avalid NmToken accord<strong>in</strong>g to the W3C <strong>XML</strong> 1.0recommendation.Writes a process<strong>in</strong>g <strong>in</strong>struction us<strong>in</strong>g therequired syntax .Writes the namespace-qualified name afterlook<strong>in</strong>g up the prefix that is <strong>in</strong> scope <strong>for</strong> thespecified namespace.Writes the start of an attribute. Switches thewriter's state to Attribute.WriteStartDocument Writes the <strong>XML</strong> 1.0 standard prologdeclaration.WriteStartElementWrites the specified start tag <strong>for</strong> the specifiedelement node.WriteStr<strong>in</strong>gWrites the specified text contents. Can beused with open attributes or element nodes.WriteWhitespaceWrites the specified white space.Some of these methods are abstract; some are not. In particular, the XmlWriter classprovides an implementation <strong>for</strong> one-shot methods that group a few more basic calls.For example, WriteAttributeStr<strong>in</strong>g is implemented <strong>in</strong> XmlWriter like this:public void WriteAttributeStr<strong>in</strong>g(str<strong>in</strong>g localName, str<strong>in</strong>g value){WriteStartAttribute(null, localName, null);WriteStr<strong>in</strong>g(value);WriteEndAttribute();}Other, more specialized, writ<strong>in</strong>g methods available <strong>in</strong> the XmlWriter <strong>in</strong>terface are listed<strong>in</strong> Table 4-5.Table 4-5: Miscellaneous Writ<strong>in</strong>g MethodsMethodDescriptionWriteAttributesWrites all the attributes found at the currentposition <strong>in</strong> the specified XmlReader object. Thismethod is actually implemented <strong>in</strong> XmlWriter.(This method will be discussed <strong>in</strong> more detail <strong>in</strong>the section "A Read/Write <strong>XML</strong> Stream<strong>in</strong>gParser," on page 179.)WriteBase64Encodes the specified b<strong>in</strong>ary bytes as base64and writes out the result<strong>in</strong>g text. (Base64encod<strong>in</strong>g is designed to represent arbitrary byte117

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

Saved successfully!

Ooh no, something went wrong!