add additional checks to prevent tree corruption. fix problem copying * tree.c: add additional checks to prevent tree corruption. fix problem copying attribute using xmlDocCopyNode from one document to another.