Hi All,

If we consider the below xml, "urn:sObjects" is an array which contains
elements which are not identical.

First array contains AccountId, FirstName, LastName and the other array
contains Name.

     <urn:create xmlns:urn="urn:enterprise.soap.sforce.com" xmlns:urn1="urn:
sobject.enterprise.soap.sforce.com"  xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";>
        <urn:sObjects xsi:type="urn1:Contact"> <!--Zero or more
repetitions:-->
           <!--You may enter ANY elements at this point-->
           <AccountId>001D000000HRzKD</AccountId>
           <FirstName>Jane</FirstName>
           <LastName>Doe</LastName>
        </urn:sObjects>
        <urn:sObjects xsi:type="urn1:Account">
           <Name>Acme Rockets, Inc.</Name>
        </urn:sObjects>
     </urn:create>

The generated json schema would be as follows

{
   "$Schema":"http://json-schema.org/draft-04/schema#";,
   "title":"urn:create",
   "id":"http://jsonschema.net";,
   "type":"object",
   "properties":{
      "urn:create":{
         "id":"http://jsonschema.net/urn:create";,
         "type":"object",
         "properties":{
            "urn:sObjects":{
               "id":"http://jsonschema.net/urn:create/urn:sObjects";,
               "type":"array",
               "items":[
                  {
                     "id":"http://jsonschema.net/urn:create/urn:sObjects/0";,
                     "type":"object",
                     "properties":{
                        "AccountId":{
                           "id":"
http://jsonschema.net/urn:create/urn:sObjects/0/AccountId";,
                           "type":"string"
                        },
                        "@type":{
                           "id":"
http://jsonschema.net/urn:create/urn:sObjects/0/@type";,
                           "type":"string"
                        },
                        "FirstName":{
                           "id":"
http://jsonschema.net/urn:create/urn:sObjects/0/FirstName";,
                           "type":"string"
                        },
                        "LastName":{
                           "id":"
http://jsonschema.net/urn:create/urn:sObjects/0/LastName";,
                           "type":"string"
                        }
                     }
                  },
                  {
                     "id":"http://jsonschema.net/urn:create/urn:sObjects/0";,
                     "type":"object",
                     "properties":{
                        "@type":{
                           "id":"
http://jsonschema.net/urn:create/urn:sObjects/0/@type";,
                           "type":"string"
                        },
                        "Name":{
                           "id":"
http://jsonschema.net/urn:create/urn:sObjects/0/Name";,
                           "type":"string"
                        }
                     }
                  }
               ]
            }
         }
      }
   },
   "namespaces":[
      {
         "prefix":"urn",
         "url":"urn:enterprise.soap.sforce.com"
      },
      {
         "prefix":"xsi",
         "url":"http://www.w3.org/2001/XMLSchema-instance";
      },
      {
         "prefix":"urn1",
         "url":"urn:sobject.enterprise.soap.sforce.com"
      }
   ]
}


I am facing an issue in representing this in the tree view. Are we going to
add all 4 elements ( AccountId, FirstName, LastName and Name) under the
array object?

Really appreciate your input on this.

Thanks,
Sohani
Sohani Weerasinghe
Software Engineer
WSO2, Inc: http://wso2.com

Mobile  : +94 716439774
Blog     :http://christinetechtips.blogspot.com/
Twitter  : https://twitter.com/sohanichristine
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to