错误“元素不能包含空格.内容模型为空."吝啬的? [英] What does the error "The element cannot contain white space. Content model is empty." mean?

查看:48
本文介绍了错误“元素不能包含空格.内容模型为空."吝啬的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为一个简单的 xml 组合一个 xml 模式(有关 xml 和模式,请参见下文).但是我不断收到有关节节点的以下错误:元素不能包含空格.内容模型为空.".浏览网络我找不到任何关于它意味着什么的简明解释,所以我可以修复它.有人可以帮忙吗?

I'm putting together an xml schema for a simple xml (see bellow for both xml and schema). But I keep getting the following error with regards to the section node: "The element cannot contain white space. Content model is empty." . Browsing the net I could not find any concise explanation as to what it means so I can fix it. Can anyone help?

感谢大家为架构提供帮助.我认为简要描述什么是内容模型以及为什么此处为空会有所帮助.

thanks for all for offering help with the schema. I think it would help to have a concise description of what content model is and why it is empty here.

XML:

<config>
   <section name="facets">
      <facet type="format" label="Format" max="4"/>
      <facet type="language" max="4"/>
      <facet type="pubdate" max="6" submax="8"/> 
      <facet type="ice_topic" label="Fiction: Topic"/>
   </section>
</config>

架构:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <xs:element name="config">
      <xs:complexType>
         <xs:sequence>
            <xs:element name="section" type="sectionBase"/>
         </xs:sequence>
      </xs:complexType>
   </xs:element>
   <xs:complexType name="sectionBase">
      <xs:attribute name="name" type="xs:ID"/>
   </xs:complexType>


   <xs:complexType name="sectionFacets" >
      <xs:complexContent>
         <xs:extension base="sectionBase">
            <xs:sequence>
               <xs:element name="facet" type="sectionFacetsBaseFacet"/>
            </xs:sequence>
         </xs:extension>
      </xs:complexContent>
   </xs:complexType>
   <xs:complexType name="sectionFacetsBaseFacet">
      <xs:attribute name="label" type="xs:ID"/>
      <xs:attribute name="max" type="xs:positiveInteger"/>
   </xs:complexType>
   <xs:complexType name="sectionFacetsFormat">
      <xs:complexContent>
         <xs:extension base="sectionFacetsBaseFacet"/>
      </xs:complexContent>
   </xs:complexType>
   <xs:complexType name="sectionFacetsPubdate">
      <xs:complexContent>
         <xs:extension base="sectionFacetsBaseFacet">
            <xs:attribute name="submax" type="xs:positiveInteger"/>
         </xs:extension>
      </xs:complexContent>

   </xs:complexType>
</xs:schema>

推荐答案

facet 的 label 属性设置为 xs:ID 并且不允许空格.您可能想改用 xs:string.

The label attribute of facet is set to xs:ID and this doesn't allow spaces. You might want to use xs:string instead.

这篇关于错误“元素不能包含空格.内容模型为空."吝啬的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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