fix crash when document is invalid
fix crash when document is invalid

In Swift 3 xmlDocGetRootElement is returning an implicitly unwrapped
UnsafePointer and when there is no root element in the document, it
crashes. This worked in Swift 2 because Swift 2's UnsafePointer can be
nil, and in Swift 3 nil UnsafePointer has type UnsafePointer?

Adding a optional check shall fix this

cezheng/Fuzi,cezheng/Fuzi,cezheng/Fuzi,niilohlin/Fuzi,niilohlin/Fuzi,niilohlin/Fuzi