java - Can not convert attribut "type" in xml string to json string by Restlet StringRepresentation class -


My XML string contains a "Type" attribute, for example:

    

After converting, I came to know that everything is fine, besides the specialty "type" which is not in the result of the JSSN string.

I know that "type" is a special name in many cases. Is there any configuration in the restlate, can I set the string repetition class to "type" as the normal attribute name?

Answer this is the solution that you have set the Internet enabled (incorrect) in XMLSerializer. XMLSerializer filtered the attribute "type", not string presentation. Here's the code:

  XMLSerializer serializer = new XMLSerializer (); Serializer.setTypeHintsEnabled (false); Results = New String Repection (serializer.read (xml) .toString (), MediaType .APPLICATION_JSON, Language.ALL, CharacterSAT.UTF_8);    

Comments

Popular posts from this blog

java - NullPointerException for a 2d Array -

python - Assemble mpeg file unable to play in mediaplayer -

c# - NameSpace Manager or XsltContent to parse aspx page -