我正在尝试创建一个解析器来查找Word .docx
文件中跟踪更改和作者的信息...
我找到了document.xml
,但是有太多的标签!是否有某个词汇表可以解释这些标签的含义?
如果可能的话,我想避免使用暴力破解的方法。
.docx
文件(以及其他新的MS Office文件,如.xlsx
)使用OOXML格式。
"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.
word/document.xml
中。<!-- 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
元素。