fix: 内置 Office 技能离线资源与中文校验 / offline Office schemas and XML validation (#218)

## 中文

内网环境显式使用 Office skill 校验含 `docProps/core.xml` 的文件时,Schema 仍引用远程 Dublin
Core XSD;Windows 默认 GBK 读取中文 UTF-8 XML 也会报错。本修改让 docx/pptx/xlsx 独立携带完整本地
Schema 闭包,并按 XML 编码声明读取文件,保留完整校验。

- 三个 Office skill 分别随包加入 Dublin Core 三份 XSD,复用本地
xml.xsd,补齐来源、原始摘要、许可与适配说明。
- 修正两个 Microsoft XSD 的 ST_String 类型引用,以及 presentation-forge 编辑器脚本路径。
- 市场版本 1.5.11;docx 1.0.4、pptx 1.0.5、xlsx 1.0.4、presentation-forge
0.1.1,同步目录元数据。
- 新增定向回归:遍历所有内置技能的 XSD,拒绝远程依赖并离线编译;模拟 GBK 校验中文 XML,确认非法 Word 节点仍被拒绝。

验证:126 份 XSD 离线编译、2 项回归通过;i18n/catalog 校验均为 0 errors / 105 既有
warnings;translate --check 与 git diff --check 通过。README
两种语言同步。工作树、路径、Git 元数据与发布正文隐私检查通过。

Windows x64 dev 10.0.181 已通过产品 prepare-static 准备随包依赖,并真实调用
Skill(docx):创建、全校验、解包编辑、重新打包、再全校验均退出 0,两次校验各 18 valid / 0 skipped / 0
errors。该实验禁用 pip/npm 依赖索引,保留模型连接;不等同于正式包或全机断网验收。辅助 Grep
有一次旧参数错误,改正后成功;Python 缓存污染安装摘要另列真机测试跟踪。主仓 market.zip 尚未刷新,源 PR 合并后需通过
sync-market 纳入产品。

## English

Office validation in an intranet deployment still depended on remote
Dublin Core schemas, and reading Chinese UTF-8 XML with the Windows GBK
default could fail. Each Office skill now includes its local schema
dependency closure, and validators read XML as bytes so its declared
encoding is respected without weakening validation.

This also fixes two Microsoft schema type references and the
presentation-forge editor script path. Market version becomes 1.5.11;
skill versions become docx 1.0.4, pptx 1.0.5, xlsx 1.0.4 and
presentation-forge 0.1.1. Vendored schemas include attribution,
licensing, original hashes and adaptation notes.

Validation: 126 schemas compile offline; both targeted regression tests
pass, including GBK input and invalid-node rejection. Catalog/i18n
checks pass with 105 existing warnings each; translation freshness and
whitespace checks pass. Bilingual README and publication privacy checks
are complete.

The actual Windows x64 dev session passed explicit docx loading,
creation, full validation, editing, repacking and revalidation using
product-prepared dependencies. Dependency indexes were disabled while
model connectivity remained available. Packaged/cross-platform testing
and the observed Python-cache installation-digest drift remain
follow-ups. The product bootstrap ZIP will require sync-market after
this source PR merges.

真机测试与剩余验收 / Hardware testing and remaining acceptance:
https://github.com/desirecore/desirecore/issues/4819

---------

Co-authored-by: Johnson <yeslee1126@gmail.com>
This commit is contained in:
2026-10-16 00:06:24 +08:00
committed by GitHub
parent e8fb262399
commit f7f4fcd035
39 changed files with 1846 additions and 44 deletions

View File

@@ -16,7 +16,7 @@ description: >-
report, standalone Python script, database pipeline, or Google Sheets API
integration, even if tabular data is involved. Use when 用户提到 Excel、
电子表格、xlsx、表格处理、公式计算、数据清洗、图表、CSV导入导出。
version: 1.0.3
version: 1.0.4
type: procedural
risk_level: low
status: enabled
@@ -28,7 +28,7 @@ tags:
- office
metadata:
author: anthropic
updated_at: '2026-04-13'
updated_at: '2026-10-14'
i18n:
default_locale: en-US
source_locale: zh-CN

View File

@@ -29,14 +29,14 @@
},
"release": {
"state": "known",
"version": "1.0.3",
"version": "1.0.4",
"versionScheme": "semver"
},
"timestamps": {
"catalogUpdatedAt": {
"state": "known",
"value": "2026-07-07T13:14:31Z",
"precision": "second"
"value": "2026-10-14",
"precision": "day"
},
"releasePublishedAt": {
"state": "unknown"

View File

@@ -0,0 +1,13 @@
# Office 离线 Schema 依赖
此目录包含 Office 元数据校验所需的 Dublin Core XML Schema。XML schemas Copyright © 2011 [DCMI](https://www.dublincore.org/),按 [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) 使用;许可依据见 [DCMI Schema Use Notice](https://www.dublincore.org/about/copyright/)。上游 Schema 标注创建日期为 2003-04-02,原作者与文档注释保留在文件内。
|本地文件|原始来源|原始文件 SHA-256|
|---|---|---|
|`dublin-core/dc.xsd`|https://www.dublincore.org/schemas/xmls/qdc/2003/04/02/dc.xsd|`bc1d454db1bb20dfb1867a3fe0cf007775fc4afa33a5df425c12d854f049f1f6`|
|`dublin-core/dcterms.xsd`|https://www.dublincore.org/schemas/xmls/qdc/2003/04/02/dcterms.xsd|`6328c8b574c166f8ebc28d07231e6ee47121e9791689b70c3afa665f22099fed`|
|`dublin-core/dcmitype.xsd`|https://www.dublincore.org/schemas/xmls/qdc/2003/04/02/dcmitype.xsd|`4980845d0bedcf45e707fa64eb47492ae4f95ac4ae42f5c3c68b58c0bc9e8e49`|
本地适配规范化三份文件的行尾空白与缩进,并修改 `dc.xsd` / `dcterms.xsd` 的 XML 命名空间 import 路径,复用已随包提供的 `ISO-IEC29500-4_2016/xml.xsd`;`dcmitype.xsd` 仅调整空白。Office `opc-coreProperties.xsd` 改为引用本地 `dublin-core/`,不改变命名空间 URI 或类型定义。三套技能分别携带完整闭包,独立安装时不依赖其它技能目录。
离线编译与中文 XML 回归:从市场仓库根运行 `uv run scripts/office/test_offline_resources.py`。运行时仍需要 `lxml` / `defusedxml`;本文件不表示捆绑 LibreOffice 或其它办公系统工具。

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://purl.org/dc/elements/1.1/"
targetNamespace="http://purl.org/dc/elements/1.1/"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation xml:lang="en">
DCMES 1.1 XML Schema
XML Schema for http://purl.org/dc/elements/1.1/ namespace
Created 2003-04-02
Created by
Tim Cole (t-cole3@uiuc.edu)
Tom Habing (thabing@uiuc.edu)
Jane Hunter (jane@dstc.edu.au)
Pete Johnston (p.johnston@ukoln.ac.uk),
Carl Lagoze (lagoze@cs.cornell.edu)
This schema declares XML elements for the 15 DC elements from the
http://purl.org/dc/elements/1.1/ namespace.
It defines a complexType SimpleLiteral which permits mixed content
and makes the xml:lang attribute available. It disallows child elements by
use of minOcccurs/maxOccurs.
However, this complexType does permit the derivation of other complexTypes
which would permit child elements.
All elements are declared as substitutable for the abstract element any,
which means that the default type for all elements is dc:SimpleLiteral.
</xs:documentation>
</xs:annotation>
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="../ISO-IEC29500-4_2016/xml.xsd">
</xs:import>
<xs:complexType name="SimpleLiteral">
<xs:annotation>
<xs:documentation xml:lang="en">
This is the default type for all of the DC elements.
It permits text content only with optional
xml:lang attribute.
Text is allowed because mixed="true", but sub-elements
are disallowed because minOccurs="0" and maxOccurs="0"
are on the xs:any tag.
This complexType allows for restriction or extension permitting
child elements.
</xs:documentation>
</xs:annotation>
<xs:complexContent mixed="true">
<xs:restriction base="xs:anyType">
<xs:sequence>
<xs:any processContents="lax" minOccurs="0" maxOccurs="0"/>
</xs:sequence>
<xs:attribute ref="xml:lang" use="optional"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:element name="any" type="SimpleLiteral" abstract="true"/>
<xs:element name="title" substitutionGroup="any"/>
<xs:element name="creator" substitutionGroup="any"/>
<xs:element name="subject" substitutionGroup="any"/>
<xs:element name="description" substitutionGroup="any"/>
<xs:element name="publisher" substitutionGroup="any"/>
<xs:element name="contributor" substitutionGroup="any"/>
<xs:element name="date" substitutionGroup="any"/>
<xs:element name="type" substitutionGroup="any"/>
<xs:element name="format" substitutionGroup="any"/>
<xs:element name="identifier" substitutionGroup="any"/>
<xs:element name="source" substitutionGroup="any"/>
<xs:element name="language" substitutionGroup="any"/>
<xs:element name="relation" substitutionGroup="any"/>
<xs:element name="coverage" substitutionGroup="any"/>
<xs:element name="rights" substitutionGroup="any"/>
<xs:group name="elementsGroup">
<xs:annotation>
<xs:documentation xml:lang="en">
This group is included as a convenience for schema authors
who need to refer to all the elements in the
http://purl.org/dc/elements/1.1/ namespace.
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="any"/>
</xs:choice>
</xs:sequence>
</xs:group>
<xs:complexType name="elementContainer">
<xs:annotation>
<xs:documentation xml:lang="en">
This complexType is included as a convenience for schema authors who need to define a root
or container element for all of the DC elements.
</xs:documentation>
</xs:annotation>
<xs:choice>
<xs:group ref="elementsGroup"/>
</xs:choice>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://purl.org/dc/dcmitype/"
targetNamespace="http://purl.org/dc/dcmitype/"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation xml:lang="en">
DCMI Type Vocabulary XML Schema
XML Schema for http://purl.org/dc/dcmitype/ namespace
Created 2003-04-02
Created by
Tim Cole (t-cole3@uiuc.edu)
Tom Habing (thabing@uiuc.edu)
Jane Hunter (jane@dstc.edu.au)
Pete Johnston (p.johnston@ukoln.ac.uk),
Carl Lagoze (lagoze@cs.cornell.edu)
This schema defines a simpleType which enumerates
the allowable values for the DCMI Type Vocabulary.
</xs:documentation>
</xs:annotation>
<xs:simpleType name="DCMIType">
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:Name">
<xs:enumeration value="Collection"/>
<xs:enumeration value="Dataset"/>
<xs:enumeration value="Event"/>
<xs:enumeration value="Image"/>
<xs:enumeration value="InteractiveResource"/>
<xs:enumeration value="Service"/>
<xs:enumeration value="Software"/>
<xs:enumeration value="Sound"/>
<xs:enumeration value="Text"/>
<xs:enumeration value="PhysicalObject"/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
</xs:schema>

View File

@@ -0,0 +1,331 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dcmitype="http://purl.org/dc/dcmitype/"
targetNamespace="http://purl.org/dc/terms/"
xmlns="http://purl.org/dc/terms/"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation xml:lang="en">
DCterms XML Schema
XML Schema for http://purl.org/dc/terms/ namespace
Created 2003-04-02
Created by
Tim Cole (t-cole3@uiuc.edu)
Tom Habing (thabing@uiuc.edu)
Jane Hunter (jane@dstc.edu.au)
Pete Johnston (p.johnston@ukoln.ac.uk),
Carl Lagoze (lagoze@cs.cornell.edu)
This schema declares XML elements for the DC elements and
DC element refinements from the http://purl.org/dc/terms/ namespace.
It reuses the complexType dc:SimpleLiteral, imported from the dc.xsd
schema, which permits simple element content, and makes the xml:lang
attribute available.
This complexType permits the derivation of other complexTypes
which would permit child elements.
DC elements are declared as substitutable for the abstract element dc:any, and
DC element refinements are defined as substitutable for the base elements
which they refine.
This means that the default type for all XML elements (i.e. all DC elements and
element refinements) is dc:SimpleLiteral.
Encoding schemes are defined as complexTypes which are restrictions
of the dc:SimpleLiteral complexType. These complexTypes restrict
values to an appropriates syntax or format using data typing,
regular expressions, or enumerated lists.
In order to specify one of these encodings an xsi:type attribute must
be used in the instance document.
Also, note that one shortcoming of this approach is that any type can be
applied to any of the elements or refinements. There is no convenient way
to restrict types to specific elements using this approach.
</xs:documentation>
</xs:annotation>
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="../ISO-IEC29500-4_2016/xml.xsd">
</xs:import>
<xs:import namespace="http://purl.org/dc/elements/1.1/"
schemaLocation="dc.xsd"/>
<xs:import namespace="http://purl.org/dc/dcmitype/"
schemaLocation="dcmitype.xsd"/>
<xs:element name="alternative" substitutionGroup="dc:title"/>
<xs:element name="tableOfContents" substitutionGroup="dc:description"/>
<xs:element name="abstract" substitutionGroup="dc:description"/>
<xs:element name="created" substitutionGroup="dc:date"/>
<xs:element name="valid" substitutionGroup="dc:date"/>
<xs:element name="available" substitutionGroup="dc:date"/>
<xs:element name="issued" substitutionGroup="dc:date"/>
<xs:element name="modified" substitutionGroup="dc:date"/>
<xs:element name="dateAccepted" substitutionGroup="dc:date"/>
<xs:element name="dateCopyrighted" substitutionGroup="dc:date"/>
<xs:element name="dateSubmitted" substitutionGroup="dc:date"/>
<xs:element name="extent" substitutionGroup="dc:format"/>
<xs:element name="medium" substitutionGroup="dc:format"/>
<xs:element name="isVersionOf" substitutionGroup="dc:relation"/>
<xs:element name="hasVersion" substitutionGroup="dc:relation"/>
<xs:element name="isReplacedBy" substitutionGroup="dc:relation"/>
<xs:element name="replaces" substitutionGroup="dc:relation"/>
<xs:element name="isRequiredBy" substitutionGroup="dc:relation"/>
<xs:element name="requires" substitutionGroup="dc:relation"/>
<xs:element name="isPartOf" substitutionGroup="dc:relation"/>
<xs:element name="hasPart" substitutionGroup="dc:relation"/>
<xs:element name="isReferencedBy" substitutionGroup="dc:relation"/>
<xs:element name="references" substitutionGroup="dc:relation"/>
<xs:element name="isFormatOf" substitutionGroup="dc:relation"/>
<xs:element name="hasFormat" substitutionGroup="dc:relation"/>
<xs:element name="conformsTo" substitutionGroup="dc:relation"/>
<xs:element name="spatial" substitutionGroup="dc:coverage"/>
<xs:element name="temporal" substitutionGroup="dc:coverage"/>
<xs:element name="audience" substitutionGroup="dc:any"/>
<xs:element name="mediator" substitutionGroup="audience"/>
<xs:element name="educationLevel" substitutionGroup="audience"/>
<xs:element name="accessRights" substitutionGroup="dc:rights"/>
<xs:element name="bibliographicCitation" substitutionGroup="dc:identifier"/>
<xs:complexType name="LCSH">
<xs:simpleContent>
<xs:restriction base="dc:SimpleLiteral">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:attribute ref="xml:lang" use="prohibited"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="MESH">
<xs:simpleContent>
<xs:restriction base="dc:SimpleLiteral">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:attribute ref="xml:lang" use="prohibited"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="DDC">
<xs:simpleContent>
<xs:restriction base="dc:SimpleLiteral">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:attribute ref="xml:lang" use="prohibited"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="LCC">
<xs:simpleContent>
<xs:restriction base="dc:SimpleLiteral">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:attribute ref="xml:lang" use="prohibited"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="UDC">
<xs:simpleContent>
<xs:restriction base="dc:SimpleLiteral">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:attribute ref="xml:lang" use="prohibited"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="Period">
<xs:simpleContent>
<xs:restriction base="dc:SimpleLiteral">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:attribute ref="xml:lang" use="prohibited"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="W3CDTF">
<xs:simpleContent>
<xs:restriction base="dc:SimpleLiteral">
<xs:simpleType>
<xs:union memberTypes="xs:gYear xs:gYearMonth xs:date xs:dateTime"/>
</xs:simpleType>
<xs:attribute ref="xml:lang" use="prohibited"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="DCMIType">
<xs:simpleContent>
<xs:restriction base="dc:SimpleLiteral">
<xs:simpleType>
<xs:restriction base="dcmitype:DCMIType"/>
</xs:simpleType>
<xs:attribute ref="xml:lang" use="prohibited"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="IMT">
<xs:simpleContent>
<xs:restriction base="dc:SimpleLiteral">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:attribute ref="xml:lang" use="prohibited"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="URI">
<xs:simpleContent>
<xs:restriction base="dc:SimpleLiteral">
<xs:simpleType>
<xs:restriction base="xs:anyURI"/>
</xs:simpleType>
<xs:attribute ref="xml:lang" use="prohibited"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="ISO639-2">
<xs:simpleContent>
<xs:restriction base="dc:SimpleLiteral">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:attribute ref="xml:lang" use="prohibited"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="RFC1766">
<xs:simpleContent>
<xs:restriction base="dc:SimpleLiteral">
<xs:simpleType>
<xs:restriction base="xs:language"/>
</xs:simpleType>
<xs:attribute ref="xml:lang" use="prohibited"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="RFC3066">
<xs:simpleContent>
<xs:restriction base="dc:SimpleLiteral">
<xs:simpleType>
<xs:restriction base="xs:language"/>
</xs:simpleType>
<xs:attribute ref="xml:lang" use="prohibited"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="Point">
<xs:simpleContent>
<xs:restriction base="dc:SimpleLiteral">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:attribute ref="xml:lang" use="prohibited"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="ISO3166">
<xs:simpleContent>
<xs:restriction base="dc:SimpleLiteral">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:attribute ref="xml:lang" use="prohibited"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="Box">
<xs:simpleContent>
<xs:restriction base="dc:SimpleLiteral">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:attribute ref="xml:lang" use="prohibited"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="TGN">
<xs:simpleContent>
<xs:restriction base="dc:SimpleLiteral">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:attribute ref="xml:lang" use="prohibited"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
<xs:group name="elementsAndRefinementsGroup">
<xs:annotation>
<xs:documentation xml:lang="en">
This group is included as a convenience for schema authors
who need to refer to all the DC elements and element refinements
in the http://purl.org/dc/elements/1.1/ and
http://purl.org/dc/terms namespaces.
N.B. Refinements available via substitution groups.
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="dc:any" />
</xs:choice>
</xs:sequence>
</xs:group>
<xs:complexType name="elementOrRefinementContainer">
<xs:annotation>
<xs:documentation xml:lang="en">
This is included as a convenience for schema authors who need to define a root
or container element for all of the DC elements and element refinements.
</xs:documentation>
</xs:annotation>
<xs:choice>
<xs:group ref="elementsAndRefinementsGroup"/>
</xs:choice>
</xs:complexType>
</xs:schema>

View File

@@ -5,9 +5,9 @@
xmlns:dcterms="http://purl.org/dc/terms/" elementFormDefault="qualified" blockDefault="#all">
<xs:import namespace="http://purl.org/dc/elements/1.1/"
schemaLocation="http://dublincore.org/schemas/xmls/qdc/2003/04/02/dc.xsd"/>
schemaLocation="../../dublin-core/dc.xsd"/>
<xs:import namespace="http://purl.org/dc/terms/"
schemaLocation="http://dublincore.org/schemas/xmls/qdc/2003/04/02/dcterms.xsd"/>
schemaLocation="../../dublin-core/dcterms.xsd"/>
<xs:import id="xml" namespace="http://www.w3.org/XML/1998/namespace"/>
<xs:element name="coreProperties" type="CT_CoreProperties"/>

View File

@@ -1,4 +1,5 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:w12="http://schemas.openxmlformats.org/wordprocessingml/2006/main" elementFormDefault="qualified" attributeFormDefault="qualified" blockDefault="#all" xmlns="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" targetNamespace="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash">
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:st="http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes" xmlns:w12="http://schemas.openxmlformats.org/wordprocessingml/2006/main" elementFormDefault="qualified" attributeFormDefault="qualified" blockDefault="#all" xmlns="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" targetNamespace="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash">
<xsd:import namespace="http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes" schemaLocation="../ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd"/>
<xsd:import id="w12" namespace="http://schemas.openxmlformats.org/wordprocessingml/2006/main" schemaLocation="../ISO-IEC29500-4_2016/wml.xsd"/>
<xsd:attribute name="storeItemChecksum" type="w12:ST_String"/>
<xsd:attribute name="storeItemChecksum" type="st:ST_String"/>
</xsd:schema>

View File

@@ -1,7 +1,8 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:w12="http://schemas.openxmlformats.org/wordprocessingml/2006/main" elementFormDefault="qualified" attributeFormDefault="qualified" blockDefault="#all" xmlns="http://schemas.microsoft.com/office/word/2015/wordml/symex" targetNamespace="http://schemas.microsoft.com/office/word/2015/wordml/symex">
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:st="http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes" xmlns:w12="http://schemas.openxmlformats.org/wordprocessingml/2006/main" elementFormDefault="qualified" attributeFormDefault="qualified" blockDefault="#all" xmlns="http://schemas.microsoft.com/office/word/2015/wordml/symex" targetNamespace="http://schemas.microsoft.com/office/word/2015/wordml/symex">
<xsd:import namespace="http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes" schemaLocation="../ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd"/>
<xsd:import id="w12" namespace="http://schemas.openxmlformats.org/wordprocessingml/2006/main" schemaLocation="../ISO-IEC29500-4_2016/wml.xsd"/>
<xsd:complexType name="CT_SymEx">
<xsd:attribute name="font" type="w12:ST_String"/>
<xsd:attribute name="font" type="st:ST_String"/>
<xsd:attribute name="char" type="w12:ST_LongHexNumber"/>
</xsd:complexType>
<xsd:element name="symEx" type="CT_SymEx"/>

View File

@@ -760,7 +760,8 @@ class BaseSchemaValidator:
)
schema = lxml.etree.XMLSchema(xsd_doc)
with open(xml_file, "r") as f:
# 按 XML 自身的编码声明读取,避免 Windows 默认 GBK 破坏 UTF-8 文档。
with open(xml_file, "rb") as f:
xml_doc = lxml.etree.parse(f)
xml_doc, _ = self._remove_template_tags_from_text_nodes(xml_doc)