I'm using AEXML and I have some return XML from a WebSocket. I want to
check if the return XML contains a node or not. In this way, I know what
kind of data I'm receiving.

<updates>
    <volumeUpdated />
</updates>

What's the best way to check if that volumeUpdated node exists? It has no
attributes or value.

I tried this (AEXMLElement is non-optional):

let theVolume = xmlDoc.root["volumeUpdated"]
if theVolume != nil {
    print(">> We have a volume update. \(theVolume)")
}

But I get a "comparing non-optional value of type 'AEXMLElement' to nil
always returns true.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to