Hi Harsha, On Tue, Jun 21, 2016 at 9:27 AM, Harsha Thirimanna <hars...@wso2.com> wrote:
> Hi Sohani, > Just wanted to know one thing and please make me correct if i am wrong > here. > > Normally, XML elements don't have an order and any implementation should > not depend on the order of the elements in XML file except if it has a XSD > and saying it as a sequence. > No. In the specification it is mentioned that XML consider order. And there are certain api's which consider the order of the elements. So we should to support it in xml. > So why do we need to concern about the order here. Any special reason for > that ? > > > *Harsha Thirimanna* > Associate Tech Lead; WSO2, Inc.; http://wso2.com > * <http://www.apache.org/>* > *email: **hars...@wso2.com* <az...@wso2.com>* cell: +94 71 5186770 * > *twitter: **http://twitter.com/ <http://twitter.com/afkham_azeez>* > *harshathirimannlinked-in: **http: > <http://lk.linkedin.com/in/afkhamazeez>**//www.linkedin.com/pub/harsha-thirimanna/10/ab8/122 > <http://www.linkedin.com/pub/harsha-thirimanna/10/ab8/122>* > > *Lean . Enterprise . Middleware* > > > On Mon, Jun 20, 2016 at 2:51 PM, Sohani Weerasinghe <soh...@wso2.com> > wrote: > >> Hi All, >> >> We are in a process of $subject and the main issue we faced in generating >> the json schema was as follows. >> >> When generating the json schema we mainly convert the xml to json and the >> xml to json conversion does not guarantee the order since json object is an >> unordered set of name/value pairs [1]. >> >> The main reason is the usage of HashMaps instead of LinkedHashMaps in >> instantiating the JSONObjects and we could solve the issue by using the >> LinkedHashMaps. >> >> This issue again occurs in serializing the schema while iterating through >> the gmf tree, since we are generating the schema by creating the >> JSONObjects and JSONArrays appropriately. We could solve this issue as well >> by using the above solution and as a result, the generated tree and the >> schema will maintain the order of the XML payload >> >> [1] >> http://stackoverflow.com/questions/26034370/inverted-order-of-json-elements-in-java-after-xml-conversion >> >> Thanks, >> Sohani >> Sohani Weerasinghe >> Senior Software Engineer >> WSO2, Inc: http://wso2.com >> >> Mobile : +94 716439774 >> Blog :http://christinetechtips.blogspot.com/ >> Twitter : https://twitter.com/sohanichristine >> >> _______________________________________________ >> Dev mailing list >> Dev@wso2.org >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > _______________________________________________ > Dev mailing list > Dev@wso2.org > http://wso2.org/cgi-bin/mailman/listinfo/dev > > Thanks, Nuwan -- ---------------------------------------------------------- *Nuwan Chamara Pallewela* *Software Engineer* *WSO2, Inc. *http://wso2.com *lean . enterprise . middleware* Email *nuw...@wso2.com <nuw...@wso2.com>* Mobile *+94719079739@*
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev