0
Windows 7에서 JBoss 8.1을 실행하고 xml 응답을 얻고 POJO에 매핑 요청을 게시하려고합니다. 나는이Java/Jboss의 게시물에서 응답을 읽을 때 dtd 유효성 검사를 피하는 방법
WebTarget webTarget = ClientBuilder.newClient().target(queryString);
Bean bean=webTarget.request(MediaType.APPLICATION_XML).get(Bean.class);
처럼 한 URL과 함께 그것을 한 적이 그것은 내가 원하는 excactly 무엇을 내게 준 - XML 구조에 해당하는 클래스의 무리.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE oxip SYSTEM "combinations.dtd">
내가 해달라고 그렇게 유효성 검사를 수행 할 :
지금 난 후 다른 URL을하지만 FileNotFoundException이로 끝나는 메신저와 XML의 DTD 파일에 대한 참조와 동일한 작업을 수행하고 싶어 나는 다음 않았다javax.ws.rs.core.Response vResponse;
WebTarget target=ClientBuilder.newClient().target(queryString);
response = target.request(MediaType.TEXT_XML).post(Entity.text(apiRequest));
String string = vResponse.readEntity(String.class);
JAXBContext jaxbContext = JAXBContext.newInstance(Bean.class);
SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
saxParserFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
XMLReader xmlReader = saxParserFactory.newSAXParser().getXMLReader();
InputSource inputSource = new InputSource(new StringReader(string));
SAXSource source = new SAXSource(xmlReader, inputSource);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
Bean bean = (Bean) unmarshaller.unmarshal(vSource);
유효성 검사를 사용하지 않도록 제이 보스의 JAXB를 구성하는 등의 SAXParser를하고있다 JAXBContext의 명시 적 사용을 aviod 할 수있는 방법이 밤은? 문제가 해결 된 다음 코드를 삽입함으로써
정말 누군가가이 일에 도움을 줄 수 희망? –