I think this is too use-case specific, not general enough. We can't assume that every node will have a `type` attribute, or that the only valid values will be `integer` and `boolean`.