Fix for include

CXMLDocument.h wouldn't compile on iOS due to <tree.h> include.

Also fixed some compiler warning about implicit casts.