Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 将元素限制为URL_Xml_Xsd_Atom Feed - Fatal编程技术网

Xml 将元素限制为URL

Xml 将元素限制为URL,xml,xsd,atom-feed,Xml,Xsd,Atom Feed,我有这个现有的XSD,它试图将一个值限制为一个URL,但它不起作用。id为空,文档仍然有效。当我输入任何文本时,它也会进行验证 <xsd:schema xmlns:atom="http://www.w3.org/2005/Atom" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3.org/2005/Atom" elementFormDefault="qualified" attribut

我有这个现有的XSD,它试图将一个值限制为一个URL,但它不起作用。id为空,文档仍然有效。当我输入任何文本时,它也会进行验证

<xsd:schema xmlns:atom="http://www.w3.org/2005/Atom" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3.org/2005/Atom" elementFormDefault="qualified" attributeFormDefault="unqualified">
...

<xsd:complexType name="feedType">
<xsd:choice minOccurs="3" maxOccurs="unbounded">
    <xsd:element name="id" type="atom:idType" minOccurs="1" maxOccurs="1"/>
...

<xsd:complexType name="idType">
    <xsd:annotation>
        <xsd:documentation>
            The Atom id construct is defined in section 4.2.6 of the format spec.
        </xsd:documentation>
    </xsd:annotation>
    <xsd:simpleContent>
        <xsd:extension base="xsd:anyURI">
            <xsd:attributeGroup ref="atom:commonAttributes"/>
        </xsd:extension>
    </xsd:simpleContent>
</xsd:complexType>

...
...
Atom id构造在格式规范的第4.2.6节中定义。

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.w3.org/2005/Atom ../XMLschemas/atom/2005/v/0.2/atom.xsd">
    <id>https://mydomain.com</id>

https://mydomain.com

anyURI
也允许相对URI,空字符串是有效的相对URI。您可以添加一个
模式
方面来要求“:/”以更接近您想要的内容

正如《圣经》所说

。。。在实践中,[anyURI]定义只施加了非常小的影响 最低合规处理方的义务


anyURI
还允许相对URI,空字符串是有效的相对URI。您可以添加一个
模式
方面来要求“:/”以更接近您想要的内容

正如《圣经》所说

。。。在实践中,[anyURI]定义只施加了非常小的影响 最低合规处理方的义务


请不要在标题前加上“XSD:”之类的前缀。这就是标签的作用。@John,是的,我不知道为什么要这样设置,但不管怎样,其他元素的限制都起作用了,问题出在id上。Petru,我正在使用Altova XMLSpy和Eclipse验证器。两者都有相同的结果。请不要在标题前加上“XSD:”之类的前缀。这就是标签的作用。@John,是的,我不知道为什么要这样设置,但不管怎样,其他元素的限制都起作用了,问题出在id上。Petru,我正在使用Altova XMLSpy和Eclipse验证器。两者都有相同的结果。