以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 XQuery/XLink/XPointer/ 』  (http://bbs.xml.org.cn/list.asp?boardid=14)
----  xpath 的弱问题  (http://bbs.xml.org.cn/dispbbs.asp?boardid=14&rootid=&id=24499)


--  作者:lucent_liuyuan
--  发布时间:11/21/2005 12:33:00 PM

--  xpath 的弱问题
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="DB1" targetNamespace="http://tempuri.org/DB1.xsd" elementFormDefault="qualified"
 xmlns="http://tempuri.org/DB1.xsd" xmlns:mstns="http://tempuri.org/DB1.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="DB">
 <xs:complexType>
 <xs:sequence>
  <xs:element name="Tables">
   <xs:complexType>
   <xs:sequence>
                                                      <xs:element name="Table">
    <xs:complexType>
    <xs:sequence>
     <xs:element name="item" maxOccurs="unbounded" minOccurs="0" type="xs:anyType">
     </xs:element>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string" />
    <xs:attribute name="template" type="xs:string" />
    <xs:attribute name="key" type="xs:string" />
    <xs:attribute name="number" type="xs:string" />
    </xs:complexType>
   </xs:element>
   </xs:sequence>
   </xs:complexType>
   </xs:element>
   </xs:sequence>
  </xs:complexType>
 </xs:element>
</xs:schema>


xml文件::
<?xml version="1.0" encoding="UTF-8"?>
<DB xmlns="http://tempuri.org/DB1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://tempuri.org/DB1.xsd
    DB1.xsd">
    <Tables>
        <Table name="t1" template="ID,name" key="ID" number="1">
            <item>
                <ID>1</ID>
                <name>liuyaun</name>
            </item>
        </Table>
    </Tables>
</DB>

使用xpath:::/DB/Tables/Table/item,时不能得到任何结果。 为什么呢??


--  作者:lucent_liuyuan
--  发布时间:11/21/2005 12:49:00 PM

--  
如果把xml文件中 声明使用的xsd文件那段去掉,改成<DB>,就可以。怀疑是xsd文件的问题。
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
46.875ms