可能的 xml 反序列化错误

发布于 2024-09-28 00:11:02 字数 682 浏览 1 评论 0原文

我使用以下 xml 架构条目将某些 xml 反序列化到 xsd 生成的块中。

<xs:element name="Action">
   <xs:complexType>
   <xs:attribute name="src" type="xs:string" use="required" />
   <xs:attribute name="dst" type="xs:string" use="required" />
   <xs:attribute name="create" type="xs:string" use="optional" />
   <xs:attribute name="transform" type="xs:string" use="optional" />
  </xs:complexType>
</xs:element>

由于某种原因,当我拥有块时,

 <Action src="..."
         dst=".."
         create="yes"/>

它会正确返回 src 和目标属性,但它也会将创建和转换返回为“是”。变换属性应该为空。任何人都知道发生了什么事。我的小模式是不是有问题?

谢谢。 鲍勃.

谢谢。

I'm using the following xml schema entry to deserliaze some xml into an xsd generated block.

<xs:element name="Action">
   <xs:complexType>
   <xs:attribute name="src" type="xs:string" use="required" />
   <xs:attribute name="dst" type="xs:string" use="required" />
   <xs:attribute name="create" type="xs:string" use="optional" />
   <xs:attribute name="transform" type="xs:string" use="optional" />
  </xs:complexType>
</xs:element>

For some reason when I have the block

 <Action src="..."
         dst=".."
         create="yes"/>

Its returning the src and destination attributes correctly, but it's also returning create and transform as "yes". The transform attribute should be null. Anybody know whats going on. Is my wee schema wrong somehow?

Thanks.
Bob.

Thanks.

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

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

发布评论

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

评论(1

走过海棠暮 2024-10-05 00:11:02

我发现了问题。如果您没有唯一的元素名称,XML 解串器似乎会感到困惑。

I found the problem. It's seems that the xml deseraliser gets confused if you don't have unique element names.

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