简体   繁体   English

以人类可读的格式显示 XML

[英]Displaying XML in human readable format

I have some medical records files which have this in the header:我有一些病历文件的标题中有这个:

ClinicalDocument xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:voc="urn:hl7-org:v3/voc" xmlns:sdtc="urn:hl7-org:sdtc" xmlns="urn:hl7-org:v3"> ClinicalDocument xsi:schemaLocation="urn:hl7-org:v3 CDA.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:voc="urn:hl7-org:v3 /voc" xmlns:sdtc="urn:hl7-org:sdtc" xmlns="urn:hl7-org:v3">

I would like to view them in a human readable format, in any of PDF, Word, or even in Excel.我想以人类可读的格式、PDF、Word 甚至 Excel 格式查看它们。

I can't figure out how to get the appropriate "stylesheet", assuming this is what I am missing.我不知道如何获得适当的“样式表”,假设这是我所缺少的。

This is what I have tried:这是我尝试过的:

1) If I open the file in a browser, I get the formatted XML with a message that says "This XML file does not appear to have any style information associated with it. The document tree is shown below." 1) 如果我在浏览器中打开该文件,我会收到带有消息的格式化 XML,其中显示“此 XML 文件似乎没有任何与之关联的样式信息。文档树如下所示。”

2) I have tried googling for the file CDA.xsd and I went through this page http://motorcycleguy.blogspot.com/2010/07/where-is-xsd-for-ccd.html which had a couple of links which gave me some large tar files which I couldn't figure out how to use. 2)我尝试在谷歌上搜索文件 CDA.xsd,我浏览了这个页面http://motorcycleguy.blogspot.com/2010/07/where-is-xsd-for-ccd.html ,其中有几个链接给了我一些我不知道如何使用的大 tar 文件。 One of them had a C32_CDA.xsd but when I rename that to CDA.xsd and put it in the same folder as my XML and then try to open it via Excel I cannot get it to display properly.其中一个有 C32_CDA.xsd,但是当我将其重命名为 CDA.xsd 并将其与我的 XML 放在同一文件夹中,然后尝试通过 Excel 打开它时,我无法正确显示它。

Any assistance would be most appreciated.任何帮助将不胜感激。

Is the <ClinicalDocument> tag the first thing in this CCDA document file? <ClinicalDocument> 标签是这个 CCDA 文档文件中的第一件事吗? Or are there one or two xml instructions at the very top like this (or maybe both on the same line):或者像这样在最顶部有一两条 xml 指令(或者可能都在同一行):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="_CDA_Stylesheet.xsl"?\>

In order for the CCDA Document to function as a valid "well-formed" xml document, it needs to have this xml instruction as the first thing in the file,为了使 CCDA 文档作为有效的“格式良好”的 xml 文档运行,它需要将此 xml 指令作为文件中的第一件事,

  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

above the root or Document Element, which is the <ClinicalDocument > tag in the CCDA.在根或文档元素上方,即 CCDA 中的 <ClinicalDocument > 标签。

The second xml instruction should indicate what xsl stylesheet is used to display the document in a web browser like Chrome, Edge, IE whatever.第二个 xml 指令应该指示使用什么 xsl 样式表在诸如 Chrome、Edge、IE 等 Web 浏览器中显示文档。

If the 2nd xml instruction in your file looks something like this:如果文件中的第二条 xml 指令如下所示:

 <?xml-stylesheet type="text/xsl" href="_CDA_Stylesheet.xsl"?\>

Then you would know that the stylesheet that the CCDA needs is an xsl stylesheet file with the name:那么您就会知道 CCDA 需要的样式表是一个 xsl 样式表文件,其名称为:

 _CDA_Stylesheet.xsl

and it needs to be located in the same folder as the ccda xml document.并且它需要与ccda xml文档位于同一文件夹中。

