Hey Preet
I hate the xml api in .net. I started using json.net to parse xml into a
dynamic object.
dynamic purchaseOrder =
JObject.Parse(JsonConvert.SerializeXmlNode(xDoc.DocumentElement));
dynamic delAddress = purchaseOrder.ShipTo.Detail.DeliveryAddress;
var meh = purchaseOrder.BuyerOrderNo;
Only problem is that it doesn't know if something is meant to be an array
so I had to do this.
if ((stockItems as JContainer).Type == JTokenType.Array)
foreach (dynamic stockItem in purchaseOrder.StockList.StockItem)
AddStockLine(stockItem, linesToReturn);
else
AddStockLine(stockItems, linesToReturn);
On Thu, Apr 10, 2014 at 3:16 PM, Preet Sangha <[email protected]> wrote:
> If there is one technology that drives me nuts every time I have to work
> with it, it's XML, XPATH and associated crapping XML Namespaces.
>
> Why does everything have to be so bloody painful.
>
>
> ARGHHHHHHHHHHHHHHHH!!!!
>
>
> Oh that an regex :-)
>
> --
> regards,
> Preet, Overlooking my bedroom/office wall.
>