applying the same rules from xsd to validation