XML 模式 怀疑! [英] XML schema Doubt!

查看:24
本文介绍了XML 模式 怀疑!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Could any one tell me how to do this? i need to change it into **xml schema**. The problem that I am facing is that I can't think of where to use elements and wehere to use attributes. 

如果我将这些视为属性:<xs:attribute name="name" type="xs:string" use="required"/>** - 我将使用此语句.但是,我在哪里利用事件.它只能用元素来完成?对吗?

IF i consider these as attributes:<xs:attribute name="name" type="xs:string" use="required"/>** - i will use this statement. But then where do I make use of occurances. It can only be done with elements?Right?

推荐答案

既然要NamePhone按顺序出现,就必须使用元素,因为顺序XML 文档中的属性(根据 XML 建议)并不重要.

Since you want Name and Phone to appear in order, you must use elements, since the order of attributes in XML documents is (per the XML recommendation) not significant.

您的架构应该看起来(大纲)类似于:

Your schema should look (in outline) something like:

<xs:element name="RetailerRequest">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="Name"
                  minOccurs="1"
                  maxOccurs="1"/>
      <xs:element ref="RetailerContact"
                  minOccurs="1"
                  maxOccurs="1"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

<xs:element name="RetailerContact">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="Name"
                  minOccurs="1"
                  maxOccurs="1"/>
      <xs:element name="Phone"
                  minOccurs="1"
                  maxOccurs="1"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

这篇关于XML 模式 怀疑!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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