XML schema 谁是根元素啊
下面是一个.xsd文档
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"    
targetNamespace="http://www.w3school.com"     
xmlns="http://www.w3school.com"     
elementFormDefault="qualified">
   <xsd:element name ="刘德华" type ="xsd:string"></xsd:element>
   <xsd:element name ="苍老师" type ="xsd:string"></xsd:element>
</xsd:schema>
下面是引用上面xsd文档的XML文档
<?xml version="1.0" encoding="utf-8"?>
<苍老师 xmlns="http://www.w3school.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3school.com D:\我的程序\窗体\XMLSchema1.xsd">
    我爱你
</苍老师>
我的2个问题:
1:第一个xsd文档,规定XML文档到底哪个是根元素啊?刘德华、苍老师
2:XML文档引用xsd文档,只有苍老师元素,没有刘德华元素,怎么不报错呢?
------解决方案-------------------- 
http://www.cnblogs.com/tomin/archive/2009/04/02/1427742.html
------解决方案-------------------- 
我是这样理解的,不知道正不正确.
1.<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"  
targetNamespace="http://www.w3school.com"  
xmlns="http://www.w3school.com"  
elementFormDefault="qualified">是根元素,
  <xsd:element name ="刘德华" type ="xsd:string"></xsd:element>是<xsd:schema 的子元素
2.<苍老师 xmlns="http://www.w3school.com"引用进入的就是成它的子元素了
------解决方案-------------------- 
探讨  引用: 我是这样理解的,不知道正不正确. 1.<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3school.com" xmlns="http://www.w3school.com" elementFormDefault="qualified"…… 
------解决方案-------------------- 
好像很多人都没理解lz在问什么,不是schema的根元素,是xml的根元素
这问题有点意思,之前没考虑过,搜了一下,说是两个都可以作为根元素
http://www.herongyang.com/XML-Schema/Language-Basic-Declare-Root-Element.html
引用  By the way, there is nothing wrong to declare multiple root elements in a single schema document. The following example, word_term.xsd, declares two root elements, "word" and "term": <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">  <xs:element name="word"/>  <xs:element name="term"/> </xs:schema> Any XML document with "word" or "term" as the root element is considered as conforming to word_term.xsd. 
------解决方案-------------------- 
学习了!
好像你未指定根元素呀!