【问题标题】:Is there a glossary of Word .docx XML tags?是否有 Word .docx XML 标签的词汇表?
【发布时间】:2018-03-24 15:55:40
【问题描述】:

我正在尝试创建一个解析器来查找 Word .docx 文件的跟踪更改和作者...

我找到了document.xml,但是标签太多了!所有这些标签所代表的含义是否有词汇表?

如果可能的话,我想避免暴力破解。

【问题讨论】:

    标签: xml docx glossary


    【解决方案1】:

    您可以在Stack Overflow docx tag wiki itself 中开始收集有关它的信息。

    .docx 文件(以及其他新的 MS Office 文件,如 .xlsxuse OOXML format


    特别是:

    Microsoft Office Open XML WordProcessingML 主要在 ECMA 376 和 ISO 29500。

    您可以在此处获取相关的 ECMA 标准规范:http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm

    您可能正在寻找的特定文档可能是Open Office XML, Part 4 : Markup Language Reference

    当然……这是巨大的(5219 页!)

    我强烈建议您确定您想要的功能,并查看现有的开源库,这些库已经完成了您想做的一些工作。

    【讨论】:

      【解决方案2】:

      http://www.ecma-international.org/publications/standards/Ecma-376.htm 中详细描述了“Office Open XML”格式及其 XML 词汇表。

      给你一个想法,下面的 XSLT应该只提取 wordprocessingML 文档的有效结果文本没有跟踪删除,就像将存储在 @987654322 下一样@ 在 .docx 文件(ZIP 存档)中。

      <!-- Match and output text spans except when
           appearing in w:delText child content -->
      <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
        <xsl:output method="text"/>
        <xsl:template match="w:t">
          <xsl:value-of select="."/>
        </xsl:template>
        <xsl:template match="w:delText"/>
        <xsl:template match="*">
          <xsl:apply-templates/>
        </xsl:template>
      </xsl:stylesheet>
      

      为了让您的应用程序改为提取更改,您还必须注意 w:ins 元素。

      【讨论】:

        【解决方案3】:

        你可以使用我的 docx4j webapp,特别是http://webapp.docx4java.org/OnlineDemo/PartsList.html

        你可以点击一个标签,它会带你到规范中的相应定义。

        【讨论】:

          【解决方案4】:
          "w:ins" denotes what was inserted when trackedchanges are enabled.
          "w:del" denotes what was deleted when  trackedchanges are enabled.
          "w:commentRangeStart" denotes the start of a comment
          "w:commentRangeEnd" denotes the end of the comment.
          
          All text are found inside 
          "w:t" tags.
          

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2023-03-24
            • 2022-11-19
            相关资源
            最近更新 更多