元素或属性与 QName 生成不匹配 [英] Element or attribute do not match QName production

查看:54
本文介绍了元素或属性与 QName 生成不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 XML 编辑器扁平化"的架构.在我展平它后,我收到一个验证错误.我能做些什么来修复它?

I have a schema that i have "flattened" using XML Editor. After i flatten it i get a validation error. What can i do to fix it?

错误信息:

F [Xerces] 元素或属性不匹配 QName 制作:QName::=(NCName':')?NCName.

F [Xerces] Element or attribute do not match QName production: QName::=(NCName':')?NCName.

代码:

<xs:import namespace="http://www.opengis.net/gml"
    schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"
    xmlns:="http://www.opengis.net/gml/3.1.1" />
<xs:annotation xmlns:="http://www.opengis.net/sps/1.0">
    <xs:documentation>
        <copyright>                 SPS is an OGC Standard.                 Copyright (c)
            2007,2010 Open Geospatial Consortium, Inc. All Rights Reserved.                 To
            obtain additional rights of use, visit http://www.opengeospatial.org/legal/ .
        </copyright>
    </xs:documentation>
</xs:annotation>

这是一个屏幕截图,可以更好地说明我的错误:

Here's a screenshot that might better illustrate my error:

以某种方式去除冒号.究竟是什么这种扁平化"应该做什么?

Remove the colon somehow. What exactly does this "flattening" supposed to do?

扁平化 xsd 需要 xsd 很多的包含并将其全部放入一个文件中(不包含任何包含).

The flattening of the xsd takes an xsd with a lot of includes and puts it all into one file (without any includes).

推荐答案

xmlns:= 是无效语法.冒号是多余的或冒号后的命名空间前缀丢失.正确的语法是 xmlns="http://some.uri"xmlns:something="http://some.uri"

xmlns:= is invalid syntax. The colon is extra or the namespace prefix after the colon is missing. Correct syntax would be xmlns="http://some.uri" or xmlns:something="http://some.uri"

请注意,您有 2 个不需要的冒号:第一个在第 1002 行(红色箭头指向的地方),第二个在第 1003 行.这暗示可能存在甚至更多.

Note that you have 2 un-needed colons: first one on line 1002 (where the red arrow is pointing) and the second one is on the line 1003. This gives a hint that there might be even more of them.

QName"是指合格名称",NCName"是指非殖民化名称".非殖民化名称是不包含冒号字符 (:) 的 XML 名称.限定名称是非殖民化名称或以冒号分隔的两个非殖民化名称的组合.例如abc:defgh".冒号前的部分称为命名空间前缀,冒号后的部分称为本地名称.如果限定名称具有命名空间前缀,则该前缀必须绑定到具有前缀命名空间声明的命名空间 URI,例如 xmlns:abc="http://some.uri".

"QName" refers to "qualified name" and "NCName" refers to "non-colonized name". Non-colonized name is an XML name that doesn't contain a colon character (:). Qualified name is either a non-colonized name or combination of two non-colonized names separated with a colon. For example "abc:defgh". The part before the colon is called the namespace prefix and the part after the colon is called the local name. If a qualified name has a namespace prefix, then that prefix must be bound to a namespace-URI with a prefixed namespace declaration, for example xmlns:abc="http://some.uri".

这篇关于元素或属性与 QName 生成不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