I'm creating a XML document of registry keys and parameters on VBScript.
Script is working normal, but if the name of the registry key or registry parameter does contain special symbols, like a /, %, #, \ and other - it causes an error in msxml6.dll:
This name shouldn't contain a symbol
Code of error: 80004005.
in line 8 of this script:
Dim root, len
Dim rootPath
rootPath = Split(WScript.Arguments(0), "\") 'Registry key
len = UBound(rootPath)
root = rootPath(len)
Set xmlParser = CreateObject("Msxml2.DOMDocument.6.0")
xmlParserAappendChild(xmlParser.CreateProcessingInstruction("xml", "version='1.0' encoding='utf-8'"))
Set rootNode = xmlParser.AppendChild(xmlParser.CreateElement(root))
Set CreateXml = xmlParser
I tryed to find it in Google, but it wasn't successful
How can I fix it?
The characters
/,%,#, and\aren't valid characters in an XML node name.From the XML spec:
I'd recommend using generic node names (like
<key>and<value>) and placinging the key/value names as the value of an attributenameof those nodes. Example: