Some friends of the host does not support FSO, but also generate HTML files, is it a bit embarrassing?
And today's support for ASP hosts are generally using Microsoft OS, and these OS are generally Win2K server and above system, even if not install XML parser will also support XML parser parsing
and Xmldom has a. Save method. By doing this, we can generate HTML files on the non-FSO host.
First, it's a point. Note the normalization of HTML and XML code.
Html
<input name=t1>
This is no problem, the standard wording should be <input name= "T1" >
But if it's in XML,
<input name=t1> must be wrong, because the XML node attribute value is required within quotation marks.
Similarly <input name= "T1" > is also wrong because XML requires closed nodes that you can write
<input name= "T1" ></input>, but <input name= "T1" ></Input> is also wrong because XML is case-sensitive
For input This XML node, its text value is empty, thus can be written as <input name= "T1"/>
This conforms to the XML specification.
Like HTML <br> in XML to write <br></br> or <br/>
Image in HTML
<image src= "Http://edu.cnzz.cn/NewsInfo/test.gif" >
Write <image src= "http://edu.cnzz.cn/NewsInfo/test.gif" in XML/>
There are special characters ", >,<, ',", nodes are not allowed to cross and so on, first say so much, as for the normalization of XML documents is not the focus of this article, please refer to the relevant information.
How to use the FSO to generate an HTML file this is not to say. But if you use FSO, your intention is to generate such HTML files
<title>test</title>
<body>
<p>
</body>
However, to generate a document with an XML specification, you must be
<title>test</title>
<body>
<p></p>
</body>
How do I save this XML-formatted document to the server?
Dim xmlstring
Xmlstring= "Dim xmldoc
Set xmldoc = Server.CreateObject ("Msxml2.domdocument")
Xmldoc.loadxml (xmlstring)
Xmldoc.save (Server.MapPath ("test.htm"))
Set xmldoc=nothing
This uses the XMLDOM.loadXML () method, which loads an XML document into an object.
This is why you want to write the HTML that you generate for the XML specification, because the Loadxml () method only supports text strings that conform to XML specifications
Of course you need to have write access to the directory