Easy XML data processing in. NETFramework (4-4)

Source: Internet
Author: User
?? Figure9StringArrayinInternetExplorer ?? The Reader class provides special methods for describing Base64 and BinHex encoding streams. The following code snippet demonstrates how to use the ReadBase64 method of the XmlTextReader class to parse the document created using Base64 and BinHex collections ?? Figure 9 String Array in Internet Explorer

?? The Reader class provides special methods for describing Base64 and BinHex encoding streams. The following code snippet demonstrates how to use the ReadBase64 method of the XmlTextReader class to parse the document created using Base64 and BinHex collections.

XmlTextReader reader = new XmlTextReader (filename );

While (reader. Read ()){

If (reader. LocalName = 'element '){

Byte [] bytes = new byte [1, 1000];

Int n = reader. ReadBase64 (bytes, 0, 1000 );

String buf = Encoding. Unicode. GetString (bytes );

Console. WriteLine (buf. Substring (0, n ));

}

}

Reader. Close ();

?? Conversion from byte type to string type is achieved through the GetString method of the Encoding class. Although I only introduced the code based on the Base64 encoding set, I can simply use BinHex to change the method name to read the node content based on BinHex encoding (using the ReadBinHex method ). This technique can also be used to read any binary data expressed by byte data, especially image data.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.