Multiple Display methods of xml on the asp.net page

Source: Internet
Author: User
XML has been widely used in various aspects, but in. net applications, not many pages are displayed.
XML is displayed on the. net page. I mean to use XML diversity to display diverse images and texts on the asp.net page. For example, on the. net page, we can display a wide range of mathematical formulas, physical formulas, and special graphical symbols, as shown in a complex display with multiple combinations.
Here, we will introduce several types of XML content.
Method 1: Write it directly to the page and ask the browser to explain the XML syntax
Response. Write ("<? Xml version = '1. 0'?> ");
Response. Write ("<? Xml: stylesheet type = 'text/xsl 'href = 'style/test2_assist.xsl'?> ");
Response. Write ("<test name = 'postgraduate entrance exam 'Timing = '90' score = '000000'> ");
Response. Write ("<section name = 'select'> ");
Method 2: Explained by. net and output the displayed content
XPathDocument doc = new XPathDocument (Server. MapPath ("aa. xml "));
TransForm = new transForm ();
TransForm. Load (Server. MapPath ("style/aa. xsl "));
FileStream fs = new FileStream (Server. MapPath ("bb. xml"), FileMode. OpenOrCreate );
XPathNavigator nav = doc. CreateNavigator ();
TransForm. Transform (nav, null, fs );
Fs. Close ();
Method 3: generate an XML file and read it. The XML syntax is interpreted by the browser.
. The reason I omitted is that writing XML content into a file is very simple. It is also very easy to read the generated file and Write it to the page using the Response. Write () method.

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.