Display XML raw files directly in Web pages (HTML) and directly display XML-formatted files __html

Source: Internet
Author: User
Tags generator

The first of these methods

Use the <pre></pre> surround code (not in the browser, but in the rich editor can, Strange);
Use <xmp></xmp> Surround code (officially not recommended, but the effect is good oh, both in Firefox and IE can);
Use the <textarea></textarea> surround code (both in the rich editor and in the browser);

<pre> can not be displayed on the page;<xmp> good, feasible;<textarea> is displayed in the Text field, do not achieve the desired effect.

<xmp>
<div> explain the usage of HTML </div>
<div><span id= "Demo" > Miracle </span></div>
</xmp>

If you want to display the complete structure of XML in the Web page, direct output, IE will mistake the XML structure for the structure of HTML, the normal display can only display the values on all nodes, if you want to display the entire result, you can add tags at both ends of the XML <xmp>xml structure </XMP >

Code. <! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" > . 

The second method

&lt; for "<"
&gt; for ">"
"" "" "with &quot; means can also be processed in the background directly output to the page, the code shows the following

Code. <! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" > .This will allow you to display the full XML information.


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.