我試圖創建一個解析器找到一個Word文件.docx
的修訂和作者...是否有Word .docx XML標籤的詞彙表?
我發現document.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
這樣,您可以點擊標籤,它會帶你到規範相應的定義。