VBScript reads configuration files in XML format

Source: Internet
Author: User

CopyCode The Code is as follows: Class clsgetprofile
'Too many threads have been transferred too many times
Private rootdoc
'Xml Syntax
'Reference: "1" has been deleted successfully because the name is not null
'Commandid usage: commandid
Public sub setprofile (strfilename)
Set data_xml = Createobject ("Microsoft. xmldom ")
Data_xml.async = false
Data_xml.load (strfilename)
Set rootdoc = data_xml.documentelement
End sub
'Zookeeper has been acquired when zookeeper has been acquired
'Reference: "1" has been named not null
'Option 2 "has been created successfully when the name is not null
'Too many threads: too many threads have been transferred too many times
Public Function getitem (strsectionname, itemname)
Set sectionnode = rootdoc. selectsinglenode (strsectionname)
Getitem = sectionnode. selectsinglenode (itemname). attributes (0). nodevalue
End Function
End Class
'Use zookeeper without authorization
'Zookeeper zookeeper generate zookeeper
'Dim config: Set Config = new clsgetprofile
'Configure zookeeper without naming conventions. zookeeper without naming conventions.
'Call config. setprofile ("config. xml ")
'Too many threads have been transferred too many times
'Wscript. Echo config. getitem ("messagedefine", "info.001 ")
'Wscript. Echo config. getitem ("messagedefine", "info.003 ")
'Wscript. Echo config. getitem ("messagedefine", "error.009 ")
'Wscript. Echo config. getitem ("messagedefine", "error000012 ")
Class clsgetprofile
'Too many threads have been transferred too many times
Private rootdoc
'Xml Syntax
'Reference: "1" has been deleted successfully because the name is not null
'Commandid usage: commandid
Public sub setprofile (strfilename)
Set data_xml = Createobject ("Microsoft. xmldom ")
Data_xml.async = false
Data_xml.load (strfilename)
Set rootdoc = data_xml.documentelement
End sub
'Zookeeper has been acquired when zookeeper has been acquired
'Reference: "1" has been named not null
'Option 2 "has been created successfully when the name is not null
'Too many threads: too many threads have been transferred too many times
Public Function getitem (strsectionname, itemname)
Set sectionnode = rootdoc. selectsinglenode (strsectionname)
Getitem = sectionnode. selectsinglenode (itemname). attributes (0). nodevalue
End Function
End Class
'Use zookeeper without authorization
'Zookeeper zookeeper generate zookeeper
'Dim config: Set Config = new clsgetprofile
'Configure zookeeper without naming conventions. zookeeper without naming conventions.
'Call config. setprofile ("config. xml ")
'Too many threads have been transferred too many times
'Wscript. Echo config. getitem ("messagedefine", "info.001 ")
'Wscript. Echo config. getitem ("messagedefine", "info.003 ")
'Wscript. Echo config. getitem ("messagedefine", "error.009 ")
'Wscript. Echo config. getitem ("messagedefine", "error000012 ")

Configuration File Format:Copy codeThe Code is as follows: <? XML version = "1.0" encoding = "UTF-8"?>
<Configuration>
<! -- Adjust parameters and define Definitions
-->
<Messagedefine>
<Info.001 value = "starting from the beginning. "/>
<Info.002 value = ". "/>
<Info.003 value = ". "/>
<Info.004 value = "abort. "/>
</Messagedefine>
<! -- Zookeeper Configuration
-->
<Othersection>
<Host value = "192.168.0.241"/>
<User value = "root"/>
</Othersection>
<Windowslogtoolconfig>
<Host value = "192.168.0.188"/>
<Port value = "3306"/>
</Windowslogtoolconfig>
</Configuration>

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.