Or, the xsl stylesheet could be located in a folder that all ccda.xml users have access to, then the relative path to that xsl file can be included in the "href" attribute's value in the ccda.xml document's 2nd XML Instruction, something like:或者,xsl 样式表可以位于所有 ccda.xml 用户都可以访问的文件夹中,然后该 xsl 文件的相对路径可以包含在 ccda.xml 文档的第二条 XML 指令中的“href”属性值中,诸如此类喜欢:

 <?xml-stylesheet type="text/xsl" href=".\..\xslLibrary\_CDA_Stylesheet.xsl"?\>

If you have edited the ccda.xml file in Notepad, and made sure that the 2 xml instructions are at the top of the document, and you have put both the CCDA document and its required stylesheet (*.xsl) file into the same folder, you should be able to browse to the ccda.xml document and display it in your web browser.如果您在记事本中编辑了 ccda.xml 文件,并确保 2 条 xml 指令位于文档顶部,并且您已将 CCDA 文档及其所需的样式表 (*.xsl) 文件放入同一文件夹中,您应该能够浏览到 ccda.xml 文档并将其显示在您的 Web 浏览器中。

This will allow you to read the document in a coherent, inexpensive and relatively easy manner like so:这将使您能够以连贯、廉价且相对简单的方式阅读文档,如下所示:

在 Web 浏览器中查看带有样式表的 CCDA

  If, however, you are not looking for a clerical/clinical use of the document, you 
 can use Microsoft Access 2012 or 2016 and "import" the "external" xml file with 
 "Structure and Data" - and I think this will load it into a database with tables that  
 are named after each xml element in the document.  I don't recommend this, as it 
 loads the xml data elements as unrelated tables in MS Access.  If, however, you could
 transform the standard ccda into a specially designed xml/xslt document with 
 appropriate relational attributes added into the xml, you may be able to come up with 
 an xml document that imports easily into MS Access - then you could export each table  
 as an Excel csv or tab-delimited file. 

by the way, I found my example xslt stylesheet by searching HL7.org website looking for testing information.顺便说一句,我通过搜索 HL7.org 网站寻找测试信息找到了我的示例 xslt 样式表。 If you do find a suitable xsl stylesheet for ccda, you will have to edit the 2nd XML instruction to enter the appropriate stylesheet name.如果确实找到了适合 ccda 的 xsl 样式表,则必须编辑第二条 XML 指令以输入适当的样式表名称。

To display an XML document in human-readable format you need (typically) an XSLT stylesheet.要以人类可读的格式显示 XML 文档,您(通常)需要一个 XSLT 样式表。 It seems your XML is in a vocabulary called HL7 (health level 7?).似乎您的 XML 位于称为 HL7(健康级别 7?)的词汇表中。 I don't know much about HL7 except that it has a reputation for being very complex, so it's quite likely that the stylesheets needed will also be very complex.我对 HL7 了解不多,只是因为它以非常复杂而著称,因此很有可能所需的样式表也非常复杂。

A quick google showed a project for creating HL7 stylesheets here:一个快速的谷歌在这里展示了一个用于创建 HL7 样式表的项目:

https://wiki.hl7.org/index.php?title=CDA_R2.1_Stylesheet_Project https://wiki.hl7.org/index.php?title=CDA_R2.1_Stylesheet_Project

You might find something there that is useful to you.您可能会在那里找到对您有用的东西。

The XML files you have are C-CDA documents, which are used to communicate information between clinical systems.您拥有的 XML 文件是 C-CDA 文档,用于在临床系统之间交流信息。 They are defined according to a HL7 standard.它们是根据 HL7 标准定义的。

There are many xslt stylesheets you could use to display them - search for C-CDA stylesheets.您可以使用许多 xslt 样式表来显示它们 - 搜索 C-CDA 样式表。

I have created a C-CDA viewer you can use too: https://github.com/brynlewis/C-CDA_Viewer我创建了一个你也可以使用的 C-CDA 查看器: https : //github.com/brynlewis/C-CDA_Viewer

A demo of it is here: http://backbeachsoftware.com.au/challenge/index.htm它的演示在这里: http : //backbeachsoftware.com.au/challenge/index.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM