2012-08-31 5 views
0

이 XML 파일을 마샬링하여 생성 한 다음 해당 스키마의 유효성을 검사하여 언 마샬하려고합니다.XSD에 대한 XML이 유효하지 않습니다.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<ProjectConfiguration xmlns="http://ereg.egov.bg/segment/0009-900001"> 
    <CreationTime>2012-08-30T15:32:06.712+03:00</CreationTime> 
    <Applications> 
     <Application> 
      <Version>1.0</Version> 
      <CreationTime>2012-08-30T15:32:06.712+03:00</CreationTime> 
      <FileName>ROSAppl-37</FileName> 
     </Application> 
    </Applications> 
</ProjectConfiguration> 

유효한 XML 전년도이 스키마 : CVC-elt.1.a : 요소 'ProjectConfiguration'의 선언을 찾을 수 없습니다이 오류가

<?xml version="1.0"?> 
<xsd:schema 
targetNamespace="http://www.bulsi.bg/egov/ProjectConfiguration" 
xmlns="http://www.bulsi.bg/egov/ProjectConfiguration" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
> 

<xsd:element name="ProjectConfiguration" type="ProjectConfigurationType" /> 

<xsd:complexType name="ProjectConfigurationType"> 
    <xsd:annotation> 
     <xsd:documentation xml:lang="bg">Конфигурация на проекта</xsd:documentation> 
    </xsd:annotation> 

    <xsd:sequence> 
     <xsd:element name="CreationTime" type="xsd:dateTime"> 
      <xsd:annotation> 
       <xsd:documentation xml:lang="bg">Време на създаване</xsd:documentation> 
      </xsd:annotation> 
     </xsd:element> 

     <xsd:element name="Applications" minOccurs="1" maxOccurs="1"> 
      <xsd:annotation> 
       <xsd:documentation xml:lang="bg">Заявления</xsd:documentation> 
      </xsd:annotation> 
      <xsd:complexType> 
       <xsd:sequence> 
        <xsd:element name="Application" type="ApplicationType" minOccurs="1" maxOccurs="unbounded" /> 
       </xsd:sequence> 
      </xsd:complexType> 
     </xsd:element>      
    </xsd:sequence> 
</xsd:complexType> 

<xsd:complexType name="ApplicationType" > 
    <xsd:annotation> 
     <xsd:documentation xml:lang="bg">Данни за заявление за вписване</xsd:documentation> 
    </xsd:annotation> 

    <xsd:sequence> 
     <xsd:element name="Version" type="xsd:string"> 
      <xsd:annotation> 
       <xsd:documentation xml:lang="bg">Версия на заявлението</xsd:documentation> 
      </xsd:annotation> 
     </xsd:element> 

     <xsd:element name="CreationTime" type="xsd:dateTime"> 
      <xsd:annotation> 
       <xsd:documentation xml:lang="bg">Време на създаване</xsd:documentation> 
      </xsd:annotation> 
     </xsd:element> 

     <xsd:element name="FileName" type="xsd:string"> 
      <xsd:annotation> 
       <xsd:documentation xml:lang="bg">Име на файл, в който е заявлението. Връзка между конфигурационни параметри и заявлението като файл</xsd:documentation> 
      </xsd:annotation> 
     </xsd:element> 
    </xsd:sequence> 
</xsd:complexType> 

</xsd:schema> 

왜이 XML이다 .. 선 '2', 열 '71'.

답변

1
  • 귀하의 XML 인스턴스 : xmlns="http://ereg.egov.bg/segment/0009-900001"
  • 으로 XML 스키마 : targetNamespace="http://www.bulsi.bg/egov/ProjectConfiguration"

이 URI를 일치해야합니다.

그렇지 않으면 XML 문서의 <ProjectConfiguration> 요소가 스키마에 정의되지 않은 http://ereg.egov.bg/segment/0009-900001 네임 스페이스에 속한 것으로 간주됩니다.

+0

이제는 ProjectConfiguration 문제가 해결되었지만 이제는이 오류가 발생합니다. Cvc-complex-type.2.4.a : 'CreationTime'요소로 시작하는 잘못된 콘텐츠가 발견되었습니다. '{CreationTime}'중 하나가 예상됩니다 .. 줄 '3', 열 '19'. – dsthetics

+0

신경 쓰지 마라. – dsthetics

관련 문제