Xml 架构更改不起作用
我有一个名为a.rnc的模式,看起来像这样Xml 架构更改不起作用,xml,relaxng,Xml,Relaxng,我有一个名为a.rnc的模式,看起来像这样 default namespace = "urn:schemas-foo:bar" include "b.rnc" { start = A Links = element link { HidableLinkType }* } A = element Bat { AType } AType = SavedResourceType & Boundary?
default namespace = "urn:schemas-foo:bar"
include "b.rnc" {
start = A
Links = element link { HidableLinkType }*
}
A = element Bat { AType }
AType = SavedResourceType
& Boundary?
& Baz*
& element link { HidableLinkType }*
default namespace = "urn:schemas-foo:bar"
include "c.rnc"
include "d.rnc" {
start = Baz
}
Baz = element Z { BType }
BType = SavedResourceType
SavedResourceType &= Boundary?
& element panel-id { text }?
& Annotations?
Boundary = element boundary { "a" | "b" | Bounds }
Bounds = (
attribute from { xsd:date },
attribute to { xsd:date }
)
我有另一个叫做b.rnc的模式,以前看起来像这样
default namespace = "urn:schemas-foo:bar"
include "b.rnc" {
start = A
Links = element link { HidableLinkType }*
}
A = element Bat { AType }
AType = SavedResourceType
& Boundary?
& Baz*
& element link { HidableLinkType }*
default namespace = "urn:schemas-foo:bar"
include "c.rnc"
include "d.rnc" {
start = Baz
}
Baz = element Z { BType }
BType = SavedResourceType
SavedResourceType &= Boundary?
& element panel-id { text }?
& Annotations?
Boundary = element boundary { "a" | "b" | Bounds }
Bounds = (
attribute from { xsd:date },
attribute to { xsd:date }
)
但我更改了最后一点,因为xml结构已更改为
Boundary = element boundary { Bounds }
Bounds = (
attribute from { "a" | "b" | xsd:date },
attribute to { "a" | "b" | xsd:date }
)
我已经生成了rng文件,但是当运行针对这些模式进行验证的代码位时,我得到了以下错误
POST <url> 400 (Invalid attribute value is found. Value = 'a' Expected elements are: . line 7, column 13 Validated using schema: b.rng)
我在做些傻事吗?简化模式
start = element boundary { Bounds }
Bounds = (
attribute from { "published" | "global" | xsd:date },
attribute to { "published" | "global" | xsd:date }
)
很好地验证此XML代码段:
<?xml version="1.0" encoding="UTF-8"?>
<boundary from="published" to="published"/>
从JSON转换后,您是否可以截取XML,看看它是否正常?您是否连接到本地机器,该机器上有更新的架构,或者您是否连接到远程服务器,该服务器在发出验证请求时已过期
在修改任何代码之前,应该停止粘贴正在处理的代码。那只是懒惰。你可能会因此被解雇。如果不知道正在验证的XML是什么样子,这可能很难排除故障。你能告诉我们是什么解决了这个问题吗?