Description
We use the isValidRange function in NodeInfo primititives to determine what values are not in the correct range of the type, and error accodingly. This logic is spread out in mutiple places that need to do range checking. And in some places (such as NodeInfo fromXMLString) we don't even do range checking.
Instead of having this logic spread out, we should consolidate ranging checking logic in a single place, presumably in NodeInfo fromXMLString and fromNumber. These functions should only ever return a valid primitive in a valid range, or they should throw an exception if they aren't valid and why. We then modify all uses of these function to catch this exception and handle appropriately.