Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 U*Wx0@sdZddlZddlZddlmZyeWnek r@e ZYnXye Wnek rbe Z YnXdddddd d d d g Z d Z dZ dZdZdeZde ZejjejjedZejejejjeddZejejejjeddZejejejjedddZejejejjedddZejejejjedddZejddeidZej ejejjeddZ!dd Z"d d!Z#Gd"d d ej$Z%dS)#zxThe ``lxml.isoschematron`` package implements ISO Schematron support on top of the pure-xslt 'skeleton' implementation. N)etree extract_xsd extract_rngiso_dsdl_includeiso_abstract_expandiso_svrl_for_xslt1svrl_validation_errorsschematron_schema_validstylesheet_params Schematronz http://www.w3.org/2001/XMLSchemaz#http://relaxng.org/ns/structure/1.0z$http://purl.oclc.org/dsdl/schematronzhttp://purl.oclc.org/dsdl/svrlz {%s}schemaZ resourcesZxslzXSD2Schtrn.xslzRNG2Schtrn.xslziso-schematron-xslt1ziso_dsdl_include.xslziso_abstract_expand.xslziso_svrl_for_xslt1.xslz//svrl:failed-assertsvrl) namespacesrngziso-schematron.rngcKsdi}xZ|jD]N\}}t|tr.tjj|}n&|dkr@tdnt|tjsTt|}|||<qW|S)a(Convert keyword args to a dictionary of stylesheet parameters. XSL stylesheet parameters must be XPath expressions, i.e.: * string expressions, like "'5'" * simple (number) expressions, like "5" * valid XPath expressions, like "/a/b/text()" This function converts native Python keyword arguments to stylesheet parameters following these rules: If an arg is a string wrap it with XSLT.strparam(). If an arg is an XPath object use its path string. If arg is None raise TypeError. Else convert arg to string. Nz*None not allowed as a stylesheet parameter) items isinstance basestring_etreeXSLTZstrparam TypeErrorXPathunicode)kwargsresultkeyvalr /usr/lib64/python3.6/__init__.pyr Fs    cCs<t|}x$|jD]\}}|dk r|||<qWtf|}|S)zReturn a copy of paramsDict, updated with kwargsDict entries, wrapped as stylesheet arguments. kwargsDict entries with a value of None are ignored. N)dictrr )Z paramsDictZ kwargsDictkvrrr_stylesheet_param_dictbs   r c seZdZdZejjZejj Z ej j Z eZejddeidZddZeZeZeZeZeZeZddddiiid d d def fd d Zd d Z e!ddZ"e!ddZ#e!ddZ$Z%S)r a An ISO Schematron validator. Pass a root Element or an ElementTree to turn it into a validator. Alternatively, pass a filename as keyword argument 'file' to parse from the file system. Schematron is a less well known, but very powerful schema language. The main idea is to use the capabilities of XPath to put restrictions on the structure and the content of XML documents. The standard behaviour is to fail on ``failed-assert`` findings only (``ASSERTS_ONLY``). To change this, you can either pass a report filter function to the ``error_finder`` parameter (e.g. ``ASSERTS_AND_REPORTS`` or a custom ``XPath`` object), or subclass isoschematron.Schematron for complete control of the validation process. Built on the Schematron language 'reference' skeleton pure-xslt implementation, the validator is created as an XSLT 1.0 stylesheet using these steps: 0) (Extract from XML Schema or RelaxNG schema) 1) Process inclusions 2) Process abstract patterns 3) Compile the schematron schema to XSLT The ``include`` and ``expand`` keyword arguments can be used to switch off steps 1) and 2). To set parameters for steps 1), 2) and 3) hand parameter dictionaries to the keyword arguments ``include_params``, ``expand_params`` or ``compile_params``. For convenience, the compile-step parameter ``phase`` is also exposed as a keyword argument ``phase``. This takes precedence if the parameter is also given in the parameter dictionary. If ``store_schematron`` is set to True, the (included-and-expanded) schematron document tree is stored and available through the ``schematron`` property. If ``store_xslt`` is set to True, the validation XSLT document tree will be stored and can be retrieved through the ``validator_xslt`` property. With ``store_report`` set to True (default: False), the resulting validation report document gets stored and can be accessed as the ``validation_report`` property. Here is a usage example:: >>> from lxml import etree >>> from lxml.isoschematron import Schematron >>> schematron = Schematron(etree.XML(''' ... ... ... id is the only permitted attribute name ... ... Attribute ... is forbidden ... ... ... ... '''), ... error_finder=Schematron.ASSERTS_AND_REPORTS) >>> xml = etree.XML(''' ... ... ... ... ... ''') >>> schematron.validate(xml) False >>> xml = etree.XML(''' ... ... ... ... ... ''') >>> schematron.validate(xml) True z///svrl:failed-assert | //svrl:successful-reportr )r cCs8d}|jtkr|j|}n|j|jtkr4|j|}|S)a Extract embedded schematron schema from non-schematron host schema. This method will only be called by __init__ if the given schema document is not a schematron schema by itself. Must return a schematron schema document tree or None. N)tag_xml_schema_root _extract_xsdZnsmapprefix RELAXNG_NS _extract_rng)selfelement schematronrrr_extracts    zSchematron._extractNTFc  sftt|j| |_d|_d|_d|_| |jk r6| |_d} y<|dk r^t j |rT|} qt|j } n|dk rtt j |j } Wn*t k rt jdtjdYnX| dkrtd| jtkr| }n |j| }|dkrt jd|r|j|f|}|r|j|f|}t|st jdtj|r*||_d| i}t||}|j|f|}| rV||_t j||_dS)NzNo tree or file given: %sz Empty treez=Document is not a schematron schema or schematron-extractablezinvalid schematron schema: %sphase)superr __init__ _store_report _schematron_validator_xslt_validation_report ASSERTS_ONLY_validation_errorsr iselementZgetrootparse ExceptionZSchematronParseErrorsysexc_info ValueErrorr!_schematron_rootr*_include_expandr Z error_logr _compiler _validator)r'rfileincludeexpandZinclude_paramsZ expand_paramsZcompile_paramsZstore_schematronZ store_xsltZ store_reportr,Z error_finderrootr)Zcompile_kwargsvalidator_xslt) __class__rrr.sT        zSchematron.__init__c Cs|j|j|}|jr||_|j|}|rtj|rH|jjj pDd}n |jj pRd}x2|D]*}|j |j |j |j dtj|dd|dqZWdSdS)zaValidate doc using Schematron. Returns true if document is valid, false if not. zrr)encoding)ZdomaintypelevellinemessagefilenameFT)Z_clear_error_logr?r/r2r4rr5Z getroottreeZdocinfoZURLZ_append_log_message_domain _error_type_levelZtostring)r'rrerrorsZfnameerrorrrr__call__"s"       zSchematron.__call__cCs|jS)zrISO-schematron schema document (None if object has been initialized with store_schematron=False). )r0)r'rrrr);szSchematron.schematroncCs|jS)zISO-schematron skeleton implementation XSLT validator document (None if object has been initialized with store_xslt=False). )r1)r'rrrrDBszSchematron.validator_xsltcCs|jS)zfISO-schematron validation result report (None if result-storing has been turned off). )r2)r'rrrvalidation_reportIszSchematron.validation_report)&__name__ __module__ __qualname____doc__rZ ErrorDomainsZ SCHEMATRONVrLZ ErrorLevelsZERRORrNZ ErrorTypesZSCHEMATRONV_ASSERTrMrr3rSVRL_NSZASSERTS_AND_REPORTSr*rr#rr&rr<rr=rr>r4r.rQpropertyr)rDrR __classcell__rr)rErr ps.Q 5  )&rVr8Zos.pathosZlxmlrrr NameErrorstrr__all__Z XML_SCHEMA_NSr%Z SCHEMATRON_NSrWr;r"pathjoindirname__file__Z_resources_dirrr6rrrrrrrZRelaxNGr r r Z _Validatorr rrrrsT