정말 신경이 쓰이는군요 ...
이미 모든 ecore 모델을 실행하고 있지만 해당 모델에 XML 파일을로드 할 수 없습니다.이 작업을 수행하는 데 사용하는 코드는 다음과 같습니다.
ResultType res = ScheduleTableFactory.eINSTANCE.createResultType();
ByteArrayInputStream is;
try {
/* Read XML file to a string and send it to a buffer */
is = new ByteArrayInputStream((this.xml2String(fileName)).getBytes("UTF-8"));
ResourceSet rs = new ResourceSetImpl();
rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xml",
new ScheduleTableResourceFactoryImpl());
Map options = new Properties();
// Just a dummy url to specify the type of the document
URI uri = URI.createURI("http://www.baderous.de/doomz/trankz.xml");
ScheduleTableResourceImpl resource = (ScheduleTableResourceImpl) rs.createResource(uri);
((org.eclipse.emf.ecore.resource.Resource) resource).load(is, options);
}
catch (IOException e) {
e.printStackTrace();
System.exit(0);
}
오랜 투쟁 끝에 이제 try 블록 내부의 마지막 메서드에 도달하지만이 오류가 발생합니다.
org.eclipse.emf.ecore.resource.Resource $ IOWrappedException : '2013-04-23.07 : 55 : 00'값이 유효하지 않습니다. ( http://www.baderous.de/doomz/trankz.xml , 4, 56)
이 설명에서 더 정확하고 싶었지만 EMF에 익숙하지 않기 때문에 기본에 충실 할 것입니다. 이 문제에 대해 도움을 주시면 정말 감사하겠습니다.
미리 감사드립니다!
문제는 날짜 형식을 처리 할 수 없어서 EMf에서 모델을 편집해야했고 이제는 날짜를 문자열로 처리하고 이제 모든 것이 제대로 작동합니다!
앞으로 누군가가이 답변의 혜택을 받고 시간을 절약 할 수 있기를 바랍니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다