【问题标题】:How do i import a XML into filemaker pro or MS Access?如何将 XML 导入 filemaker pro 或 MS Access?
【发布时间】:2014-03-19 23:53:58
【问题描述】:

我有一组 XML 文件以及一个样式表和模式,我想将它们导入到 filemaker pro 数据库或 MS 访问中。问题是每次我选择要导入的 XML 文件然后选择样式表时,我都会在尝试导入时出错。
我需要指定架构文件的文件制造商或访问权限中的某个地方吗?因为我认为这可能是问题所在。
谢谢

样式表称为 spl.xsl

<!--

The contents of this file are subject to the Health Level-7 Public
License Version 1.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the
License at http://www.hl7.org/HPL/hpl.txt.

Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and
limitations under the License.

The Original Code is all this file.

The Initial Developer of the Original Code is Gunther Schadow.
Portions created by Initial Developer are Copyright (C) 2002-2004
Health Level Seven, Inc. All Rights Reserved.

Contributor(s): Steven Gitterman, Brian Keller

Revision: $Id: spl.xsl,v 1.52 2005/08/26 05:59:26 gschadow Exp $

Revision: $Id: spl-common.xsl,v 2.0 2006/08/18 04:11:00 sbsuggs Exp $

-->
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:v3="urn:hl7-org:v3" version="1.0" exclude-result-prefixes="v3 xsl">
<xsl:import href="spl-common.xsl"/>
<!--  Where to find JavaScript resources  -->
<xsl:param name="resourcesdir">http://www.accessdata.fda.gov/spl/stylesheet/</xsl:param>
<!--
 Whether to show the clickable XML, set to "/.." instead of "1" to turn off 
-->
<xsl:param name="show-subjects-xml" select="/.."/>
<!--
 Whether to show the data elements in special tables etc., set to "/.." instead of "1" to turn off 
-->
<xsl:param name="show-data" select="1"/>
<!--  This is the CSS link put into the output  -->
<xsl:param name="css">
http://www.accessdata.fda.gov/spl/stylesheet/spl.css
</xsl:param>
<!--
 Whether to show section numbers, set to 1 to enable and "/.." to turn off
-->
<xsl:param name="show-section-numbers" select="/.."/>
<!--  Whether to process mixins  -->
<xsl:param name="process-mixins" select="true()"/>
<xsl:param name="core-base-url">http://www.accessdata.fda.gov/spl/core</xsl:param>
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
</xsl:transform>

https://drive.google.com/folderview?id=0Bx_in_8GQ_x5MGNuQXlSbHJXRzA&usp=sharing

XML 文件示例:只有 1 个文件 https://drive.google.com/folderview?id=0Bx_in_8GQ_x5T3R4X2lXNzY0cXc&usp=sharing

【问题讨论】:

  • "我在尝试导入时遇到错误。" 您为什么不发布您收到的确切错误消息。 “filemaker 或 access 中是否有我需要指定架构文件的地方?”没有(至少在导入 FileMaker 时不需要)。但是,您的 XSLT 样式表必须将源 XML 转换为 FileMaker 的 FMPXMLRESULT 语法。这更有可能是问题所在。
  • 我使用的 XML 文件在这里dailymed.nlm.nih.gov/dailymed/downloadLabels.cfm 和架构和样式在这里dailymed.nlm.nih.gov/dailymed/preview/upload.cfm 这是否意味着我必须更改他们提供的样式表才能打开这些文件并导入到 filemaker 中?
  • 请编辑您的问题并包含您尝试导入的示例 XML 和您正在使用的 XSLT 样式表。我在您提供的链接中都没有看到。
  • 我刚刚添加了它们。感谢您的帮助。
  • 我的意思是在问题中包含实际代码。您发布的链接中有许多文件,我没有心情去寻宝。

标签: xml database ms-access import filemaker


【解决方案1】:

这是一个 XSLT 样式表,您可以将其用作起点。它为&lt;structuredBody&gt; 部分中的每个顶级&lt;component&gt; 元素创建一条记录(ROW)。然后它从&lt;section&gt; 元素的&lt;id&gt; 元素的root 属性中获取值。

这将被传送到名为“RootID”的 FIELD。您将在 Filemaker 的导入对话框中看到此字段,并且您将能够将其映射到目标表中的字段 - 与从“真实”Filemaker 文件导入相同。

我建议您玩一会儿,然后尝试将更多数据添加到导入树中。然后,如果您有更具体的问题要问,请随时发布。但是,您需要具备一些基本的 XSLT 知识才能解决这个问题。

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:hl7="urn:hl7-org:v3"
exclude-result-prefixes="hl7">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/">

<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
<ERRORCODE>0</ERRORCODE>
<PRODUCT BUILD="" NAME="" VERSION=""/>
<DATABASE DATEFORMAT="" LAYOUT="" NAME="" RECORDS="" TIMEFORMAT=""/>

<METADATA>
    <FIELD NAME="RootID" TYPE="TEXT" EMPTYOK="YES" MAXREPEAT="1" />
    <!-- add more fields here -->   
</METADATA>

<RESULTSET FOUND="">
<xsl:for-each select="hl7:document/hl7:component/hl7:structuredBody/hl7:component">
<ROW>
        <COL><DATA><xsl:value-of select="hl7:section/hl7:id/@root"/></DATA></COL>
            <!-- add more columns here -->
</ROW>
</xsl:for-each>

</RESULTSET>
</FMPXMLRESULT>

</xsl:template>
</xsl:stylesheet>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-02-09
    • 1970-01-01
    • 2012-07-08
    • 1970-01-01
    • 1970-01-01
    • 2019-12-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多