Hi All

When an xml instance is given, the created json schema does not maintain
the order (which is in the xml). Reason is for this behavior is when
creating json schema we first convert xml to json and then iterate the json
object to create the json schema. The xml->json conversion process does not
guarantee the order (As json object is an unordered set of name/value
pairs).
I can think of following alternative to overcome this issue.
1. Fork the org.json source and use a LinkedHashMap for json object instead
of HashMap [1]
2. Directly generate json schema from xml
3. Once the xml-> json conversion again iterate the xml and reorder the
json object

Option 1 - Has the disadvantage of maintaining org.json* code
Option 2 - Have to write from the scratch and have to handle arrays in xml
Option 3 - Extra processing overhead.

If you have any ideas please comment.

[1] -
http://stackoverflow.com/questions/26034370/inverted-order-of-json-elements-in-java-after-xml-conversion



Thanks
Susinda

-- 
*Susinda Perera*
Software Engineer
B.Sc.(Eng), M.Sc(Computer Science), AMIE(SL)
Mobile:(+94)716049075
Blog: susinda.blogspot.com
WSO2 Inc. http://wso2.com/
Tel : 94 11 214 5345 Fax :94 11 2145300
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to