生成xml

<%
bitFileExists=true
Dim   strFilename,strXMLFile
  strFilename   =   "test.xml "
  strXMLFile=server.mapPath(strFilename)
  set   oXML   =   server.createObject( "Microsoft.XMLDOM ")
  oXML.async   =   False
  'oXML.load(strXMLFile)
  'oXML.loadXML   " <?xml   version= " "1.0 " "   encoding= " "gb2312 " "   ?> "
  If   bitFileExists   Then
    set   oXMLf=oXML.appendChild(oXML.createElement( "Server1 "))
    set   oXMLs2=oXMLf.appendChild(oXML.createElement( "Server2 "))
  End   If
  for   i=0   to   9
  set   oXMLRec   =   oXMLs2.appendChild(oXML.createElement( "Host "))
  Set   hostnameAtt   =   oXML.createAttribute( "id ")
  hostnameAtt.Text   =   i
  oXMLRec.attributes.setNamedItem   hostnameAtt
  next
 
  set   oProcess=oXML.createProcessingInstruction( "xml ",   "version= '1.0 '   encoding= 'gb2312 ' ")
  oXML.insertBefore   oProcess,oXML.childnodes(0)
 
  oXML.save   strXMLFile
  set   oXML   =   nothing

%>

你可能感兴趣的:(xml)