我需要替换XML标记ciphers
<Connector>
的值
<Connector sslEnabledProtocols="SSLv2Hello,TLSv1,TLSv1.1,TLSv1.2"
ciphers="TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_DSS_WITH_AES_256_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_DSS_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_DSS_WITH_AES_128_GCM_SHA256"
/>
问题在于,正如您所看到的,字符串非常长,我将其替换为同样长的字符串。 我正在使用VBScript进行替换(我正在替换另一个更短的字符串),但由于字符串的长度,我遇到了问题。这是我的代码:
Dim objXMLDoc
Dim objXMLElement
Dim objXMLNodeList
Dim oXML
Set oXML = CreateObject("Microsoft.XMLDOM")
oXML.load(dir)
If 0 = oXML.parseError Then
Dim sXPath : sXPath = "//Service/Connector[@port=""3170""]"
Dim ndFnd : Set ndFnd = oXML.selectSingleNode(sXPath)
If ndFnd Is Nothing Then
WScript.Echo "oops"
Else
ndFnd.getAttributeNode("ciphers").value = WScript.Arguments(2) & WScript.Arguments(3) & WScript.Arguments(4) & WScript.Arguments(5)
oXML.save(dir)
End If
End If
我已经不得不将该字符串拆分为四个我在命令行传递的变量。有没有办法追加属性的值?
现在我得到了
下标超出范围