Refactor low-level node manipulation routines into separate functions.

This should make moving implementation easier.

git-svn-id: https://pugixml.googlecode.com/svn/trunk@1001 99668b35-9821-0410-8761-19e4c4f06640