I have legacy XML files that are saved using some ancient XStream.
Now I'm using the latest XStream, and trying to load the data. It successfully loads the date and the int, but the String is blank.
param = (Param) xstream.fromXML(strQueueParam);
where strQueueParam is the following:
<com.company.Params>
<capturedDate class="org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl" resolves-to="org.apache.xerces.jaxp.datatype.SerializedXMLGregorianCalendar">
<lexicalValue>2020-10-13T10:03:00.000+02:00</lexicalValue>
</capturedDate>
<capturedUsername>
<name serialization="custom">
<javax.xml.namespace.QName>
<default>
<localPart>Captured_Username</localPart>
<namespaceURI>http://schemas.datacontract.org/2004/07/RuleEngineLibrary</namespaceURI>
<prefix></prefix>
</default>
</javax.xml.namespace.QName>
</name>
<declaredType>java.lang.String</declaredType>
<scope>org.datacontract.schemas._2004._07.rulesenginelibrary.Param</scope>
<value class="string">Bob Example</value>
<nil>false</nil>
</capturedUsername>
<capturedInt>5</capturedInt>
</com.company.Params>
Ok, so I've realised that these {name/declaredType/scope/value/nil} are the fields of JAXBElement.
So what I think happened, was that the old generation code didn't use jaxb-bindings, and so the classes all contained JAXBElement<String>
instead of String
.
But now I don't think I can deserialize this crap XML unless I have the old incorrectly generated Param file.
Ok I probably have to tranform the XML manually. I'm just talking to myself now. I don't expect an answer.