|
|
|
|
|
by GeneThomas
588 days ago
|
|
> * Native support for arrays. I mentioned a few above. `<<Faults$$>>` and `<<$$>>` -- guess what these two mean if you see this first time? You would never guess. It's an empty array and an empty element, you've just failed. << means it relates to starting an array, $>> means it is the end, $$ meaning something else — an empty array! The xᴍʟ alternative is a bodge: public class PurchaseOrder
{
public Item[] ItemsOrders;
}
public class Item
{
public string ItemID;
public decimal ItemPrice;
}
serializes to: <PurchaseOrder>
<ItemsOrders>
<Item>
<ItemID>aaa111</ItemID>
<ItemPrice>34.22</ItemPrice>
</Item>
<Item>
<ItemID>bbb222</ItemID>
<ItemPrice>2.89</ItemPrice>
</Item>
</ItemsOrders>
</PurchaseOrder>
Where the array is marked up as two sub elements both called <Item>:Xᴇɴᴏɴ has first class support for arrays: <PurchaseOrder>
<<ItemsOrders>
<ItemID=aaa111>
<ItemPrice=34.22>
<&>
<ItemID=bbb222>
<ItemPrice=2.89>
<$>>
<$>
The elements may be scalars so <PurchaseOrder>
<<ItemsOrders>
<$>>
<$>
has an array with one item of the empty string. So a separate syntax for empty arrays is required! <PurchaseOrder>
<<ItemsOrders$$>>
<$>
|
|