java - Deserializing XML text elements with attributes in XStream -


Actually, I want to reverse.

I see Microsoft's Bing Batch Geocode service, and some elements look like this (frowned):

   & Lt; Link role = "output" name = "successful" & gt; Https: //spatial.virtualearth.net/REST/v1/dataflows/Geocode/5bf10c37df944083b1879fbb0556e67e/output/succeeded< / Link> & Lt; Link role = "output" name = "unsuccessful" & gt; Https: //spatial.virtualearth.net/REST/v1/dataflows/Geocode/5bf10c37df944083b1879fbb0556e67e/output/failed< / Link & gt; & Lt; Details & gt; Xml & lt; / Details & gt; & Lt; Status & gt; Full & lt; / Status & gt; ... & lt; / DataflowJob & gt;  

Note that & lt; Link & gt; elements as well as text content is also relevant POJO classes which I am trying to deserialize:

  class DataflowJob {String Id; @ XStreamImplicit List & lt; Link & gt; Link; String description; Position status; ...} class links {@XStreamAs attribute role role; Name of the name @ XStreamAsAttribute; String url; }  

With my current configuration (classes are aliased, auto-detected properties, and all these jazz), Xstream to names and < Code> role attributes & lt; Link & gt; on the elements, but the actual link is not in the text itself.

How do I desreialize that text to XStream in a string field in the String field?

I do not want to manually insert new elements around the link * for this.


* such, replaced

   

with

  & lt; Link role = "self" & gt; & Lt; URL & gt; Https: // long / url here & lt; / URL & gt; & Lt; / Link & gt;  

XStream is not a suitable device for this. The thrust of Xstream is to serializing the / expiring Java object graph, to dynamize XML, instead the serializing / deborilizing arbitrary XML.

This will be a tough fight to bend the Xstream as you wish. I have been better designed for this work, such as JACAB (built in Java 6) or GIBX.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -