将XML文件导入Access [英] Import XML file into Access

查看:411
本文介绍了将XML文件导入Access的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆这样的xml文档:

<projectDescription>
    <name>Project1</name>
    <something else />
    <projects>
        <project>Dependency 1</project>
        <project>Dependency 2</project>
        ...
        <project>Dependency n</project>
    <projects>
    <other stuff I don't care about>
    ...
    </other stuff I don't care about>
</projectDescription>

我希望他们都像这样进入同一个访问表:

Project         Dependency
---------------------------
Project1        Dependency 1
Project1        Dependency 2
...
Project1        Dependency n

然后在每个XML文件的相同表中执行相同的操作.

表中的

下的每个节点应有一条记录

如果下面没有节点,则应该有一个项目名称为Dependency列的空值.

自动执行此操作的方法会很棒!

非常感谢!

解决方案

要从Access中执行此操作,您需要使用MSXML库编写代码以读取文件并提取所需的信息.确实可行,但很难做到.

或者,您可能希望使用XML转换(查找XLST)将XML文件转换为更易于处理的内容(更平坦的XML文件,甚至是CSV),然后(这次自动)将其加载到Access中. /p>

I have a bunch of xml documents structured like this:

<projectDescription>
    <name>Project1</name>
    <something else />
    <projects>
        <project>Dependency 1</project>
        <project>Dependency 2</project>
        ...
        <project>Dependency n</project>
    <projects>
    <other stuff I don't care about>
    ...
    </other stuff I don't care about>
</projectDescription>

And I want them to all go into the same access table like this:

Project         Dependency
---------------------------
Project1        Dependency 1
Project1        Dependency 2
...
Project1        Dependency n

Then do the same thing, in the same table for each xml file.

There should be one record in the table for every node under

If there are no nodes under there should be one entry with the project name and a null value for the Dependency column.

An automated way of doing this would be great!

Thanks so much!

解决方案

To do that from Access you'll need to write code using the MSXML library to read the files and extract the information you want. Quite doable, but hardly automatic.

Alternatively, you might want to transform the XML file into something more tractable (a flatter XML file, or even CSV) using an XML Transform (look up XLST) and then loading that (automatically, this time) into Access.

这篇关于将XML文件导入Access的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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