예제 #1
0
def declare_valid(view):
    """Declare the document valid.

    Remove any highlight regions and indicate validity in status bar."""
    view.erase_regions(constants.PLUGIN_NAME)
    vu.set_status(view, messages.VALID_MARKUP)
    vu.reset_status(view)
    return True
예제 #2
0
파일: validator.py 프로젝트: eerohele/exalt
def declare_valid(view):
    """Declare the document valid.

    Remove any highlight regions and indicate validity in status bar."""
    view.erase_regions(constants.PLUGIN_NAME)
    vu.set_status(view, messages.VALID_MARKUP)
    vu.reset_status(view)
    return True
예제 #3
0
def validate(view, document, validator):
    try:
        validator.assertValid(document)
        return declare_valid(view)
    except etree.DocumentInvalid as e:
        if type(validator) == isoschematron.Schematron:
            message = _get_schematron_error_message(e)
        else:
            message = e
        return vu.show_error(view, message, validator.error_log[0])
    except OSError:
        vu.set_status(view, messages.SCHEMA_RESOLVE_ERROR % id)
        return False
예제 #4
0
파일: validator.py 프로젝트: eerohele/exalt
def validate(view, document, validator):
    try:
        validator.assertValid(document)
        return declare_valid(view)
    except etree.DocumentInvalid as e:
        if type(validator) == isoschematron.Schematron:
            message = _get_schematron_error_message(e)
        else:
            message = e
        return vu.show_error(view, message, validator.error_log[0])
    except OSError:
        vu.set_status(view, messages.SCHEMA_RESOLVE_ERROR % id)
        return False
예제 #5
0
파일: formatter.py 프로젝트: eerohele/exalt
def format_region(view, region, **kwargs):
    if vu.is_eligible(view):
        try:
            parser = parsetools.get_parser(view,
                                           encoding=encodings.UTF8,
                                           remove_blank_text=True,
                                           recover=True)

            markup = parsetools.parse_string(view, parser, view.substr(region))
            return format_markup(markup, view, **kwargs)
        except etree.XMLSyntaxError:
            vu.set_status(view, messages.NOT_WELL_FORMED_XML)
            vu.reset_status(view)