* support empty (null) strings
* protect against malformed document (empty input)