2014-11-03 4 views
1

내가 xmllint가있는 XML 문서의 유효성을 검사하기 위해 [1] XML 스키마를 사용하고 있습니다 : metadata.xml에 선 55XML : 유형 정의는 존재하지 않는다

xmllint --noout --schema mets.xsd metadata.xml 

검증이

metadata.xml:55: element object: Schemas validity error : Element '{info:lc/xmlns/premis-v2}object', attribute '{http://www.w3.org/2001/XMLSchema-instance}type': The QName value '{info:lc/xmlns/premis-v2}file' of the xsi:type attribute does not resolve to a type definition. 
metadata.xml:55: element object: Schemas validity error : Element '{info:lc/xmlns/premis-v2}object': The type definition is absent. 

실패를 :

그러나 내가 원하는 것에 대한 예제 문서가 있습니다. 그것은 여기에있다 [2].

스키마에 대해이 예제의 유효성을 검사 할 때 동일한 유효성 검사 오류가 발생합니다.

louis-2-0.xml:80: element object: Schemas validity error : Element '{info:lc/xmlns/premis-v2}object', attribute '{http://www.w3.org/2001/XMLSchema-instance}type': The QName value '{info:lc/xmlns/premis-v2}file' of the xsi:type attribute does not resolve to a type definition. 
louis-2-0.xml:80: element object: Schemas validity error : Element '{info:lc/xmlns/premis-v2}object': The type definition is absent. 

무엇이 누락 되었습니까?

[1] http://www.loc.gov/standards/mets/mets.xsd

[2] http://www.loc.gov/standards/premis/louis-2-0.xml

답변

0

당신이 [2] 유효하기 때문에 오류 메시지가 해당 지역의 설정에 문제가 있음을 나타냅니다으로 참조 문서. 나는 xmllint가 55 행에서 인용 한 스키마 위치 힌트를 존중하지 않으므로 Premis 스키마를 가져 오지 않고 언급 된 유형을 찾지 못하고 있다고 생각합니다.

테스트하려면 사용하려는 모든 것을 가져 와서 유효성을 검사하는 간단한 스키마 문서를 만들어보십시오. 문서가 메츠와 PREMIS을 사용하기 때문에 우리는이 두 스키마를 가져올 수 있습니다 :

<?xml version="1.0" encoding="UTF-8"?> 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
      elementFormDefault="qualified"> 

    <xs:import namespace="http://www.loc.gov/METS/" 
    schemaLocation="http://www.loc.gov/standards/mets/mets.xsd" 
    /> 

    <xs:import namespace="info:lc/xmlns/premis-v2" 
    schemaLocation= 
     "http://www.loc.gov/standards/premis/v2/premis-v2-0.xsd" 
    /> 
</xs:schema> 

저장이 mets-premis.xsd (또는 당신이 원하는 이름) 등을.

이제 예를 들어 문서 루이 - 2-0.xml의 유효성을 확인 xmllint --noout --schema mets-premis.xsd metatdata.xml

+0

으로 확인하는 노력하지만, 내 문서에 새로운 오류를 얻을. 당신의 대답은 저에게 올바른 방향으로 지적했습니다. 감사! – Steffen

+0

@ c-m-sperberg-mcqueen 하나의 후속 조치 (SO에 대한 새로운 질문이 없음). 나는 louis-2-0.xml의 6 행에있는 네임 스페이스 선언이 중복 된 것 같아요. 권리? – Steffen

+1

가장 바깥 쪽 mets : names 요소 선언에 네임 스페이스 선언을 복제 한 것 같습니다. –

관련 문제