2017-08-15 118 views
-2

我有一個嵌套的JSON數組如下:XSD設置爲陣列

當我嘗試發佈此我收到錯誤消息:

{「RestFaultElement」:{「總結」:「轉換失敗。\ n將JSON轉換爲XML。java.io.IOException:數組在數組中開始\ n傳入數據不符合NXSD模式,請更正此問題。\ n「,」code「:null,」detail「: null}}

"Options": { 
       "Co-ordinates": { 
        "X": "594752", 
        "Y": "714430" 
      },    
       "Language": "English",      
       "PageSize": "A4",       
       "Scale": "1,000",       
       "Orientation": "Landscape",     
       "GeometryData": {       
        "type": "polygon", 
        "rings": [ 
         [ 
          [ 
           716102.6700605, 
           733105.7692149 
          ], 
          [ 
           716431.41550966, 
           733105.7692149 
          ], 
          [ 
           716431.41550966, 
           732878.22709315 
          ], 
          [ 
           716102.6700605, 
           732878.22709315 
          ], 
          [ 
           716102.6700605, 
           733105.7692149 
          ] 
         ] 
        ], 
        "_ring": 0, 
        "spatialReference": { 
         "wkid": 2157, 
         "latestWkid": 2157 
        }, 
        "cache": { 
         "_extent": { 
          "xmin": 717192, 
          "ymin": 733058.86, 
          "xmax": 717424, 
          "ymax": 733230.86, 
          "spatialReference": { 
           "wkid": 2157, 
           "latestWkid": 2157 
          } 
         }, 
         "_partwise": "PARTWISE", 
         "_centroid": { 
          "type": "point", 
          "x": 717308.00000013, 
          "y": 733144.86000007, 
          "spatialReference": { 
           "wkid": 2157, 
           "latestWkid": 2157 
          } 
         } 
        } 
       } 

這個問題的一部分似乎是與「環」數組。 我認爲發生了兩件事中的一件: 1. JSON語法錯誤。 2. xsd文件設置錯誤。

的XSD段應接受此元素被定義爲:

<xsd:element type="xsd:decimal" name="rings"/> 

這會設置允許像這樣被傳遞給它的陣列?

謝謝。

回答

1

您在字符串的開始末尾缺少括號。試試:

{"rings": [ 
        [ 
         [ 
          716102.6700605, 
          733105.7692149 
         ], 
         [ 
          716431.41550966, 
          733105.7692149 
         ], 
         [ 
          716431.41550966, 
          732878.22709315 
         ], 
         [ 
          716102.6700605, 
          732878.22709315 
         ], 
         [ 
          716102.6700605, 
          733105.7692149 
         ] 
        ] 
       ]} 
+0

對不起,讓我編輯這個問題,以便我可以包括整個json – semiColon