I have an XML file with multiple root elements transferred to me from a third party. I would imagine that the third party in question has a reasonably good idea of how to structure XML files. Is there any way that this isn't a mistake on their part and that there is a way to, for example, import such a file into Access or another database system? The file contains multiple repetitions of the same XML tags with different values for different entities. Would there be a way to import these all at once so each XML tag creates a table populated by all entities?

有帮助吗?

解决方案

I have an XML file with multiple root elements

Well, your file is not an XML document, but (if you're lucky) it is an XML external general parsed entity, so you can parse it by creating a dummy XML document that references it as an entity. You need a skeletal document like this:

<!DOCTYPE orders [
<!ENTITY e SYSTEM "datafile.xml">
]>
<doc>&e;</doc>

I don't know what input you need for Access, but once you've got a document like this you can use XSLT to transform it into the desired format.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top