Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
Ifar-Xml-Edtor
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pangchong
Ifar-Xml-Edtor
Commits
a46d6f9f
Commit
a46d6f9f
authored
Sep 20, 2026
by
pangchong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(utils): 解决DTD约束生成中的自相矛盾问题
- 添加判断跳过出现在后段的元素约束生成 - 防止出现相互冲突的先后顺序约束 - 修复因矛盾约束导致的排列验证失败 - 优化DTD约束逻辑的准确性和健壮性
parent
e18a5ac0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletions
+4
-1
src/utils/dtdManager.ts
+4
-1
No files found.
src/utils/dtdManager.ts
View file @
a46d6f9f
...
...
@@ -357,7 +357,10 @@ function buildSequenceConstraints(model: DtdContentModel): Array<[string, string
const
after
=
getLeafNames
(
m
.
children
[
j
])
for
(
const
a
of
before
)
{
for
(
const
b
of
after
)
{
if
(
a
!==
b
&&
!
constraints
.
some
(([
x
,
y
])
=>
x
===
a
&&
y
===
b
))
{
// 跳过自相矛盾的约束:若 a 同时出现在 after 段(即 a 可在后段再次出现),
// 说明 a 与 b 之间无严格先后顺序,不应生成约束,否则会导致
// (a→b) 和 (b→a) 同时存在,使任何排列都无法通过验证。
if
(
a
!==
b
&&
!
after
.
includes
(
a
)
&&
!
constraints
.
some
(([
x
,
y
])
=>
x
===
a
&&
y
===
b
))
{
constraints
.
push
([
a
,
b
])
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment