2012-09-04 201 views
2

得到此錯誤:SAX解析器異常

SAX解析器異常。

cvc-elt.1:找不到元素'xs:schema'的聲明。

與此XSD:

<?xml version="1.0" encoding="UTF-8"?> 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"targetNamespace="http://nrg.wustl.edu/tx" xmlns:tx="http://nrg.wustl.edu/tx" xmlns:xnat="http://nrg.wustl.edu/xnat" xmlns:xdat="http://cnl.wustl.edu/xdat" elementFormDefault="qualified" attributeFormDefault="unqualified"> 
    <xs:import namespace="http://nrg.wustl.edu/xnat" schemaLocation="../xnat/xnat.xsd"/> 
    <xs:import namespace="http://cnl.wustl.edu/xdat" schemaLocation="../xdat/xdat.xsd"/> 
    <xs:element name="MedicationTreatmentList" type="tx:medTreatmentList" /> 
    <xs:element name="TreatmentList" type="tx:treatmentList" /> 
    <xs:element name="ChemotherapyTreatment" type="tx:chemotherapyTreatment" /> 
    <xs:element name="RadiationTreatment" type="tx:radiationTreatment" /> 
    <xs:complexType name="medTreatment"> 
     <xs:sequence> 
      <xs:element name="code" type="xs:string" minOccurs="0" /> 
      <xs:element name="codeType" type="xs:string" minOccurs="0" /> 
      <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1"> 
       <xs:annotation> 
        <xs:appinfo> 
         <xdat:field uniqueComposite="NAME_DATE_FK"/> 
        </xs:appinfo> 
       </xs:annotation> 
      </xs:element> 
      <xs:element name="status" type="xs:string" minOccurs="0" /> 
      <xs:element name="doseAmount" type="xs:float" minOccurs="0" /> 
      <xs:element name="doseUnit" type="xs:string" minOccurs="0" /> 
      <xs:element name="doseSchedule" type="xs:string" minOccurs="0" /> 
      <xs:element name="route" type="xs:string" minOccurs="0" /> 
      <xs:element name="indication" type="xs:string" minOccurs="0" /> 
      <xs:element name="startDate" type="xs:date" minOccurs="0" maxOccurs="1"> 
       <xs:annotation> 
        <xs:appinfo> 
         <xdat:field uniqueComposite="NAME_DATE_FK"/> 
        </xs:appinfo> 
       </xs:annotation> 
      </xs:element> 
      <xs:element name="startDateDayNotReported" type="xs:boolean" minOccurs="0" /> 
      <xs:element name="startDateMonthNotReported" type="xs:boolean" minOccurs="0" /> 
      <xs:element name="startDateYearNotReported" type="xs:boolean" minOccurs="0" /> 
      <xs:element name="endDate" type="xs:date" minOccurs="0" /> 
      <xs:element name="endDateDayNotReported" type="xs:boolean" minOccurs="0" /> 
      <xs:element name="endDateMonthNotReported" type="xs:boolean" minOccurs="0" /> 
      <xs:element name="endDateYearNotReported" type="xs:boolean" minOccurs="0" /> 
      <xs:element name="clinicalTrialName" type="xs:string" minOccurs="0" /> 
      <xs:element name="clinicalTrialArm" type="xs:string" minOccurs="0" /> 
      <xs:element name="treatmentNotes" minOccurs="0"> 
       <xs:simpleType> 
        <xs:restriction base="xs:string"> 
         <xs:maxLength value="1000" /> 
        </xs:restriction> 
       </xs:simpleType> 
      </xs:element> 
     </xs:sequence> 
    </xs:complexType> 
    <xs:complexType name="medTreatmentList"> 
     <xs:complexContent> 
      <xs:extension base="xnat:subjectAssessorData"> 
       <xs:sequence> 
        <xs:element name="medTreatments" minOccurs="0"> 
         <xs:complexType> 
          <xs:sequence> 
           <xs:element name="medTreatment" type="medTreatment" minOccurs="0" maxOccurs="unbounded"> 
            <xs:annotation> 
             <xs:appinfo> 
              <xdat:field> 
               <xdat:relation uniqueComposite="NAME_DATE_FK" relationType="single"/> 
              </xdat:field> 
             </xs:appinfo> 
            </xs:annotation> 
           </xs:element> 
          </xs:sequence> 
         </xs:complexType> 
        </xs:element> 
       </xs:sequence> 
      </xs:extension> 
     </xs:complexContent> 
    </xs:complexType> 
    <xs:complexType name="treatment"> 
     <xs:sequence> 
      <xs:element name="code" type="xs:string" minOccurs="0" /> 
      <xs:element name="codeType" type="xs:string" minOccurs="0" /> 
      <xs:element name="name" type="xs:string" minOccurs="0" /> 
      <xs:element name="status" type="xs:string" minOccurs="0" /> 
      <xs:element name="doseAmount" type="xs:float" minOccurs="0" /> 
      <xs:element name="doseUnit" type="xs:string" minOccurs="0" /> 
      <xs:element name="doseSchedule" type="xs:string" minOccurs="0" /> 
      <xs:element name="route" type="xs:string" minOccurs="0" /> 
      <xs:element name="indication" type="xs:string" minOccurs="0" /> 
      <xs:element name="startDate" type="xs:date" minOccurs="0" /> 
      <xs:element name="startDateDayNotReported" type="xs:boolean" minOccurs="0" /> 
      <xs:element name="startDateMonthNotReported" type="xs:boolean" minOccurs="0" /> 
      <xs:element name="startDateYearNotReported" type="xs:boolean" minOccurs="0" /> 
      <xs:element name="endDate" type="xs:date" minOccurs="0" /> 
      <xs:element name="endDateDayNotReported" type="xs:boolean" minOccurs="0" /> 
      <xs:element name="endDateMonthNotReported" type="xs:boolean" minOccurs="0" /> 
      <xs:element name="endDateYearNotReported" type="xs:boolean" minOccurs="0" /> 
      <xs:element name="clinicalTrialName" type="xs:string" minOccurs="0" /> 
      <xs:element name="clinicalTrialArm" type="xs:string" minOccurs="0" /> 
      <xs:element name="treatmentNotes" minOccurs="0"> 
       <xs:simpleType> 
        <xs:restriction base="xs:string"> 
         <xs:maxLength value="1000" /> 
        </xs:restriction> 
       </xs:simpleType> 
      </xs:element> 
     </xs:sequence> 
    </xs:complexType> 
    <xs:complexType name="treatmentList"> 
     <xs:complexContent> 
      <xs:extension base="xnat:subjectAssessorData"> 
       <xs:sequence> 
        <xs:element name="treatments" minOccurs="0"> 
         <xs:complexType> 
          <xs:sequence> 
           <xs:element name="treatment" type="tx:treatment" minOccurs="0" maxOccurs="unbounded"> 
            <xs:annotation> 
             <xs:appinfo> 
              <xdat:field> 
               <xdat:relation relationType="multi" relationName="tx_treatmentList_treatment"/> 
              </xdat:field> 
             </xs:appinfo> 
            </xs:annotation> 
           </xs:element> 
          </xs:sequence> 
         </xs:complexType> 
        </xs:element> 
       </xs:sequence> 
      </xs:extension> 
     </xs:complexContent> 
    </xs:complexType> 
    <xs:complexType name="baseTreatment"> 
     <xs:complexContent> 
      <xs:extension base="xnat:subjectAssessorData"> 
       <xs:sequence> 
        <xs:element name="type" type="xs:string" minOccurs="0" /> 
        <xs:element name="unit" type="xs:string" minOccurs="0" /> 
        <xs:element name="dose" type="xs:float" minOccurs="0" /> 
        <xs:element name="timing" type="xs:string" minOccurs="0" /> 
        <xs:element name="startDate" type="xs:date" minOccurs="0" /> 
        <xs:element name="startDateDayNotReported" type="xs:boolean" minOccurs="0" /> 
        <xs:element name="startDateMonthNotReported" type="xs:boolean" minOccurs="0" /> 
        <xs:element name="startDateYearNotReported" type="xs:boolean" minOccurs="0" /> 
        <xs:element name="endDate" type="xs:date" minOccurs="0" /> 
        <xs:element name="endDateDayNotReported" type="xs:boolean" minOccurs="0" /> 
        <xs:element name="endDateMonthNotReported" type="xs:boolean" minOccurs="0" /> 
        <xs:element name="endDateYearNotReported" type="xs:boolean" minOccurs="0" /> 
        <xs:element name="completed" type="xs:boolean" minOccurs="0" /> 
        <xs:element name="incompleteReason" type="xs:string" minOccurs="0" /> 
        <xs:element name="incompleteExtent" type="xs:string" minOccurs="0" /> 
        <xs:element name="clinicalTrialName" type="xs:string" minOccurs="0" /> 
        <xs:element name="clinicalTrialArm" type="xs:string" minOccurs="0" /> 
        <xs:element name="completedNotes" minOccurs="0"> 
         <xs:simpleType> 
          <xs:restriction base="xs:string"> 
           <xs:maxLength value="1000" /> 
          </xs:restriction> 
         </xs:simpleType> 
        </xs:element> 
       </xs:sequence> 
      </xs:extension> 
     </xs:complexContent> 
    </xs:complexType> 
    <xs:complexType name="chemotherapyTreatment"> 
     <xs:complexContent> 
      <xs:extension base="tx:baseTreatment" /> 
     </xs:complexContent> 
    </xs:complexType> 
    <xs:complexType name="radiationTreatment"> 
     <xs:complexContent> 
      <xs:extension base="tx:baseTreatment" /> 
     </xs:complexContent> 
    </xs:complexType> 
</xs:schema> 

聲明看起來是從我所看到的是正確的。我經歷了這麼多次,不能提出任何事情。有什麼想法嗎?

+0

您沒有提供很多細節爲你究竟_doing_,但有可能你使用的解析器這是不具有感知名稱空間解析? – jtahlborn

+0

SAX解析器可識別名稱空間 – rpfujiw

+0

模式看起來很好。你可以發佈/檢查'xnat.xsd'和'xdat.xsd'的相關部分嗎? –

回答

2

您的聲明無效。您在targetNameSpace之前缺少一個空格。在間隔

+0

增加了空間,結果相同 – rpfujiw

0

問題應該是

<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://nrg.wustl.edu/tx" xmlns:tx="http://nrg.wustl.edu/tx" xmlns:xnat="http://nrg.wustl.edu/xnat" xmlns:xdat="http://cnl.wustl.edu/xdat" elementFormDefault="qualified" attributeFormDefault="unqualified">