3
這是my.xsd
模式:我的XML模式有什麼問題?
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'
xmlns:p='some-namespace' targetNamespace='some-namespace'>
<xs:element name='root' type='p:main'/>
<xs:complexType name='main'>
<xs:sequence>
<xs:element name='alpha' type='xs:string' />
</xs:sequence>
</xs:complexType>
</xs:schema>
這是我驗證針對它的XML文檔:
<root xmlns='some-namespace'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='some-namespace my.xsd'>
<alpha>xxx</alpha>
</root>
SAX解析器說:
"Invalid content was found starting with element 'alpha'. One of
'{alpha}' is expected."
有什麼不對?
命名空間...... – bmargulies 2012-01-18 18:47:20