def _get_xmlparser(xmlclass=XmlObject, validate=False, resolver=None):
if validate:<EOL><INDENT>if hasattr(xmlclass, '<STR_LIT>') and xmlclass.XSD_SCHEMA is not None:<EOL><INDENT>xmlschema = getattr(xmlclass, '<STR_LIT>', None)<EOL>if xmlschema is None:<EOL><INDENT>xmlschema = loadSchema(xmlclass.XSD_SCHEMA)<EOL><DEDENT>opts = {'<STR_LIT>': xmlschema}<EOL><DEDENT>else:<EOL><INDENT>opts = {'<STR_LIT>': True}<EOL><DEDENT><DEDENT>else:<EOL><INDENT>opts = {"<STR_LIT>": False}<EOL><DEDENT>parser = etree.XMLParser(**opts)<EOL>if resolver is not None:<EOL><INDENT>parser.resolvers.add(resolver)<EOL><DEDENT>return parser<EOL>
Initialize an instance of :class:`lxml.etree.XMLParser` with appropriate
    settings for validation.  If validation is requested and the specified
    instance of :class:`XmlObject` has an XSD_SCHEMA defined, that will be used.
    Otherwise, uses DTD validation. Switched resolver to None to skip validation.