I don't know much about batch coding or vbscript. Anyway, what I have to ask right now is how to read specific data in an xml file using batch script or vbscript? The script would like to read empty tags or self terminate tags in xml. If the script found empty tags, it should output an error in a log file.
我对批量编码或vbscript了解不多。无论如何,我现在要问的是如何使用批处理脚本或vbscript读取xml文件中的特定数据?该脚本希望在xml中读取空标签或自终止标签。如果脚本找到空标记,则应在日志文件中输出错误。
I have my XML here:
我在这里有我的XML:
<author>
<fname>John</fname>
<lname>Doe</lname>
</author>
<institution>
<name/>
<city>Pork</city>
<country>Plate</country>
</institution>
Assuming, name tag is an error.
假设,name标签是一个错误。
1 个解决方案
#1
0
You can use MSXML to parse XML from VBScript. The sample code is mostly in C++ or JScript but here's a page that helps you convert those samples to VBScript. And here's an old question that could probably be used as a start to read through the XML: Traversing all nodes in an XML file with VBScript
您可以使用MSXML从VBScript解析XML。示例代码主要使用C ++或JScript,但这里有一个页面可以帮助您将这些示例转换为VBScript。这里有一个老问题可能用作读取XML的开始:使用VBScript遍历XML文件中的所有节点
And to write the data to a file, you can use FSO (FileSystemObject).
要将数据写入文件,可以使用FSO(FileSystemObject)。
#1
0
You can use MSXML to parse XML from VBScript. The sample code is mostly in C++ or JScript but here's a page that helps you convert those samples to VBScript. And here's an old question that could probably be used as a start to read through the XML: Traversing all nodes in an XML file with VBScript
您可以使用MSXML从VBScript解析XML。示例代码主要使用C ++或JScript,但这里有一个页面可以帮助您将这些示例转换为VBScript。这里有一个老问题可能用作读取XML的开始:使用VBScript遍历XML文件中的所有节点
And to write the data to a file, you can use FSO (FileSystemObject).
要将数据写入文件,可以使用FSO(FileSystemObject)。