+
     h3  c            
       s|   R t ^ RIt^ RIt^ RIHt  ]  ]
 . ROtRtRtRtRtR],          tR],          t]P$                  P'                  ]P$                  P)                  ]4      R	4      t]P.                  ! ]P0                  ! ]P$                  P'                  ]R
R4      4      4      t]P.                  ! ]P0                  ! ]P$                  P'                  ]R
R4      4      4      t]P.                  ! ]P0                  ! ]P$                  P'                  ]R
RR4      4      4      t]P.                  ! ]P0                  ! ]P$                  P'                  ]R
RR4      4      4      t]P.                  ! ]P0                  ! ]P$                  P'                  ]R
RR4      4      4      t]P<                  ! RR]/R7      tRt  ]PB                  ! ]P$                  P'                  ]RR4      R7      t"Rt R t$R t% ! R R]PL                  4      t'R#   ] d    ]	t ELi ; i  ] d    ]	t
 EL	i ; i  ]PF                   d    R t" LSi ; i)zxThe ``lxml.isoschematron`` package implements ISO Schematron support on top
of the pure-xslt 'skeleton' implementation.
N)etree
Schematronz http://www.w3.org/2001/XMLSchemaz#http://relaxng.org/ns/structure/1.0z$http://purl.oclc.org/dsdl/schematronzhttp://purl.oclc.org/dsdl/svrlz
{%s}schemaZ	resourcesZxslzXSD2Schtrn.xslzRNG2Schtrn.xslziso-schematron-xslt1ziso_dsdl_include.xslziso_abstract_expand.xslziso_svrl_for_xslt1.xslz//svrl:failed-assertsvrlZ
namespacesFZrngziso-schematron.rng)fileTc                 s    \        R 4      h)z9Validating the ISO schematron requires iso-schematron.rng)ZNotImplementedError)Zarg   &B/usr/lib64/python3.14/site-packages/lxml/isoschematron/__init__.pyschematron_schema_validr   H   s    !"]^^    c                 s$   / pV P                  4        Fy  w  r#\        V\        4      '       d!   \        P                  P                  V4      pM:Vf   \        R4      h\        V\        P                  4      '       g   \        V4      pW1V&   K{  	  V# )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.
z*None not allowed as a stylesheet parameter)	itemsZ
isinstance
basestring_etreeXSLTZstrparamZ	TypeErrorXPathunicode)ZkwargsresultZkeyZvals   ,   r   stylesheet_paramsr   L   su     FLLNc:&&++&&s+C[HIIC..#,Cs # Mr   c                sx    \        V 4      p VP                  4        F  w  r#Vf   K  W0V&   K  	  \        R/ V B p V # )zReturn a copy of paramsDict, updated with kwargsDict entries, wrapped as
stylesheet arguments.
kwargsDict entries with a value of None are ignored.
 )Zdictr	   r   )Z
paramsDictZ
kwargsDictZkZvs   &&  r   _stylesheet_param_dictr   h   sD     j!J  "=qM # #0Z0Jr   c                   s\  a a ] tR t^vt oRt]P                  P                  t]P                  P                  t]P                  P                  t]t]P"                  ! RR]/R7      tR t]t]t]t]t]t]tRRRR/ / / RRRR]] 3V 3R	 llt!R
 t"]#R 4       t$]#R 4       t%]#R 4       t&Rt'Vt(V ;t)# )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.

If ``validate_schema`` is set to False, the validation of the schema file
itself is disabled.  Validation happens by default after building the full
schema, unless the schema validation file cannot be found at import time,
in which case the validation gets disabled.  Some lxml distributions exclude
this file due to licensing issues.  ISO-Schematron validation can then still
be used normally, but the schemas themselves cannot be validated.

Here is a usage example::

  >>> from lxml import etree
  >>> from lxml.isoschematron import Schematron

  >>> schematron = Schematron(etree.XML('''
  ... <schema xmlns="http://purl.oclc.org/dsdl/schematron" >
  ...   <pattern id="id_only_attribute">
  ...     <title>id is the only permitted attribute name</title>
  ...     <rule context="*">
  ...       <report test="@*[not(name()='id')]">Attribute
  ...         <name path="@*[not(name()='id')]"/> is forbidden<name/>
  ...       </report>
  ...     </rule>
  ...   </pattern>
  ... </schema>'''),
  ... error_finder=Schematron.ASSERTS_AND_REPORTS)

  >>> xml = etree.XML('''
  ... <AAA name="aaa">
  ...   <BBB id="bbb"/>
  ...   <CCC color="ccc"/>
  ... </AAA>
  ... ''')

  >>> schematron.validate(xml)
  False

  >>> xml = etree.XML('''
  ... <AAA id="aaa">
  ...   <BBB id="bbb"/>
  ...   <CCC/>
  ... </AAA>
  ... ''')

  >>> schematron.validate(xml)
  True
z///svrl:failed-assert | //svrl:successful-reportr   r   c                s    RpVP                   \        8X  d   V P                  V4      pV# VP                  P	                  VP
                  4      \        8X  d   V P                  V4      pV# )zExtract 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_xsdZnsmapZgetZprefix
