我遇到了我的XSD問題,當我將代碼輸入到XSD驗證程序時出現此錯誤: 「no-xmlns:屬性聲明的{名稱}不能匹配'xmlns 」「。XMLNS屬性聲明
這裏是我的XML:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Test">
<xs:complexType>
<xs:attribute name="xmlns" type="xs:string" use="required"/>
<xs:sequence>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="Screens" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Screen" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="package" type="xs:string" use="required"/>
<xs:attribute name="class" type="xs:string" use="required"/>
<xs:sequence>
<xs:element name="ScreenData" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="step" type="xs:int" use="required"/>
<xs:attribute name="description" type="xs:string" use="required"/>
<xs:sequence>
<xs:element name="element" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="type" type="xs:string" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="DBSession" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="use_test.properties" type="xs:boolean" use="required"/>
<xs:attribute name="use_dbserver" type="xs:string" use="required"/>
<xs:attribute name="use_db" type="xs:string" use="required"/>
<xs:sequence>
<xs:element name="login" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:attribute name="server" type="xs:string" use="required"/>
<xs:attribute name="database" type="xs:string" use="required"/>
<xs:attribute name="username" type="xs:string" use="required"/>
<xs:attribute name="password" type="xs:string" use="required"/>
<xs:sequence>
<xs:element name="Queries" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:attribute name="query" type="xs:string" use="required"/>
<xs:attribute name="expectedResults" type="xs:string" use="required"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="CLISession" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="use_test.properties" type="xs:boolean" use="required"/>
<xs:sequence>
<xs:element name="login" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="host" type="xs:string" use="required"/>
<xs:attribute name="password" type="xs:string" use="required"/>
<xs:attribute name="username" type="xs:string" use="required"/>
<xs:sequence>
<xs:element name="Commands" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="Command" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="exe" type="xs:string" use="required"/>
<xs:attribute name="args" type="xs:string" use="required"/>
<xs:attribute name="wait" type="xs:int" use="required"/>
<xs:attribute name="expectedOutput" type="xs:string" use="required"/>
<xs:attribute name="toVariable" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
我假設它是值得做的代碼架構中的第二條線。此行與我的XML文檔中的以下行相關:
<Test xmlns="http://MyURL">
解釋,我相信它是說你的第一個屬性的名稱不能是的xmlns – thatidiotguy 2012-08-16 20:59:29