是否有Word .docx XML标签的词汇表?
我试图创建一个解析器找到一个Word文件.docx
的修订和作者...是否有Word .docx XML标签的词汇表?
我发现document.xml
,但有这么多的标签!所有这些标签都代表什么地方有词汇表?
我想避免蛮力强迫我通过这种方式,如果可能的话。
"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.
您可以在Stack Overflow docx tag wiki itself开始收集关于它的信息。
.docx
文件(以及其他新的MS Office文件就像.xlsx
)use OOXML format
特别是:
微软的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页!)你想要的功能,并看看现有的开源库已经完成了你想做的一些工作。
“Office Open XML”格式及其XML词汇表在http://www.ecma-international.org/publications/standards/Ecma-376.htm中有详细描述。
为了给你一个想法,下面这段XSLT的应该只提取有效的结果文本没有被跟踪缺失一个WordprocessingML文档的,如将word/document.xml
下被储存在一个.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
元素的照顾。
你可以用我docx4j web应用程序,特别是http://webapp.docx4java.org/OnlineDemo/PartsList.html
这样,您可以点击标签,它会带你到规范相应的定义。