RELAXNG_NS_extract_rng)selfZelement
schematrons   && r   _extractZSchematron._extract   sa     
;;****73J  ]]w~~.*<**73Jr   NTFc                s  < \         SV `  4        Wn        R V n        R V n        R V n        WP                  Jd   Wn        R p Ve1   \        P                  ! V4      '       d   TpM9VP                  4       pM(Ve%   \        P                  ! V4      P                  4       pVf   \!        R4      hVP"                  \$        8X  d   TpMV P'                  V4      pVf   \        P                  ! R4      hV'       d   V P(                  ! V3/ VB pV'       d   V P*                  ! V3/ VB pV'       d=   \-        V4      '       g,   \        P                  ! R\,        P.                  ,          4      hV'       d   Wn        RV/p\1        VV4      pV P2                  ! V3/ VB pV	'       d   VV n        \        P4                  ! V4      V n        R #   \         d9    \        P                  ! R\        P                  ! 4       ^,          ,          4      hi ; i)NzNo tree or file given: %sz
Empty treez=Document is not a schematron schema or schematron-extractablezinvalid schematron schema: %sphase)Zsuper__init___store_report_schematron_validator_xslt_validation_reportASSERTS_ONLY_validation_errorsr   	iselementZgetrootparseZ	ExceptionZSchematronParseErrorsysZexc_infoZ
ValueErrorr   _schematron_rootr   _include_expandr   Z	error_logr   _compiler   
_validator)r   r    r   ZincludeZexpandZinclude_paramsZexpand_paramsZcompile_paramsZstore_schematronZ
store_xsltZstore_reportr   Zerror_finderZvalidate_schemaZrootr   Zcompile_kwargsvalidator_xslt	__class__s   &&&&&&&&&&&&&&    r   r   ZSchematron.__init__   s   
 	)#"&000&2# 
	A ##E** D ==?D!||D)113 <\**88''Jt,J--OQ Q zD^DJjBMBJ#::#F#F--/'1123 3 )!5)/OzD^D#1D  ++n5=  	A--+cllnQ.??A A	As   G #G &G 7(G AHc                s,   V P                  4        V P                  V4      pV P                  '       d   W n        V P	                  V4      pV'       d   \
        P                  ! V4      '       d0   VP                  4       P                  P                  ;'       g    RpM VP                  P                  ;'       g    RpV FN  pV P                  V P                  V P                  V P                  ^ \
        P                  ! VRR7      VR7       KP  	  R# R# )zQValidate doc using Schematron.

Returns true if document is valid, false if not.
z<file>r   )Zencoding)ZdomainZtypeZlevelZlineZmessageZfilenameFT)Z_clear_error_logr*   r   r    r"   r   r#   ZgetroottreeZdocinfoZURLZ_append_log_message_domain_error_type_levelZtostring)r   r    r   ZerrorsZfnameZerrors   &&    r   __call__ZSchematron.__call__0  s    
 	'&,#((0&&))+3377CC8))55X((<<d.>.>++A"OOEIF"	 ) $   r   c                    V P                   # )zbISO-schematron schema document (None if object has been initialized
with store_schematron=False).
)r   r   r   r   r   ZSchematron.schematronI  s    
 r   c                r1   )z|ISO-schematron skeleton implementation XSLT validator document (None
if object has been initialized with store_xslt=False).
)r   r2   r   r   r+   ZSchematron.validator_xsltP  s    
 ###r   c                r1   )zVISO-schematron validation result report (None if result-storing has
been turned off).
)r    r2   r   r   validation_reportZSchematron.validation_reportW  s    
 &&&r   )r   r   r"   r    r*   r   )*Z__name__Z
__module__Z__qualname__Z__firstlineno____doc__r   ZErrorDomainsZSCHEMATRONVr-   ZErrorLevelsZERRORr/   Z
ErrorTypesZSCHEMATRONV_ASSERTr.   svrl_validation_errorsr!   r   SVRL_NSZASSERTS_AND_REPORTSr   extract_xsdr   extract_rngr   iso_dsdl_includer'   iso_abstract_expandr(   iso_svrl_for_xslt1r)   r"   !schematron_schema_valid_supportedr   r0   Zpropertyr   r+   r3   Z__static_attributes__Z__classdictcell__Z__classcell__)r,   Z__classdict__s   @@r   r   r   v   s     Wt !!--G%%F##66K *L ,,9G$&" LLH!G!H
 &!d4 ""R"'E,!B	76r2     $ $ ' ' 'r   )	r7   r8   r9   r:   r;   r5   r   r   r   )(r4   r%   Zos.pathZosZlxmlr    r   r   Z	NameErrorZstrr
   Z__all__ZXML_SCHEMA_NSr   ZSCHEMATRON_NSr6   r&   r   ZpathZjoinZdirnameZ__file__Z_resources_dirr   r$   r7   r8   r9   r:   r;   r   r5   r<   ZRelaxNGr   ZRelaxNGParseErrorr   r   Z
_Validatorr   r   r   r   <module>r=      s:      . 32
6
*  -/ -/ bggooh7E kk&,,GGLL(89; <kk&,,GGLL(89; <;;v||GGLL(>') * +  kk&,,GGLL(>*,#- .  [[GGLL.0HJ"K L   '8:  %* !_$nnWW\\.%1EFH(,%8f'"" f'S  G
  Jh  ___s4   H H 70H$ 	HH	H! H!$H;:H;