Ñò œ]Nc@s|dZddkZddkZddklZyedZWne e fj o e ZnXyedZ Wne e fj o e Z nXyedZ Wne e fj o e Z nXddd d d d d ddg ZdZdZdZdZdeZdeZeiieiieƒdƒZeieieiieddƒƒƒZeieieiieddƒƒƒZeieieiiedddƒƒƒZeieieiiedddƒƒƒZeieieiiedddƒƒƒZ ei!ddhed6ƒZ"ei#eieiied d!ƒƒƒZ$d"„Z%d#„Z&dei'fd$„ƒYZ(dS(%sxThe ``lxml.isoschematron`` package implements ISO Schematron support on top of the pure-xslt 'skeleton' implementation. iÿÿÿÿN(tetreetbytestunicodet basestringt extract_xsdt extract_rngtiso_dsdl_includetiso_abstract_expandtiso_svrl_for_xslt1tsvrl_validation_errorstschematron_schema_validtstylesheet_paramst Schematrons http://www.w3.org/2001/XMLSchemas#http://relaxng.org/ns/structure/1.0s$http://purl.oclc.org/dsdl/schematronshttp://purl.oclc.org/dsdl/svrls {%s}schemat resourcestxslsXSD2Schtrn.xslsRNG2Schtrn.xslsiso-schematron-xslt1siso_dsdl_include.xslsiso_abstract_expand.xslsiso_svrl_for_xslt1.xsls//svrl:failed-assertt namespacestsvrltrngsiso-schematron.rngcKs—h}xŠ|iƒD]|\}}t|tƒotii|ƒ}nA|djotdƒ‚n$t|tiƒpt |ƒ}n|||>> from lxml import isoschematron >>> schematron = isoschematron.Schematron(etree.XML(''' ... ... ... id is the only permitted attribute name ... ... Attribute ... is forbidden ... ... ... ... ... ''')) >>> xml = etree.XML(''' ... ... ... ... ... ''') >>> schematron.validate(xml) 0 >>> xml = etree.XML(''' ... ... ... ... ... ''') >>> schematron.validate(xml) 1 cCsWd}|itjo|i|ƒ}n+|i|itjo|i|ƒ}n|S(s 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(Rttagt_xml_schema_roott _extract_xsdtnsmaptprefixt RELAXNG_NSt _extract_rng(tselftelementt schematron((sA/usr/lib/python2.6/vendor-packages/lxml/isoschematron/__init__.pyt_extract¿s c Cstt|ƒiƒ| |_d|_d|_d|_yd|dj o-t|t i ƒo |} qš|i ƒ} n'|dj ot i |ƒi ƒ} nWn0t j o$t idtiƒdƒ‚nX| djotdƒ‚n| itjo | } n|i| ƒ} | djot idƒ‚n|o|i| |} n|o|i| |} nt| ƒpt idtiƒ‚n|o | |_nh| d6}t||ƒ}|i| |}| o ||_nt i|ƒ|_dS(NsNo tree or file given: %sis Empty trees=Document is not a schematron schema or schematron-extractablesinvalid schematron schema: %stphase(tsuperR t__init__t _store_reportRt _schematront_validator_xsltt_validation_reportRRt_Elementtgetroottparset ExceptiontSchematronParseErrortsystexc_infot ValueErrorR$t_schematron_rootR.t_includet_expandR t error_logR#t_compileRt _validator(R+Rtfiletincludetexpandtinclude_paramst expand_paramstcompile_paramststore_schematront store_xsltt store_reportR/trootR-tcompile_kwargstvalidator_xslt((sA/usr/lib/python2.6/vendor-packages/lxml/isoschematron/__init__.pyR1ÚsN               cCsã|iƒ|i|ƒ}|io ||_n|i|ƒ}|o™t|tiƒo|iƒi i pd}n|i i pd}xN|D]F}|i d|i d|i d|idddti|ƒd|ƒqWtStS( saValidate doc using Schematron. Returns true if document is valid, false if not. stdomainttypetleveltlineitmessagetfilename(t_clear_error_logRCR2R5t_validation_errorsRRR6t getroottreetdocinfotURLt_append_log_messaget_domaint _error_typet_levelt tounicodetFalsetTrue(R+RRterrorstfnameterror((sA/usr/lib/python2.6/vendor-packages/lxml/isoschematron/__init__.pyt__call__s"     cCs|iS(srISO-schematron schema document (None if object has been initialized with store_schematron=False). (R3(R+((sA/usr/lib/python2.6/vendor-packages/lxml/isoschematron/__init__.pyR-'stdoccCs|iS(sISO-schematron skeleton implementation XSLT validator document (None if object has been initialized with store_xslt=False). (R4(R+((sA/usr/lib/python2.6/vendor-packages/lxml/isoschematron/__init__.pyRO.scCs|iS(sfISO-schematron validation result report (None if result-storing has been turned off). (R5(R+((sA/usr/lib/python2.6/vendor-packages/lxml/isoschematron/__init__.pytvalidation_report5sN(#t__name__t __module__t__doc__Rt ErrorDomainst SCHEMATRONVR\t ErrorLevelstERRORR^t ErrorTypestSCHEMATRONV_ASSERTR]R.RR&RR*RR?RR@RRBR RWRRaR`R1ReR-tpropertyRORg(((sA/usr/lib/python2.6/vendor-packages/lxml/isoschematron/__init__.pyR ss,E        2    ()RjR;tos.pathtostlxmlRRt __builtins__RtKeyErrort NameErrortstrRRt__all__t XML_SCHEMA_NSR)t SCHEMATRON_NStSVRL_NSR>R%tpathtjointdirnamet__file__t_resources_dirRR8RRRRRRR tRelaxNGR R R#t _ValidatorR (((sA/usr/lib/python2.6/vendor-packages/lxml/isoschematron/__init__.pyts\         !