How to read configuration files in xml format by vbscript
This article mainly shows you "vbscript how to read the configuration file in xml format", the content is easy to understand, clear, hope to help you solve the doubt, the following let Xiaobian lead you to study and learn "vbscript how to read the configuration file in xml format" this article.
The copy code is as follows:
Class clsGetProfile
I don't know. I don't know what to do.
Private rootDoc
'The xml name is not the same as the first name.
'Exponent: "1" under the name NOT NULL
'There 's a lot of money.
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
I don't know how to get my money.
'argument: "1" name NOT NULL
'2 'under the same name as NOT NULL
'' thank you.''I don't know what to do.
Public Function getItem (strSectionName, itemName)
Set sectionNode = rootDoc.selectSingleNode (strSectionName)
GetItem = sectionNode.selectSingleNode (itemName) .attributes (0) .nodeValue
End Function
End Class
'Use the following words.
'' I don't know. I don't know. I don't know what to do.
'Dim config: Set config = New clsGetProfile
'Configuring the name of the child, the name of the child, the name of the child.
'Call config.setProfile ("Config.xml")
"I don't know what to do," she said.
'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", "ERROR.012")
Class clsGetProfile
I don't know. I don't know what to do.
Private rootDoc
'The xml name is not the same as the first name.
'Exponent: "1" under the name NOT NULL
'There 's a lot of money.
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
I don't know how to get my money.
'argument: "1" name NOT NULL
'2 'under the same name as NOT NULL
'' thank you.''I don't know what to do.
Public Function getItem (strSectionName, itemName)
Set sectionNode = rootDoc.selectSingleNode (strSectionName)
GetItem = sectionNode.selectSingleNode (itemName) .attributes (0) .nodeValue
End Function
End Class
'Use the following words.
'' I don't know. I don't know. I don't know what to do.
'Dim config: Set config = New clsGetProfile
'Configuring the name of the child, the name of the child, the name of the child.
'Call config.setProfile ("Config.xml")
"I don't know what to do," she said.
'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", "ERROR.012")
Configuration file format:
The copy code is as follows:
The above is all the contents of the article "how vbscript reads configuration files in xml format". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!