如何使用 vba 解析 XML [英] How to parse XML using vba

查看:131
本文介绍了如何使用 vba 解析 XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 VBA 中工作,想解析一个字符串,例如

I work in VBA, and want to parse a string eg

<PointN xsi:type='typens:PointN' 
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' 
xmlns:xs='http://www.w3.org/2001/XMLSchema'>
    <X>24.365</X>
    <Y>78.63</Y>
</PointN>

并获得 X &Y 值转换为两个单独的整数变量.

and get the X & Y values into two separate integer variables.

我是 XML 的新手,因为我所从事的领域一直在使用 VB6 和 VBA.

I'm a newbie when it comes to XML, since I'm stuck in VB6 and VBA, because of the field I work in.

我该怎么做?

推荐答案

这是一个有点复杂的问题,但似乎最直接的方法是通过 MSXML2.DOMDocument 加载 XML 文档或 XML 字符串,这将然后允许您访问 XML 节点.

This is a bit of a complicated question, but it seems like the most direct route would be to load the XML document or XML string via MSXML2.DOMDocument which will then allow you to access the XML nodes.

您可以在以下站点找到有关 MSXML2.DOMDocument 的更多信息:

You can find more on MSXML2.DOMDocument at the following sites:

这篇关于如何使用 vba 解析 XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