I took a closer look at this today.
If I pass something invalid into a method that calls prepareInsert(),
I get PHP warnings from the DOM parser. Execution is not interrupted,
though. QueryPath will continue to function, though the data will not
be added to the document.
I believe this is the desired behavior. I'm not wild about generating
a fatal error, and while I could throw an exception under such
conditions, I'm concerned that that will cause frustration with
QueryPath developers who aren't used to try/catch blocks (since a
failure to catch will lead to a fatal).
I'm open to input, though. If you have a suggestion for better overall
error handling, please let me know. I come from the Java world, where
exceptions are the way to go. But most PHP code that I have seen seems
to blissfully ignore exceptions. I just want my library to be easy to
use for the majority of PHP developers.
Thanks for taking the time to hunt down the issue.