Xsd xmpp:XML模式

Xsd xmpp:XML模式,xsd,xmpp,Xsd,Xmpp,我是XML模式和XMPP消息协议的初学者。是否有任何明确的方法来理解下面的XML模式。每个标记的含义是什么?有多少种类型的标记?读写它们的指定方式是什么: <?xml version='1.0' encoding='UTF-8'?> <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='http://jabber.org/protocol/address' xml

我是XML模式和XMPP消息协议的初学者。是否有任何明确的方法来理解下面的XML模式。每个标记的含义是什么?有多少种类型的标记?读写它们的指定方式是什么:

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='http://jabber.org/protocol/address'
    xmlns='http://jabber.org/protocol/address'
    elementFormDefault='qualified'>

  <xs:annotation>
    <xs:documentation>
      The protocol documented by this schema is defined in
      XEP-0033: http://www.xmpp.org/extensions/xep-0033.html
    </xs:documentation>
  </xs:annotation>


  <xs:element name='address'>
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base='empty'>
            <xs:simpleType>
              <xs:restriction base='xs:NCName'>
                <xs:enumeration value='bcc'/>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name='uri' use='optional' type='xs:string'/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name='empty'>
    <xs:restriction base='xs:string'>
      <xs:enumeration value=''/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>

此模式记录的协议在中定义
XEP-0033:http://www.xmpp.org/extensions/xep-0033.html

XSD是一种复杂的语言,在几段文字中无法给出充分的解释。阅读W3CXMLSchema入门(XMLSchema第0部分)可能是一个良好的开端;更妙的是,去拿埃里克·范德维利斯的书,读开头几章

您给我们的片段格式不正确:它在第26行包含一个不匹配的
结束标记。如果我们添加缺少的行:


在第21行,模式为一个
地址
元素定义规则,该元素有两个属性,但没有内容:一个强制的
类型
属性,其唯一允许的值是
bcc
,一个可选的
uri
属性,其值是任何字符串。定义一个没有内容的元素是一种相当奇怪的方式:它实际上是将它定义为一个有内容的元素,其中内容必须是空字符串。也许模式设计者有这样的理由,但这并不明显。

正如其文档中所说的,转到,您将获得详细信息。请注意,XMPP模式不是“规范的”。这意味着规范的文本是协议的真实定义,模式仅用于指导/示例。