出现最小值 vs 组出现最小值

发布于 2024-12-15 21:16:31 字数 1234 浏览 0 评论 0原文

早上好,

问题:

我正在尝试为输入文件创建架构。我无法获得正确的属性组合来验证我的测试文件。

输入文件

该文件由必需的标头、可选的可重复记录组和必需的尾部组成。该文件是一份员工列表,其中包含每个员工的信息。 组内重复的记录应按顺序呈现。组中的某些记录是可选的,有些则不是。重复组内每种类型的记录最多应有一个。

像这样:

header (required)

E1 (required if group is present)
E2 (required if group is present)
E3 (required if group is present)
P1 (optional)
P2 (optional)
P3 (optional)
S1 (optional)

E1  <--- error is here
E2
E3

Trailer (required)

E1 到 P3 的组应该是有序的并且可以重复。

我尝试过的:

我创建了一个并将 E1 到 P3 放入其中。 我设置序列上的最小发生次数 = 0,最大发生次数 = 无界。

我在所需的记录 E1、E2、E3 上设置最小发生次数 = 1,最大发生次数 = 1。 我在可选记录 P1、P2、P3 上设置最小发生次数 = 0,最大发生次数 = 1。

问题

第二次出现该组总是会导致实例验证失败 (Visual Studio 2010)。错误消息没有帮助:“发现意外数据”

我不清楚每条记录上“出现最小值”和“出现组最小值”之间的区别。 “最小发生次数”是序列中局部的还是全局的? 如果我在 E1 记录上设置最大发生次数 = 1,我是每个文件获得一个还是每个序列获得一个? MSDN上的解释清晰如泥。

我尝试将值放入“group *”属性中,但仍然没有乐趣。

我哪里做错了?

谢谢。

编辑:

架构图片:

在此处输入图像描述

DPIC 是标头,Z1 是拖车。添加S1记录似乎会导致失败。 我查看了 P3 和 S1 定义,它们看起来是正确的。这是一个平面文件 从 MSVC 2010 向导生成的架构。

Good morning,

The problem:

I'm trying to create a schema for an input file. I can't get the correct combination of properties to get my test file to validate.

The input file:

The file consists of a required header, an optional repeatable group of records, and a required trailer. The file is a list of employees with information about each one.
The repeated records within the group should be presented in order. Some records in the group are optional and some are not. At most there should be one of each type of record within the repeated group.

like so:

header (required)

E1 (required if group is present)
E2 (required if group is present)
E3 (required if group is present)
P1 (optional)
P2 (optional)
P3 (optional)
S1 (optional)

E1  <--- error is here
E2
E3

Trailer (required)

The group, E1 through P3, should be in order and can be repeated.

What I've tried:

I created a <sequence> and placed E1 through P3 within it.
I set min occurs = 0, max occurs = unbounded on the sequence.

I set min occurs = 1, max occurs = 1 on the required records E1, E2, E3.
I set min occurs = 0, max occurs = 1 on the optional records P1, P2, P3.

The problem:

The second occurrence of the group always causes an instance validation fail (Visual Studio 2010). The error message is not helpful: "Unexpected data found"

I'm not clear on the difference between "min occurs" and "group min occurs" on each record.
Is "min occurs" local within the sequence or global?
If I set max occurs = 1 on the E1 record do I get one per file or one per sequence?
The explanation on MSDN is clear as mud.

I tried putting the values in the "group *" properties but still no joy.

Where did I go wrong?

Thanks.

Edit:

A picture of the schema:

enter image description here

DPIC is the header, Z1 the trailer. Adding the S1 record seems to cause the failure.
I've looked over the P3 and S1 definitions and they look correct. This is a flat file
schema generated from the MSVC 2010 wizard.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你与昨日 2024-12-22 21:16:31

该架构不会验证输入文件,但仍会生成有效的输出文件。我将考虑将其关闭。感谢您的帮助

The schema does not validate the input file but still generates valid output files. I'm going to consider it closed. Thanks for your help

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文