0
Castor-Maven-Plugin 생성 Java 클래스가 XML 문자열의 내용을 언 마샬링하는 데 이상한 문제가 있습니다.캐스터가 정규식에 따라 유효한 값을 인식하지 못합니다.
는 XML이 같은 모습을 확인하기 위해 노력하고있어 :
...
<mediaType>audio/media</mediaType>
...
을 그리고 난 다음 패턴에 대해 그것을 검증하고 있습니다 :
(audio|video|document|application|example|image|message|model|multipart|text)/.+
XSD를의 관련 부분이 Castor는 다음 클래스를 생성합니다.
...
<xs:simpleType name="mediaType">
<xs:annotation>
<xs:documentation>
The internet media type of the paired file. For example, a MP3 file would be audio/mpeg.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="(audio|video|document|application|example|image|message|model|multipart|text)/.+"/>
</xs:restriction>
</xs:simpleType>
...
나는 XML 문자열 비 직렬화 할 때 throw되는 예외를 다음 : 이제
org.exolab.castor.xml.MarshalException: The following exception occured while validating field: _mediaType of class: my.domain.GeneratedClass: audio/mpegdoes not match the required regular expression: "(audio|video|document|application|example|image|message|model|multipart|text)/.+"{File: [not available]; line: 23; column: 12}...
을 IntelliJ's의 XML 검증 및 I 해봤 다른 모든 정규식 도구에 따르면,이 문제가되지 않습니다. 왜 카스 터는 그렇게 생각하는 것일까 요?
올드 http://castor.codehaus.org/conf-lib.html
는 다음을 포함하는 클래스 경로에 설정 파일을 호출 castor.properties 추가를 참조하십시오 다양한 장소의 게시물은 Castor의 이전 버전에서 버그를 제안합니다. 나는 당신이 새로운 버전을 실행하는 것 같지만 어떤 버전을 사용합니까? – Qben
방금 1.3.1로 업데이트되었지만 1.3.0.1을 사용하고있었습니다. 동료와 나는 단지 문제를 해결했다. 아래를 참조하십시오. – Tickolas