问题描述
这是我的豆子:
public class UpdateResponseDocument
{
private Result result;
private String resultCode;
private String idMissatge;
// Getters & Setters
}
public class Result {
private Pacient pacient;
private String executionCode;
private String executionDetails;
// Getters & Setters
}
public class Pacient {
private DadesAP dadesAP;
private DadesPacient dadesPacient;
// Getters & Setters
}
public class DadesAP
{
private String codiCentreAD;
private String infermera;
private String codiCentreAP;
private String metge;
private String centreAD;
private String centreAP;
// Getters & Setters
}
public class DadesPacient
{
private String documentIdentificacio;
private String datanaixement;
private String cipVigent;
// Getters & Setters
}
这里是我的 xml:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:cercarInformacioPacientResponseV2 xmlns:ns2="http://salut.gencat.cat/hc3/etccerques" xmlns:ns3="urn:hl7-org:v3" xmlns:ns4="http://principal.agenda.consulta.ws.hc3.salut.cat/">
<ns2:UpdateResponseDocument>
<idMissatge>123456789</idMissatge>
<resultCode>OK</resultCode>
<result>
<executionCode>ETC_OIP_000</executionCode>
<executionDetails>El procés s'ha dut a terme correctament.</executionDetails>
<pacient>
<dadesPacient>
<cipVigent>ROEZ0620427014</cipVigent>
<nom>JOSEP</nom>
<primerCognom>RO</primerCognom>
<segonCognom>EZQUE</segonCognom>
<datanaixement>19620427000000</datanaixement>
<tipusDocument>1</tipusDocument>
<documentIdentificacio>00000000T</documentIdentificacio>
<codisexe>0</codisexe>
<sexe>Home</sexe>
<adreca>CR CAVALL BERNAT 5</adreca>
<codiMunicipi>0830000</codiMunicipi>
<municipi>VILADECAVALLS</municipi>
<cp>08232</cp>
<telefon1/>
<telefon2/>
<situacioAssegurat>Alta</situacioAssegurat>
</dadesPacient>
<dadesAP>
<metge>Fermin Fernandez Gonzalez</metge>
<infermera>peped PEPE PEPE</infermera>
<codiCentreAP>01785</codiCentreAP>
<centreAP>EAP Terrassa D - Oest</centreAP>
<codiCentreAD>01785</codiCentreAD>
<centreAD>EAP Terrassa D - Oest</centreAD>
</dadesAP>
<marcatge>
<pcc>0</pcc>
<maca>1</maca>
</marcatge>
<estratificacio/>
<riscos/>
<testRapidSARSCOV2>
<dataResultat>28/10/20</dataResultat>
<resultat>Negatiu</resultat>
<destiPacient/>
</testRapidSARSCOV2>
<PCRCOVID19>
<tePCR>NO</tePCR>
</PCRCOVID19>
</pacient>
</result>
</ns2:UpdateResponseDocument>
</ns2:cercarInformacioPacientResponseV2>
</soap:Body>
</soap:Envelope>
我无法编辑我的 Java 代码。我的意思是,我无法添加其他注释。
问题出现在这里:
- 如您所见,xml 有
<soap:Envelope>
><soapBody>
><ns2:cercarInformacioPacientResponseV2>
,然后是<ns2:UpdateResponseDocument>
。
<ns2:UpdateResponseDocument>
是我需要反序列化为 UpdateRespnseDocument
的地方,忽略父节点。
我无法编写任何有用的代码:
private void map(String response) {
XmlMapper xmlMapper = new XmlMapper();
UpdateResponseDocument bean = xmlMapper.readValue(response,UpdateResponseDocument.class);
}
关于如何忽略父节点并将 <ns2:UpdateResponseDocument>
作为根元素绑定到我的 UpdateResponseDocument
bean 的任何想法?
我希望我已经解释得很好。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)