日期:2014-05-18  浏览次数:20739 次

XML,看不懂
<xs:element name ="Book">  
  <xs:complexType >  
  <xs:sequence >  
  <xs:element name ="title" type ="xs:string"></xs:element>  
  </xs:sequence>  
  </xs:complexType>  
</xs:element>

上面的Schema代码,定义了一个元素,我想问:
这个元素的name属性值是"Book"还是"title",是怎么个意思啊,嵌套元素吗?
complexType和sequence是对哪个起作用的啊?

------解决方案--------------------
omplexType和sequence是对哪个起作用的啊?
<xs:element name ="title" type ="xs:string"></xs:element>

name和type名称都可以随便取
------解决方案--------------------
XML code

<xs:element name ="Book">   
  <xs:complexType >   
  <xs:sequence >   
  <xs:element name ="title" type ="xs:string"></xs:element>   
  </xs:sequence>   
  </xs:complexType>   
</xs:element>

<!--xml元素架构:表示根元素为Book,并且Book有属性 name,并且属性:name的类型为String类型-->

<!--xml如下-->
<Book name="C#开发"></Book>
<Book name="C#4.0入门到精通"></Book>
<Book name="JS开发"></Book>

------解决方案--------------------
不好意思
应该是这个样子的
book不是根
根元素应该你没发上来

XML code
<?xml version="1.0" encoding="utf-8" ?>
<root>
<Book name="C#开发"></Book>
<Book name="C#4.0入门到精通"></Book>
<Book name="JS开发"></Book>
</root>

------解决方案--------------------
好久不弄了,记不太清楚了,要是错了,大家不要见笑。

应该在book 下边还有一个子元素 title,type ="xs:string" 应该是定义 title 内容的。
<Book name="JS开发"> <title name = "很好的JS开发哦"> </title> </Book>
------解决方案--------------------
http://www.w3school.com.cn/schema/el_sequence.asp
------解决方案--------------------
http://www.w3school.com.cn/schema/el_complextype.asp
------解决方案--------------------
不好意思
再次弄错了
 
XML code


<?xml version="1.0" encoding="utf-8" ?>
<root>
<Book title="C#开发"></Book>
<Book title="C#4.0入门到精通"></Book>
<Book title="JS开发"></Book>
</root>

------解决方案--------------------
格式是这样的。
<xs:element name ="Book">
<xs:complexType >
<xs:sequence >
<xs:element name ="title" type ="xs:string"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
=========================================
<xs:complexType > 表明Book元素是个复合类型。
<xs:sequence > 复合类型的组织方式是顺序。
<xs:element name ="title" type ="xs:string"></xs:element> 复合类型包含一个title元素。

结果如下:

XML code

<Book>
    <title></title>
</Book>

------解决方案--------------------
探讨
格式是这样的。
<xs:element name ="Book">
<xs:complexType >
<xs:sequence >
<xs:element name ="title" type ="xs:string"></xs:element>
</xs:sequence>
</xs:complexType>