1 <?xml version="1.0" encoding="ascii"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3 "DTD/xhtml1-transitional.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6 <title>lxml.isoschematron</title>
7 <link rel="stylesheet" href="epydoc.css" type="text/css" />
8 <script type="text/javascript" src="epydoc.js"></script>
11 <body bgcolor="white" text="black" link="blue" vlink="#204080"
13 <!-- ==================== NAVIGATION BAR ==================== -->
14 <table class="navbar" border="0" width="100%" cellpadding="0"
15 bgcolor="#a0c0ff" cellspacing="0">
18 <th> <a
19 href="lxml-module.html">Home</a> </th>
22 <th> <a
23 href="module-tree.html">Trees</a> </th>
26 <th> <a
27 href="identifier-index.html">Indices</a> </th>
30 <th> <a
31 href="help.html">Help</a> </th>
33 <!-- Project homepage -->
34 <th class="navbar" align="right" width="100%">
35 <table border="0" cellpadding="0" cellspacing="0">
36 <tr><th class="navbar" align="center"
37 ><a class="navbar" target="_top" href="/">lxml API</a></th>
41 <table width="100%" cellpadding="0" cellspacing="0">
44 <span class="breadcrumbs">
45 <a href="lxml-module.html">Package lxml</a> ::
46 Package isoschematron
50 <table cellpadding="0" cellspacing="0">
51 <!-- hide/show private -->
52 <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
53 onclick="toggle_private();">hide private</a>]</span></td></tr>
54 <tr><td align="right"><span class="options"
55 >[<a href="frames.html" target="_top">frames</a
56 >] | <a href="lxml.isoschematron-pysrc.html"
57 target="_top">no frames</a>]</span></td></tr>
62 <h1 class="epydoc">Source Code for <a href="lxml.isoschematron-module.html">Package lxml.isoschematron</a></h1>
64 <a name="L1"></a><tt class="py-lineno"> 1</tt> <tt class="py-line"><tt class="py-docstring">"""The ``lxml.isoschematron`` package implements ISO Schematron support on top</tt> </tt>
65 <a name="L2"></a><tt class="py-lineno"> 2</tt> <tt class="py-line"><tt class="py-docstring">of the pure-xslt 'skeleton' implementation.</tt> </tt>
66 <a name="L3"></a><tt class="py-lineno"> 3</tt> <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
67 <a name="L4"></a><tt class="py-lineno"> 4</tt> <tt class="py-line"> </tt>
68 <a name="L5"></a><tt class="py-lineno"> 5</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">sys</tt> </tt>
69 <a name="L6"></a><tt class="py-lineno"> 6</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-0" class="py-name" targets="Variable lxml.etree.XPath.path=lxml.etree.XPath-class.html#path"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-0', 'path', 'link-0');">path</a></tt> </tt>
70 <a name="L7"></a><tt class="py-lineno"> 7</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-1" class="py-name" targets="Package lxml=lxml-module.html"><a title="lxml" class="py-name" href="#" onclick="return doclink('link-1', 'lxml', 'link-1');">lxml</a></tt> <tt class="py-keyword">import</tt> <tt id="link-2" class="py-name" targets="Module lxml.etree=lxml.etree-module.html,Variable lxml.sax.ElementTreeContentHandler.etree=lxml.sax.ElementTreeContentHandler-class.html#etree,Variable lxml.tests.test_elementtree.CElementTreeTestCase.etree=lxml.tests.test_elementtree.CElementTreeTestCase-class.html#etree,Variable lxml.tests.test_elementtree.ETreeTestCaseBase.etree=lxml.tests.test_elementtree.ETreeTestCaseBase-class.html#etree,Variable lxml.tests.test_io.IOTestCaseBase.etree=lxml.tests.test_io.IOTestCaseBase-class.html#etree"><a title="lxml.etree
71 lxml.sax.ElementTreeContentHandler.etree
72 lxml.tests.test_elementtree.CElementTreeTestCase.etree
73 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
74 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-2', 'etree', 'link-2');">etree</a></tt> <tt class="py-keyword">as</tt> <tt class="py-name">_etree</tt> <tt class="py-comment"># due to validator __init__ signature</tt> </tt>
75 <a name="L8"></a><tt class="py-lineno"> 8</tt> <tt class="py-line"> </tt>
76 <a name="L9"></a><tt class="py-lineno"> 9</tt> <tt class="py-line"> </tt>
77 <a name="L10"></a><tt class="py-lineno"> 10</tt> <tt class="py-line"><tt class="py-comment"># some compat stuff, borrowed from lxml.html</tt> </tt>
78 <a name="L11"></a><tt class="py-lineno"> 11</tt> <tt class="py-line"><tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
79 <a name="L12"></a><tt class="py-lineno"> 12</tt> <tt class="py-line"> <tt class="py-name">bytes</tt> <tt class="py-op">=</tt> <tt class="py-name">__builtins__</tt><tt class="py-op">[</tt><tt class="py-string">"bytes"</tt><tt class="py-op">]</tt> </tt>
80 <a name="L13"></a><tt class="py-lineno"> 13</tt> <tt class="py-line"><tt class="py-keyword">except</tt> <tt class="py-op">(</tt><tt class="py-name">KeyError</tt><tt class="py-op">,</tt> <tt class="py-name">NameError</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
81 <a name="L14"></a><tt class="py-lineno"> 14</tt> <tt class="py-line"> <tt class="py-comment"># Python < 2.6</tt> </tt>
82 <a name="L15"></a><tt class="py-lineno"> 15</tt> <tt class="py-line"> <tt class="py-name">bytes</tt> <tt class="py-op">=</tt> <tt class="py-name">str</tt> </tt>
83 <a name="L16"></a><tt class="py-lineno"> 16</tt> <tt class="py-line"><tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
84 <a name="L17"></a><tt class="py-lineno"> 17</tt> <tt class="py-line"> <tt class="py-name">unicode</tt> <tt class="py-op">=</tt> <tt class="py-name">__builtins__</tt><tt class="py-op">[</tt><tt class="py-string">"unicode"</tt><tt class="py-op">]</tt> </tt>
85 <a name="L18"></a><tt class="py-lineno"> 18</tt> <tt class="py-line"><tt class="py-keyword">except</tt> <tt class="py-op">(</tt><tt class="py-name">KeyError</tt><tt class="py-op">,</tt> <tt class="py-name">NameError</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
86 <a name="L19"></a><tt class="py-lineno"> 19</tt> <tt class="py-line"> <tt class="py-comment"># Python 3</tt> </tt>
87 <a name="L20"></a><tt class="py-lineno"> 20</tt> <tt class="py-line"> <tt class="py-name">unicode</tt> <tt class="py-op">=</tt> <tt class="py-name">str</tt> </tt>
88 <a name="L21"></a><tt class="py-lineno"> 21</tt> <tt class="py-line"><tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
89 <a name="L22"></a><tt class="py-lineno"> 22</tt> <tt class="py-line"> <tt class="py-name">basestring</tt> <tt class="py-op">=</tt> <tt class="py-name">__builtins__</tt><tt class="py-op">[</tt><tt class="py-string">"basestring"</tt><tt class="py-op">]</tt> </tt>
90 <a name="L23"></a><tt class="py-lineno"> 23</tt> <tt class="py-line"><tt class="py-keyword">except</tt> <tt class="py-op">(</tt><tt class="py-name">KeyError</tt><tt class="py-op">,</tt> <tt class="py-name">NameError</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
91 <a name="L24"></a><tt class="py-lineno"> 24</tt> <tt class="py-line"> <tt class="py-comment"># Python 3</tt> </tt>
92 <a name="L25"></a><tt class="py-lineno"> 25</tt> <tt class="py-line"> <tt class="py-name">basestring</tt> <tt class="py-op">=</tt> <tt class="py-name">str</tt> </tt>
93 <a name="L26"></a><tt class="py-lineno"> 26</tt> <tt class="py-line"> </tt>
94 <a name="L27"></a><tt class="py-lineno"> 27</tt> <tt class="py-line"> </tt>
95 <a name="L28"></a><tt class="py-lineno"> 28</tt> <tt class="py-line"><tt class="py-name">__all__</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-string">'extract_xsd'</tt><tt class="py-op">,</tt> <tt class="py-string">'extract_rng'</tt><tt class="py-op">,</tt> <tt class="py-string">'iso_dsdl_include'</tt><tt class="py-op">,</tt> </tt>
96 <a name="L29"></a><tt class="py-lineno"> 29</tt> <tt class="py-line"> <tt class="py-string">'iso_abstract_expand'</tt><tt class="py-op">,</tt> <tt class="py-string">'iso_svrl_for_xslt1'</tt><tt class="py-op">,</tt> </tt>
97 <a name="L30"></a><tt class="py-lineno"> 30</tt> <tt class="py-line"> <tt class="py-string">'svrl_validation_errors'</tt><tt class="py-op">,</tt> <tt class="py-string">'schematron_schema_valid'</tt><tt class="py-op">,</tt> </tt>
98 <a name="L31"></a><tt class="py-lineno"> 31</tt> <tt class="py-line"> <tt class="py-string">'stylesheet_params'</tt><tt class="py-op">,</tt> <tt class="py-string">'Schematron'</tt><tt class="py-op">]</tt> </tt>
99 <a name="L32"></a><tt class="py-lineno"> 32</tt> <tt class="py-line"> </tt>
100 <a name="L33"></a><tt class="py-lineno"> 33</tt> <tt class="py-line"> </tt>
101 <a name="L34"></a><tt class="py-lineno"> 34</tt> <tt class="py-line"><tt class="py-comment"># some namespaces</tt> </tt>
102 <a name="L35"></a><tt class="py-lineno"> 35</tt> <tt class="py-line"><tt class="py-comment">#FIXME: Maybe lxml should provide a dedicated place for common namespace</tt> </tt>
103 <a name="L36"></a><tt class="py-lineno"> 36</tt> <tt class="py-line"><tt class="py-comment">#FIXME: definitions?</tt> </tt>
104 <a name="L37"></a><tt class="py-lineno"> 37</tt> <tt class="py-line"><tt id="link-3" class="py-name" targets="Variable lxml.isoschematron.XML_SCHEMA_NS=lxml.isoschematron-module.html#XML_SCHEMA_NS,Variable lxml.tests.test_objectify.XML_SCHEMA_NS=lxml.tests.test_objectify-module.html#XML_SCHEMA_NS"><a title="lxml.isoschematron.XML_SCHEMA_NS
105 lxml.tests.test_objectify.XML_SCHEMA_NS" class="py-name" href="#" onclick="return doclink('link-3', 'XML_SCHEMA_NS', 'link-3');">XML_SCHEMA_NS</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"http://www.w3.org/2001/XMLSchema"</tt> </tt>
106 <a name="L38"></a><tt class="py-lineno"> 38</tt> <tt class="py-line"><tt id="link-4" class="py-name" targets="Variable lxml.isoschematron.RELAXNG_NS=lxml.isoschematron-module.html#RELAXNG_NS"><a title="lxml.isoschematron.RELAXNG_NS" class="py-name" href="#" onclick="return doclink('link-4', 'RELAXNG_NS', 'link-4');">RELAXNG_NS</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"http://relaxng.org/ns/structure/1.0"</tt> </tt>
107 <a name="L39"></a><tt class="py-lineno"> 39</tt> <tt class="py-line"><tt id="link-5" class="py-name" targets="Variable lxml.isoschematron.SCHEMATRON_NS=lxml.isoschematron-module.html#SCHEMATRON_NS"><a title="lxml.isoschematron.SCHEMATRON_NS" class="py-name" href="#" onclick="return doclink('link-5', 'SCHEMATRON_NS', 'link-5');">SCHEMATRON_NS</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"http://purl.oclc.org/dsdl/schematron"</tt> </tt>
108 <a name="L40"></a><tt class="py-lineno"> 40</tt> <tt class="py-line"><tt id="link-6" class="py-name" targets="Variable lxml.isoschematron.SVRL_NS=lxml.isoschematron-module.html#SVRL_NS"><a title="lxml.isoschematron.SVRL_NS" class="py-name" href="#" onclick="return doclink('link-6', 'SVRL_NS', 'link-6');">SVRL_NS</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"http://purl.oclc.org/dsdl/svrl"</tt> </tt>
109 <a name="L41"></a><tt class="py-lineno"> 41</tt> <tt class="py-line"> </tt>
110 <a name="L42"></a><tt class="py-lineno"> 42</tt> <tt class="py-line"> </tt>
111 <a name="L43"></a><tt class="py-lineno"> 43</tt> <tt class="py-line"><tt class="py-comment"># some helpers</tt> </tt>
112 <a name="L44"></a><tt class="py-lineno"> 44</tt> <tt class="py-line"><tt id="link-7" class="py-name" targets="Variable lxml.isoschematron._schematron_root=lxml.isoschematron-module.html#_schematron_root"><a title="lxml.isoschematron._schematron_root" class="py-name" href="#" onclick="return doclink('link-7', '_schematron_root', 'link-7');">_schematron_root</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'{%s}schema'</tt> <tt class="py-op">%</tt> <tt id="link-8" class="py-name"><a title="lxml.isoschematron.SCHEMATRON_NS" class="py-name" href="#" onclick="return doclink('link-8', 'SCHEMATRON_NS', 'link-5');">SCHEMATRON_NS</a></tt> </tt>
113 <a name="L45"></a><tt class="py-lineno"> 45</tt> <tt class="py-line"><tt id="link-9" class="py-name" targets="Variable lxml.isoschematron._xml_schema_root=lxml.isoschematron-module.html#_xml_schema_root"><a title="lxml.isoschematron._xml_schema_root" class="py-name" href="#" onclick="return doclink('link-9', '_xml_schema_root', 'link-9');">_xml_schema_root</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'{%s}schema'</tt> <tt class="py-op">%</tt> <tt id="link-10" class="py-name"><a title="lxml.isoschematron.XML_SCHEMA_NS
114 lxml.tests.test_objectify.XML_SCHEMA_NS" class="py-name" href="#" onclick="return doclink('link-10', 'XML_SCHEMA_NS', 'link-3');">XML_SCHEMA_NS</a></tt> </tt>
115 <a name="L46"></a><tt class="py-lineno"> 46</tt> <tt class="py-line"><tt id="link-11" class="py-name" targets="Variable lxml.isoschematron._resources_dir=lxml.isoschematron-module.html#_resources_dir"><a title="lxml.isoschematron._resources_dir" class="py-name" href="#" onclick="return doclink('link-11', '_resources_dir', 'link-11');">_resources_dir</a></tt> <tt class="py-op">=</tt> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-12" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-12', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt id="link-13" class="py-name" targets="Method lxml.cssselect.XPathExpr.join()=lxml.cssselect.XPathExpr-class.html#join"><a title="lxml.cssselect.XPathExpr.join" class="py-name" href="#" onclick="return doclink('link-13', 'join', 'link-13');">join</a></tt><tt class="py-op">(</tt><tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-14" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-14', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt class="py-name">dirname</tt><tt class="py-op">(</tt><tt class="py-name">__file__</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-string">'resources'</tt><tt class="py-op">)</tt> </tt>
116 <a name="L47"></a><tt class="py-lineno"> 47</tt> <tt class="py-line"> </tt>
117 <a name="L48"></a><tt class="py-lineno"> 48</tt> <tt class="py-line"> </tt>
118 <a name="L49"></a><tt class="py-lineno"> 49</tt> <tt class="py-line"><tt class="py-comment"># the iso-schematron skeleton implementation steps aka xsl transformations</tt> </tt>
119 <a name="L50"></a><tt class="py-lineno"> 50</tt> <tt class="py-line"><tt id="link-15" class="py-name" targets="Variable lxml.isoschematron.extract_xsd=lxml.isoschematron-module.html#extract_xsd"><a title="lxml.isoschematron.extract_xsd" class="py-name" href="#" onclick="return doclink('link-15', 'extract_xsd', 'link-15');">extract_xsd</a></tt> <tt class="py-op">=</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-16" class="py-name" targets="Variable lxml.etree.ErrorDomains.XSLT=lxml.etree.ErrorDomains-class.html#XSLT,Class lxml.etree.XSLT=lxml.etree.XSLT-class.html"><a title="lxml.etree.ErrorDomains.XSLT
120 lxml.etree.XSLT" class="py-name" href="#" onclick="return doclink('link-16', 'XSLT', 'link-16');">XSLT</a></tt><tt class="py-op">(</tt><tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-17" class="py-name" targets="Function lxml.cssselect.parse()=lxml.cssselect-module.html#parse,Method lxml.etree._ElementTree.parse()=lxml.etree._ElementTree-class.html#parse,Function lxml.etree.parse()=lxml.etree-module.html#parse,Function lxml.html.ElementSoup.parse()=lxml.html.ElementSoup-module.html#parse,Function lxml.html.html5parser.parse()=lxml.html.html5parser-module.html#parse,Function lxml.html.parse()=lxml.html-module.html#parse,Function lxml.html.soupparser.parse()=lxml.html.soupparser-module.html#parse,Function lxml.objectify.parse()=lxml.objectify-module.html#parse,Method lxml.tests.common_imports.HelperTestCase.parse()=lxml.tests.common_imports.HelperTestCase-class.html#parse"><a title="lxml.cssselect.parse
121 lxml.etree._ElementTree.parse
123 lxml.html.ElementSoup.parse
124 lxml.html.html5parser.parse
126 lxml.html.soupparser.parse
128 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-17', 'parse', 'link-17');">parse</a></tt><tt class="py-op">(</tt> </tt>
129 <a name="L51"></a><tt class="py-lineno"> 51</tt> <tt class="py-line"> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-18" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-18', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt id="link-19" class="py-name"><a title="lxml.cssselect.XPathExpr.join" class="py-name" href="#" onclick="return doclink('link-19', 'join', 'link-13');">join</a></tt><tt class="py-op">(</tt><tt id="link-20" class="py-name"><a title="lxml.isoschematron._resources_dir" class="py-name" href="#" onclick="return doclink('link-20', '_resources_dir', 'link-11');">_resources_dir</a></tt><tt class="py-op">,</tt> <tt class="py-string">'xsl'</tt><tt class="py-op">,</tt> <tt class="py-string">'XSD2Schtrn.xsl'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
130 <a name="L52"></a><tt class="py-lineno"> 52</tt> <tt class="py-line"><tt id="link-21" class="py-name" targets="Variable lxml.isoschematron.extract_rng=lxml.isoschematron-module.html#extract_rng"><a title="lxml.isoschematron.extract_rng" class="py-name" href="#" onclick="return doclink('link-21', 'extract_rng', 'link-21');">extract_rng</a></tt> <tt class="py-op">=</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-22" class="py-name"><a title="lxml.etree.ErrorDomains.XSLT
131 lxml.etree.XSLT" class="py-name" href="#" onclick="return doclink('link-22', 'XSLT', 'link-16');">XSLT</a></tt><tt class="py-op">(</tt><tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-23" class="py-name"><a title="lxml.cssselect.parse
132 lxml.etree._ElementTree.parse
134 lxml.html.ElementSoup.parse
135 lxml.html.html5parser.parse
137 lxml.html.soupparser.parse
139 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-23', 'parse', 'link-17');">parse</a></tt><tt class="py-op">(</tt> </tt>
140 <a name="L53"></a><tt class="py-lineno"> 53</tt> <tt class="py-line"> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-24" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-24', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt id="link-25" class="py-name"><a title="lxml.cssselect.XPathExpr.join" class="py-name" href="#" onclick="return doclink('link-25', 'join', 'link-13');">join</a></tt><tt class="py-op">(</tt><tt id="link-26" class="py-name"><a title="lxml.isoschematron._resources_dir" class="py-name" href="#" onclick="return doclink('link-26', '_resources_dir', 'link-11');">_resources_dir</a></tt><tt class="py-op">,</tt> <tt class="py-string">'xsl'</tt><tt class="py-op">,</tt> <tt class="py-string">'RNG2Schtrn.xsl'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
141 <a name="L54"></a><tt class="py-lineno"> 54</tt> <tt class="py-line"><tt id="link-27" class="py-name" targets="Variable lxml.isoschematron.iso_dsdl_include=lxml.isoschematron-module.html#iso_dsdl_include"><a title="lxml.isoschematron.iso_dsdl_include" class="py-name" href="#" onclick="return doclink('link-27', 'iso_dsdl_include', 'link-27');">iso_dsdl_include</a></tt> <tt class="py-op">=</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-28" class="py-name"><a title="lxml.etree.ErrorDomains.XSLT
142 lxml.etree.XSLT" class="py-name" href="#" onclick="return doclink('link-28', 'XSLT', 'link-16');">XSLT</a></tt><tt class="py-op">(</tt><tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-29" class="py-name"><a title="lxml.cssselect.parse
143 lxml.etree._ElementTree.parse
145 lxml.html.ElementSoup.parse
146 lxml.html.html5parser.parse
148 lxml.html.soupparser.parse
150 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-29', 'parse', 'link-17');">parse</a></tt><tt class="py-op">(</tt> </tt>
151 <a name="L55"></a><tt class="py-lineno"> 55</tt> <tt class="py-line"> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-30" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-30', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt id="link-31" class="py-name"><a title="lxml.cssselect.XPathExpr.join" class="py-name" href="#" onclick="return doclink('link-31', 'join', 'link-13');">join</a></tt><tt class="py-op">(</tt><tt id="link-32" class="py-name"><a title="lxml.isoschematron._resources_dir" class="py-name" href="#" onclick="return doclink('link-32', '_resources_dir', 'link-11');">_resources_dir</a></tt><tt class="py-op">,</tt> <tt class="py-string">'xsl'</tt><tt class="py-op">,</tt> <tt class="py-string">'iso-schematron-xslt1'</tt><tt class="py-op">,</tt> </tt>
152 <a name="L56"></a><tt class="py-lineno"> 56</tt> <tt class="py-line"> <tt class="py-string">'iso_dsdl_include.xsl'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
153 <a name="L57"></a><tt class="py-lineno"> 57</tt> <tt class="py-line"><tt id="link-33" class="py-name" targets="Variable lxml.isoschematron.iso_abstract_expand=lxml.isoschematron-module.html#iso_abstract_expand"><a title="lxml.isoschematron.iso_abstract_expand" class="py-name" href="#" onclick="return doclink('link-33', 'iso_abstract_expand', 'link-33');">iso_abstract_expand</a></tt> <tt class="py-op">=</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-34" class="py-name"><a title="lxml.etree.ErrorDomains.XSLT
154 lxml.etree.XSLT" class="py-name" href="#" onclick="return doclink('link-34', 'XSLT', 'link-16');">XSLT</a></tt><tt class="py-op">(</tt><tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-35" class="py-name"><a title="lxml.cssselect.parse
155 lxml.etree._ElementTree.parse
157 lxml.html.ElementSoup.parse
158 lxml.html.html5parser.parse
160 lxml.html.soupparser.parse
162 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-35', 'parse', 'link-17');">parse</a></tt><tt class="py-op">(</tt> </tt>
163 <a name="L58"></a><tt class="py-lineno"> 58</tt> <tt class="py-line"> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-36" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-36', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt id="link-37" class="py-name"><a title="lxml.cssselect.XPathExpr.join" class="py-name" href="#" onclick="return doclink('link-37', 'join', 'link-13');">join</a></tt><tt class="py-op">(</tt><tt id="link-38" class="py-name"><a title="lxml.isoschematron._resources_dir" class="py-name" href="#" onclick="return doclink('link-38', '_resources_dir', 'link-11');">_resources_dir</a></tt><tt class="py-op">,</tt> <tt class="py-string">'xsl'</tt><tt class="py-op">,</tt> <tt class="py-string">'iso-schematron-xslt1'</tt><tt class="py-op">,</tt> </tt>
164 <a name="L59"></a><tt class="py-lineno"> 59</tt> <tt class="py-line"> <tt class="py-string">'iso_abstract_expand.xsl'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
165 <a name="L60"></a><tt class="py-lineno"> 60</tt> <tt class="py-line"><tt id="link-39" class="py-name" targets="Variable lxml.isoschematron.iso_svrl_for_xslt1=lxml.isoschematron-module.html#iso_svrl_for_xslt1"><a title="lxml.isoschematron.iso_svrl_for_xslt1" class="py-name" href="#" onclick="return doclink('link-39', 'iso_svrl_for_xslt1', 'link-39');">iso_svrl_for_xslt1</a></tt> <tt class="py-op">=</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-40" class="py-name"><a title="lxml.etree.ErrorDomains.XSLT
166 lxml.etree.XSLT" class="py-name" href="#" onclick="return doclink('link-40', 'XSLT', 'link-16');">XSLT</a></tt><tt class="py-op">(</tt><tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-41" class="py-name"><a title="lxml.cssselect.parse
167 lxml.etree._ElementTree.parse
169 lxml.html.ElementSoup.parse
170 lxml.html.html5parser.parse
172 lxml.html.soupparser.parse
174 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-41', 'parse', 'link-17');">parse</a></tt><tt class="py-op">(</tt> </tt>
175 <a name="L61"></a><tt class="py-lineno"> 61</tt> <tt class="py-line"> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-42" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-42', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt id="link-43" class="py-name"><a title="lxml.cssselect.XPathExpr.join" class="py-name" href="#" onclick="return doclink('link-43', 'join', 'link-13');">join</a></tt><tt class="py-op">(</tt><tt id="link-44" class="py-name"><a title="lxml.isoschematron._resources_dir" class="py-name" href="#" onclick="return doclink('link-44', '_resources_dir', 'link-11');">_resources_dir</a></tt><tt class="py-op">,</tt> </tt>
176 <a name="L62"></a><tt class="py-lineno"> 62</tt> <tt class="py-line"> <tt class="py-string">'xsl'</tt><tt class="py-op">,</tt> <tt class="py-string">'iso-schematron-xslt1'</tt><tt class="py-op">,</tt> <tt class="py-string">'iso_svrl_for_xslt1.xsl'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
177 <a name="L63"></a><tt class="py-lineno"> 63</tt> <tt class="py-line"> </tt>
178 <a name="L64"></a><tt class="py-lineno"> 64</tt> <tt class="py-line"> </tt>
179 <a name="L65"></a><tt class="py-lineno"> 65</tt> <tt class="py-line"><tt class="py-comment"># svrl result accessors</tt> </tt>
180 <a name="L66"></a><tt class="py-lineno"> 66</tt> <tt class="py-line"><tt id="link-45" class="py-name" targets="Variable lxml.isoschematron.svrl_validation_errors=lxml.isoschematron-module.html#svrl_validation_errors"><a title="lxml.isoschematron.svrl_validation_errors" class="py-name" href="#" onclick="return doclink('link-45', 'svrl_validation_errors', 'link-45');">svrl_validation_errors</a></tt> <tt class="py-op">=</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-46" class="py-name" targets="Class lxml.etree.XPath=lxml.etree.XPath-class.html"><a title="lxml.etree.XPath" class="py-name" href="#" onclick="return doclink('link-46', 'XPath', 'link-46');">XPath</a></tt><tt class="py-op">(</tt> </tt>
181 <a name="L67"></a><tt class="py-lineno"> 67</tt> <tt class="py-line"> <tt class="py-string">'//svrl:failed-assert'</tt><tt class="py-op">,</tt> <tt class="py-name">namespaces</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-string">'svrl'</tt><tt class="py-op">:</tt> <tt id="link-47" class="py-name"><a title="lxml.isoschematron.SVRL_NS" class="py-name" href="#" onclick="return doclink('link-47', 'SVRL_NS', 'link-6');">SVRL_NS</a></tt><tt class="py-op">}</tt><tt class="py-op">)</tt> </tt>
182 <a name="L68"></a><tt class="py-lineno"> 68</tt> <tt class="py-line"> </tt>
183 <a name="L69"></a><tt class="py-lineno"> 69</tt> <tt class="py-line"> </tt>
184 <a name="L70"></a><tt class="py-lineno"> 70</tt> <tt class="py-line"><tt class="py-comment"># RelaxNG validator for schematron schemas</tt> </tt>
185 <a name="L71"></a><tt class="py-lineno"> 71</tt> <tt class="py-line"><tt id="link-48" class="py-name" targets="Variable lxml.isoschematron.schematron_schema_valid=lxml.isoschematron-module.html#schematron_schema_valid"><a title="lxml.isoschematron.schematron_schema_valid" class="py-name" href="#" onclick="return doclink('link-48', 'schematron_schema_valid', 'link-48');">schematron_schema_valid</a></tt> <tt class="py-op">=</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-49" class="py-name" targets="Class lxml.etree.RelaxNG=lxml.etree.RelaxNG-class.html"><a title="lxml.etree.RelaxNG" class="py-name" href="#" onclick="return doclink('link-49', 'RelaxNG', 'link-49');">RelaxNG</a></tt><tt class="py-op">(</tt><tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-50" class="py-name"><a title="lxml.cssselect.parse
186 lxml.etree._ElementTree.parse
188 lxml.html.ElementSoup.parse
189 lxml.html.html5parser.parse
191 lxml.html.soupparser.parse
193 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-50', 'parse', 'link-17');">parse</a></tt><tt class="py-op">(</tt> </tt>
194 <a name="L72"></a><tt class="py-lineno"> 72</tt> <tt class="py-line"> <tt class="py-name">os</tt><tt class="py-op">.</tt><tt id="link-51" class="py-name"><a title="lxml.etree.XPath.path" class="py-name" href="#" onclick="return doclink('link-51', 'path', 'link-0');">path</a></tt><tt class="py-op">.</tt><tt id="link-52" class="py-name"><a title="lxml.cssselect.XPathExpr.join" class="py-name" href="#" onclick="return doclink('link-52', 'join', 'link-13');">join</a></tt><tt class="py-op">(</tt><tt id="link-53" class="py-name"><a title="lxml.isoschematron._resources_dir" class="py-name" href="#" onclick="return doclink('link-53', '_resources_dir', 'link-11');">_resources_dir</a></tt><tt class="py-op">,</tt> <tt class="py-string">'rng'</tt><tt class="py-op">,</tt> <tt class="py-string">'iso-schematron.rng'</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
195 <a name="L73"></a><tt class="py-lineno"> 73</tt> <tt class="py-line"> </tt>
196 <a name="L74"></a><tt class="py-lineno"> 74</tt> <tt class="py-line"> </tt>
197 <a name="stylesheet_params"></a><div id="stylesheet_params-def"><a name="L75"></a><tt class="py-lineno"> 75</tt> <a class="py-toggle" href="#" id="stylesheet_params-toggle" onclick="return toggle('stylesheet_params');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.isoschematron-module.html#stylesheet_params">stylesheet_params</a><tt class="py-op">(</tt><tt class="py-op">**</tt><tt class="py-param">kwargs</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
198 </div><div id="stylesheet_params-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="stylesheet_params-expanded"><a name="L76"></a><tt class="py-lineno"> 76</tt> <tt class="py-line"> <tt class="py-docstring">"""Convert keyword args to a dictionary of stylesheet parameters.</tt> </tt>
199 <a name="L77"></a><tt class="py-lineno"> 77</tt> <tt class="py-line"><tt class="py-docstring"> XSL stylesheet parameters must be XPath expressions, i.e.:</tt> </tt>
200 <a name="L78"></a><tt class="py-lineno"> 78</tt> <tt class="py-line"><tt class="py-docstring"> * string expressions, like "'5'"</tt> </tt>
201 <a name="L79"></a><tt class="py-lineno"> 79</tt> <tt class="py-line"><tt class="py-docstring"> * simple (number) expressions, like "5"</tt> </tt>
202 <a name="L80"></a><tt class="py-lineno"> 80</tt> <tt class="py-line"><tt class="py-docstring"> * valid XPath expressions, like "/a/b/text()"</tt> </tt>
203 <a name="L81"></a><tt class="py-lineno"> 81</tt> <tt class="py-line"><tt class="py-docstring"> This function converts native Python keyword arguments to stylesheet</tt> </tt>
204 <a name="L82"></a><tt class="py-lineno"> 82</tt> <tt class="py-line"><tt class="py-docstring"> parameters following these rules:</tt> </tt>
205 <a name="L83"></a><tt class="py-lineno"> 83</tt> <tt class="py-line"><tt class="py-docstring"> If an arg is a string wrap it with XSLT.strparam().</tt> </tt>
206 <a name="L84"></a><tt class="py-lineno"> 84</tt> <tt class="py-line"><tt class="py-docstring"> If an arg is an XPath object use its path string.</tt> </tt>
207 <a name="L85"></a><tt class="py-lineno"> 85</tt> <tt class="py-line"><tt class="py-docstring"> If arg is None raise TypeError.</tt> </tt>
208 <a name="L86"></a><tt class="py-lineno"> 86</tt> <tt class="py-line"><tt class="py-docstring"> Else convert arg to string.</tt> </tt>
209 <a name="L87"></a><tt class="py-lineno"> 87</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
210 <a name="L88"></a><tt class="py-lineno"> 88</tt> <tt class="py-line"> <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-op">}</tt> </tt>
211 <a name="L89"></a><tt class="py-lineno"> 89</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">key</tt><tt class="py-op">,</tt> <tt class="py-name">val</tt> <tt class="py-keyword">in</tt> <tt class="py-name">kwargs</tt><tt class="py-op">.</tt><tt id="link-54" class="py-name" targets="Method lxml.etree._Attrib.items()=lxml.etree._Attrib-class.html#items,Method lxml.etree._Element.items()=lxml.etree._Element-class.html#items,Method lxml.etree._IDDict.items()=lxml.etree._IDDict-class.html#items,Method lxml.etree._NamespaceRegistry.items()=lxml.etree._NamespaceRegistry-class.html#items,Method lxml.etree._ReadOnlyElementProxy.items()=lxml.etree._ReadOnlyElementProxy-class.html#items,Method lxml.etree.__ContentOnlyElement.items()=lxml.etree.__ContentOnlyElement-class.html#items"><a title="lxml.etree._Attrib.items
212 lxml.etree._Element.items
213 lxml.etree._IDDict.items
214 lxml.etree._NamespaceRegistry.items
215 lxml.etree._ReadOnlyElementProxy.items
216 lxml.etree.__ContentOnlyElement.items" class="py-name" href="#" onclick="return doclink('link-54', 'items', 'link-54');">items</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
217 <a name="L90"></a><tt class="py-lineno"> 90</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">val</tt><tt class="py-op">,</tt> <tt class="py-name">basestring</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
218 <a name="L91"></a><tt class="py-lineno"> 91</tt> <tt class="py-line"> <tt class="py-name">val</tt> <tt class="py-op">=</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-55" class="py-name"><a title="lxml.etree.ErrorDomains.XSLT
219 lxml.etree.XSLT" class="py-name" href="#" onclick="return doclink('link-55', 'XSLT', 'link-16');">XSLT</a></tt><tt class="py-op">.</tt><tt id="link-56" class="py-name" targets="Method lxml.etree.XSLT.strparam()=lxml.etree.XSLT-class.html#strparam"><a title="lxml.etree.XSLT.strparam" class="py-name" href="#" onclick="return doclink('link-56', 'strparam', 'link-56');">strparam</a></tt><tt class="py-op">(</tt><tt class="py-name">val</tt><tt class="py-op">)</tt> </tt>
220 <a name="L92"></a><tt class="py-lineno"> 92</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">val</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
221 <a name="L93"></a><tt class="py-lineno"> 93</tt> <tt class="py-line"> <tt class="py-keyword">raise</tt> <tt class="py-name">TypeError</tt><tt class="py-op">(</tt><tt class="py-string">'None not allowed as a stylesheet parameter'</tt><tt class="py-op">)</tt> </tt>
222 <a name="L94"></a><tt class="py-lineno"> 94</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-keyword">not</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">val</tt><tt class="py-op">,</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-57" class="py-name"><a title="lxml.etree.XPath" class="py-name" href="#" onclick="return doclink('link-57', 'XPath', 'link-46');">XPath</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
223 <a name="L95"></a><tt class="py-lineno"> 95</tt> <tt class="py-line"> <tt class="py-name">val</tt> <tt class="py-op">=</tt> <tt class="py-name">unicode</tt><tt class="py-op">(</tt><tt class="py-name">val</tt><tt class="py-op">)</tt> </tt>
224 <a name="L96"></a><tt class="py-lineno"> 96</tt> <tt class="py-line"> <tt class="py-name">result</tt><tt class="py-op">[</tt><tt class="py-name">key</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">val</tt> </tt>
225 <a name="L97"></a><tt class="py-lineno"> 97</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">result</tt> </tt>
226 </div><a name="L98"></a><tt class="py-lineno"> 98</tt> <tt class="py-line"> </tt>
227 <a name="L99"></a><tt class="py-lineno"> 99</tt> <tt class="py-line"> </tt>
228 <a name="L100"></a><tt class="py-lineno">100</tt> <tt class="py-line"><tt class="py-comment"># helper function for use in Schematron __init__</tt> </tt>
229 <a name="_stylesheet_param_dict"></a><div id="_stylesheet_param_dict-def"><a name="L101"></a><tt class="py-lineno">101</tt> <a class="py-toggle" href="#" id="_stylesheet_param_dict-toggle" onclick="return toggle('_stylesheet_param_dict');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.isoschematron-module.html#_stylesheet_param_dict">_stylesheet_param_dict</a><tt class="py-op">(</tt><tt class="py-param">paramsDict</tt><tt class="py-op">,</tt> <tt class="py-param">kwargsDict</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
230 </div><div id="_stylesheet_param_dict-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_stylesheet_param_dict-expanded"><a name="L102"></a><tt class="py-lineno">102</tt> <tt class="py-line"> <tt class="py-docstring">"""Return a copy of paramsDict, updated with kwargsDict entries, wrapped as</tt> </tt>
231 <a name="L103"></a><tt class="py-lineno">103</tt> <tt class="py-line"><tt class="py-docstring"> stylesheet arguments.</tt> </tt>
232 <a name="L104"></a><tt class="py-lineno">104</tt> <tt class="py-line"><tt class="py-docstring"> kwargsDict entries with a value of None are ignored.</tt> </tt>
233 <a name="L105"></a><tt class="py-lineno">105</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
234 <a name="L106"></a><tt class="py-lineno">106</tt> <tt class="py-line"> <tt class="py-comment"># beware of changing mutable default arg</tt> </tt>
235 <a name="L107"></a><tt class="py-lineno">107</tt> <tt class="py-line"> <tt class="py-name">paramsDict</tt> <tt class="py-op">=</tt> <tt class="py-name">dict</tt><tt class="py-op">(</tt><tt class="py-name">paramsDict</tt><tt class="py-op">)</tt> </tt>
236 <a name="L108"></a><tt class="py-lineno">108</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">k</tt><tt class="py-op">,</tt> <tt id="link-58" class="py-name" targets="Variable lxml.tests.test_objectify.v=lxml.tests.test_objectify-module.html#v"><a title="lxml.tests.test_objectify.v" class="py-name" href="#" onclick="return doclink('link-58', 'v', 'link-58');">v</a></tt> <tt class="py-keyword">in</tt> <tt class="py-name">kwargsDict</tt><tt class="py-op">.</tt><tt id="link-59" class="py-name"><a title="lxml.etree._Attrib.items
237 lxml.etree._Element.items
238 lxml.etree._IDDict.items
239 lxml.etree._NamespaceRegistry.items
240 lxml.etree._ReadOnlyElementProxy.items
241 lxml.etree.__ContentOnlyElement.items" class="py-name" href="#" onclick="return doclink('link-59', 'items', 'link-54');">items</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
242 <a name="L109"></a><tt class="py-lineno">109</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt id="link-60" class="py-name"><a title="lxml.tests.test_objectify.v" class="py-name" href="#" onclick="return doclink('link-60', 'v', 'link-58');">v</a></tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> <tt class="py-comment"># None values do not override</tt> </tt>
243 <a name="L110"></a><tt class="py-lineno">110</tt> <tt class="py-line"> <tt class="py-name">paramsDict</tt><tt class="py-op">[</tt><tt class="py-name">k</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt id="link-61" class="py-name"><a title="lxml.tests.test_objectify.v" class="py-name" href="#" onclick="return doclink('link-61', 'v', 'link-58');">v</a></tt> </tt>
244 <a name="L111"></a><tt class="py-lineno">111</tt> <tt class="py-line"> <tt class="py-name">paramsDict</tt> <tt class="py-op">=</tt> <tt id="link-62" class="py-name" targets="Function lxml.isoschematron.stylesheet_params()=lxml.isoschematron-module.html#stylesheet_params"><a title="lxml.isoschematron.stylesheet_params" class="py-name" href="#" onclick="return doclink('link-62', 'stylesheet_params', 'link-62');">stylesheet_params</a></tt><tt class="py-op">(</tt><tt class="py-op">**</tt><tt class="py-name">paramsDict</tt><tt class="py-op">)</tt> </tt>
245 <a name="L112"></a><tt class="py-lineno">112</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">paramsDict</tt> </tt>
246 </div><a name="L113"></a><tt class="py-lineno">113</tt> <tt class="py-line"> </tt>
247 <a name="L114"></a><tt class="py-lineno">114</tt> <tt class="py-line"> </tt>
248 <a name="Schematron"></a><div id="Schematron-def"><a name="L115"></a><tt class="py-lineno">115</tt> <a class="py-toggle" href="#" id="Schematron-toggle" onclick="return toggle('Schematron');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="lxml.isoschematron.Schematron-class.html">Schematron</a><tt class="py-op">(</tt><tt class="py-base-class">_etree</tt><tt class="py-op">.</tt><tt class="py-base-class">_Validator</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
249 </div><div id="Schematron-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Schematron-expanded"><a name="L116"></a><tt class="py-lineno">116</tt> <tt class="py-line"> <tt class="py-docstring">"""An ISO Schematron validator.</tt> </tt>
250 <a name="L117"></a><tt class="py-lineno">117</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
251 <a name="L118"></a><tt class="py-lineno">118</tt> <tt class="py-line"><tt class="py-docstring"> Pass a root Element or an ElementTree to turn it into a validator.</tt> </tt>
252 <a name="L119"></a><tt class="py-lineno">119</tt> <tt class="py-line"><tt class="py-docstring"> Alternatively, pass a filename as keyword argument 'file' to parse from</tt> </tt>
253 <a name="L120"></a><tt class="py-lineno">120</tt> <tt class="py-line"><tt class="py-docstring"> the file system.</tt> </tt>
254 <a name="L121"></a><tt class="py-lineno">121</tt> <tt class="py-line"><tt class="py-docstring"> Built on the Schematron language 'reference' skeleton pure-xslt</tt> </tt>
255 <a name="L122"></a><tt class="py-lineno">122</tt> <tt class="py-line"><tt class="py-docstring"> implementation, the validator is created as an XSLT 1.0 stylesheet using</tt> </tt>
256 <a name="L123"></a><tt class="py-lineno">123</tt> <tt class="py-line"><tt class="py-docstring"> these steps:</tt> </tt>
257 <a name="L124"></a><tt class="py-lineno">124</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
258 <a name="L125"></a><tt class="py-lineno">125</tt> <tt class="py-line"><tt class="py-docstring"> 0) (Extract from XML Schema or RelaxNG schema)</tt> </tt>
259 <a name="L126"></a><tt class="py-lineno">126</tt> <tt class="py-line"><tt class="py-docstring"> 1) Process inclusions</tt> </tt>
260 <a name="L127"></a><tt class="py-lineno">127</tt> <tt class="py-line"><tt class="py-docstring"> 2) Process abstract patterns</tt> </tt>
261 <a name="L128"></a><tt class="py-lineno">128</tt> <tt class="py-line"><tt class="py-docstring"> 3) Compile the schematron schema to XSLT</tt> </tt>
262 <a name="L129"></a><tt class="py-lineno">129</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
263 <a name="L130"></a><tt class="py-lineno">130</tt> <tt class="py-line"><tt class="py-docstring"> The ``include`` and ``expand`` keyword arguments can be used to switch off</tt> </tt>
264 <a name="L131"></a><tt class="py-lineno">131</tt> <tt class="py-line"><tt class="py-docstring"> steps 1) and 2).</tt> </tt>
265 <a name="L132"></a><tt class="py-lineno">132</tt> <tt class="py-line"><tt class="py-docstring"> To set parameters for steps 1), 2) and 3) hand parameter dictionaries to the</tt> </tt>
266 <a name="L133"></a><tt class="py-lineno">133</tt> <tt class="py-line"><tt class="py-docstring"> keyword arguments ``include_params``, ``expand_params`` or</tt> </tt>
267 <a name="L134"></a><tt class="py-lineno">134</tt> <tt class="py-line"><tt class="py-docstring"> ``compile_params``.</tt> </tt>
268 <a name="L135"></a><tt class="py-lineno">135</tt> <tt class="py-line"><tt class="py-docstring"> For convenience, the compile-step parameter ``phase`` is also exposed as a</tt> </tt>
269 <a name="L136"></a><tt class="py-lineno">136</tt> <tt class="py-line"><tt class="py-docstring"> keyword argument ``phase``. This takes precedence if the parameter is also</tt> </tt>
270 <a name="L137"></a><tt class="py-lineno">137</tt> <tt class="py-line"><tt class="py-docstring"> given in the parameter dictionary.</tt> </tt>
271 <a name="L138"></a><tt class="py-lineno">138</tt> <tt class="py-line"><tt class="py-docstring"> If ``store_schematron`` is set to True, the (included-and-expanded)</tt> </tt>
272 <a name="L139"></a><tt class="py-lineno">139</tt> <tt class="py-line"><tt class="py-docstring"> schematron document tree is stored and available through the ``schematron``</tt> </tt>
273 <a name="L140"></a><tt class="py-lineno">140</tt> <tt class="py-line"><tt class="py-docstring"> property.</tt> </tt>
274 <a name="L141"></a><tt class="py-lineno">141</tt> <tt class="py-line"><tt class="py-docstring"> If ``store_xslt`` is set to True, the validation XSLT document tree will be</tt> </tt>
275 <a name="L142"></a><tt class="py-lineno">142</tt> <tt class="py-line"><tt class="py-docstring"> stored and can be retrieved through the ``validator_xslt`` property.</tt> </tt>
276 <a name="L143"></a><tt class="py-lineno">143</tt> <tt class="py-line"><tt class="py-docstring"> With ``store_report`` set to True (default: False), the resulting validation</tt> </tt>
277 <a name="L144"></a><tt class="py-lineno">144</tt> <tt class="py-line"><tt class="py-docstring"> report document gets stored and can be accessed as the ``validation_report``</tt> </tt>
278 <a name="L145"></a><tt class="py-lineno">145</tt> <tt class="py-line"><tt class="py-docstring"> property.</tt> </tt>
279 <a name="L146"></a><tt class="py-lineno">146</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
280 <a name="L147"></a><tt class="py-lineno">147</tt> <tt class="py-line"><tt class="py-docstring"> Schematron is a less well known, but very powerful schema language. The main</tt> </tt>
281 <a name="L148"></a><tt class="py-lineno">148</tt> <tt class="py-line"><tt class="py-docstring"> idea is to use the capabilities of XPath to put restrictions on the structure</tt> </tt>
282 <a name="L149"></a><tt class="py-lineno">149</tt> <tt class="py-line"><tt class="py-docstring"> and the content of XML documents. Here is a simple example::</tt> </tt>
283 <a name="L150"></a><tt class="py-lineno">150</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
284 <a name="L151"></a><tt class="py-lineno">151</tt> <tt class="py-line"><tt class="py-docstring"> >>> from lxml import isoschematron</tt> </tt>
285 <a name="L152"></a><tt class="py-lineno">152</tt> <tt class="py-line"><tt class="py-docstring"> >>> schematron = isoschematron.Schematron(etree.XML('''</tt> </tt>
286 <a name="L153"></a><tt class="py-lineno">153</tt> <tt class="py-line"><tt class="py-docstring"> ... <schema xmlns="http://purl.oclc.org/dsdl/schematron" ></tt> </tt>
287 <a name="L154"></a><tt class="py-lineno">154</tt> <tt class="py-line"><tt class="py-docstring"> ... <pattern id="id_only_attribute"></tt> </tt>
288 <a name="L155"></a><tt class="py-lineno">155</tt> <tt class="py-line"><tt class="py-docstring"> ... <title>id is the only permitted attribute name</title></tt> </tt>
289 <a name="L156"></a><tt class="py-lineno">156</tt> <tt class="py-line"><tt class="py-docstring"> ... <rule context="*"></tt> </tt>
290 <a name="L157"></a><tt class="py-lineno">157</tt> <tt class="py-line"><tt class="py-docstring"> ... <report test="@*[not(name()='id')]">Attribute</tt> </tt>
291 <a name="L158"></a><tt class="py-lineno">158</tt> <tt class="py-line"><tt class="py-docstring"> ... <name path="@*[not(name()='id')]"/> is forbidden<name/></tt> </tt>
292 <a name="L159"></a><tt class="py-lineno">159</tt> <tt class="py-line"><tt class="py-docstring"> ... </report></tt> </tt>
293 <a name="L160"></a><tt class="py-lineno">160</tt> <tt class="py-line"><tt class="py-docstring"> ... </rule></tt> </tt>
294 <a name="L161"></a><tt class="py-lineno">161</tt> <tt class="py-line"><tt class="py-docstring"> ... </pattern></tt> </tt>
295 <a name="L162"></a><tt class="py-lineno">162</tt> <tt class="py-line"><tt class="py-docstring"> ... </schema></tt> </tt>
296 <a name="L163"></a><tt class="py-lineno">163</tt> <tt class="py-line"><tt class="py-docstring"> ... '''))</tt> </tt>
297 <a name="L164"></a><tt class="py-lineno">164</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
298 <a name="L165"></a><tt class="py-lineno">165</tt> <tt class="py-line"><tt class="py-docstring"> >>> xml = etree.XML('''</tt> </tt>
299 <a name="L166"></a><tt class="py-lineno">166</tt> <tt class="py-line"><tt class="py-docstring"> ... <AAA name="aaa"></tt> </tt>
300 <a name="L167"></a><tt class="py-lineno">167</tt> <tt class="py-line"><tt class="py-docstring"> ... <BBB id="bbb"/></tt> </tt>
301 <a name="L168"></a><tt class="py-lineno">168</tt> <tt class="py-line"><tt class="py-docstring"> ... <CCC color="ccc"/></tt> </tt>
302 <a name="L169"></a><tt class="py-lineno">169</tt> <tt class="py-line"><tt class="py-docstring"> ... </AAA></tt> </tt>
303 <a name="L170"></a><tt class="py-lineno">170</tt> <tt class="py-line"><tt class="py-docstring"> ... ''')</tt> </tt>
304 <a name="L171"></a><tt class="py-lineno">171</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
305 <a name="L172"></a><tt class="py-lineno">172</tt> <tt class="py-line"><tt class="py-docstring"> >>> schematron.validate(xml)</tt> </tt>
306 <a name="L173"></a><tt class="py-lineno">173</tt> <tt class="py-line"><tt class="py-docstring"> 0</tt> </tt>
307 <a name="L174"></a><tt class="py-lineno">174</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
308 <a name="L175"></a><tt class="py-lineno">175</tt> <tt class="py-line"><tt class="py-docstring"> >>> xml = etree.XML('''</tt> </tt>
309 <a name="L176"></a><tt class="py-lineno">176</tt> <tt class="py-line"><tt class="py-docstring"> ... <AAA id="aaa"></tt> </tt>
310 <a name="L177"></a><tt class="py-lineno">177</tt> <tt class="py-line"><tt class="py-docstring"> ... <BBB id="bbb"/></tt> </tt>
311 <a name="L178"></a><tt class="py-lineno">178</tt> <tt class="py-line"><tt class="py-docstring"> ... <CCC/></tt> </tt>
312 <a name="L179"></a><tt class="py-lineno">179</tt> <tt class="py-line"><tt class="py-docstring"> ... </AAA></tt> </tt>
313 <a name="L180"></a><tt class="py-lineno">180</tt> <tt class="py-line"><tt class="py-docstring"> ... ''')</tt> </tt>
314 <a name="L181"></a><tt class="py-lineno">181</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
315 <a name="L182"></a><tt class="py-lineno">182</tt> <tt class="py-line"><tt class="py-docstring"> >>> schematron.validate(xml)</tt> </tt>
316 <a name="L183"></a><tt class="py-lineno">183</tt> <tt class="py-line"><tt class="py-docstring"> 1</tt> </tt>
317 <a name="L184"></a><tt class="py-lineno">184</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
318 <a name="L185"></a><tt class="py-lineno">185</tt> <tt class="py-line"> </tt>
319 <a name="L186"></a><tt class="py-lineno">186</tt> <tt class="py-line"> <tt class="py-comment"># libxml2 error categorization for validation errors</tt> </tt>
320 <a name="L187"></a><tt class="py-lineno">187</tt> <tt class="py-line"> <tt id="link-63" class="py-name" targets="Variable lxml.isoschematron.Schematron._domain=lxml.isoschematron.Schematron-class.html#_domain"><a title="lxml.isoschematron.Schematron._domain" class="py-name" href="#" onclick="return doclink('link-63', '_domain', 'link-63');">_domain</a></tt> <tt class="py-op">=</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-64" class="py-name" targets="Class lxml.etree.ErrorDomains=lxml.etree.ErrorDomains-class.html"><a title="lxml.etree.ErrorDomains" class="py-name" href="#" onclick="return doclink('link-64', 'ErrorDomains', 'link-64');">ErrorDomains</a></tt><tt class="py-op">.</tt><tt id="link-65" class="py-name" targets="Variable lxml.etree.ErrorDomains.SCHEMATRONV=lxml.etree.ErrorDomains-class.html#SCHEMATRONV"><a title="lxml.etree.ErrorDomains.SCHEMATRONV" class="py-name" href="#" onclick="return doclink('link-65', 'SCHEMATRONV', 'link-65');">SCHEMATRONV</a></tt> </tt>
321 <a name="L188"></a><tt class="py-lineno">188</tt> <tt class="py-line"> <tt id="link-66" class="py-name" targets="Variable lxml.isoschematron.Schematron._level=lxml.isoschematron.Schematron-class.html#_level"><a title="lxml.isoschematron.Schematron._level" class="py-name" href="#" onclick="return doclink('link-66', '_level', 'link-66');">_level</a></tt> <tt class="py-op">=</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-67" class="py-name" targets="Class lxml.etree.ErrorLevels=lxml.etree.ErrorLevels-class.html"><a title="lxml.etree.ErrorLevels" class="py-name" href="#" onclick="return doclink('link-67', 'ErrorLevels', 'link-67');">ErrorLevels</a></tt><tt class="py-op">.</tt><tt id="link-68" class="py-name" targets="Variable lxml.etree.ErrorLevels.ERROR=lxml.etree.ErrorLevels-class.html#ERROR"><a title="lxml.etree.ErrorLevels.ERROR" class="py-name" href="#" onclick="return doclink('link-68', 'ERROR', 'link-68');">ERROR</a></tt> </tt>
322 <a name="L189"></a><tt class="py-lineno">189</tt> <tt class="py-line"> <tt id="link-69" class="py-name" targets="Variable lxml.isoschematron.Schematron._error_type=lxml.isoschematron.Schematron-class.html#_error_type"><a title="lxml.isoschematron.Schematron._error_type" class="py-name" href="#" onclick="return doclink('link-69', '_error_type', 'link-69');">_error_type</a></tt> <tt class="py-op">=</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-70" class="py-name" targets="Class lxml.etree.ErrorTypes=lxml.etree.ErrorTypes-class.html"><a title="lxml.etree.ErrorTypes" class="py-name" href="#" onclick="return doclink('link-70', 'ErrorTypes', 'link-70');">ErrorTypes</a></tt><tt class="py-op">.</tt><tt id="link-71" class="py-name" targets="Variable lxml.etree.ErrorTypes.SCHEMATRONV_ASSERT=lxml.etree.ErrorTypes-class.html#SCHEMATRONV_ASSERT"><a title="lxml.etree.ErrorTypes.SCHEMATRONV_ASSERT" class="py-name" href="#" onclick="return doclink('link-71', 'SCHEMATRONV_ASSERT', 'link-71');">SCHEMATRONV_ASSERT</a></tt> </tt>
323 <a name="L190"></a><tt class="py-lineno">190</tt> <tt class="py-line"> </tt>
324 <a name="Schematron._extract"></a><div id="Schematron._extract-def"><a name="L191"></a><tt class="py-lineno">191</tt> <a class="py-toggle" href="#" id="Schematron._extract-toggle" onclick="return toggle('Schematron._extract');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.isoschematron.Schematron-class.html#_extract">_extract</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">element</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
325 </div><div id="Schematron._extract-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Schematron._extract-expanded"><a name="L192"></a><tt class="py-lineno">192</tt> <tt class="py-line"> <tt class="py-docstring">"""Extract embedded schematron schema from non-schematron host schema.</tt> </tt>
326 <a name="L193"></a><tt class="py-lineno">193</tt> <tt class="py-line"><tt class="py-docstring"> This method will only be called by __init__ if the given schema document</tt> </tt>
327 <a name="L194"></a><tt class="py-lineno">194</tt> <tt class="py-line"><tt class="py-docstring"> is not a schematron schema by itself.</tt> </tt>
328 <a name="L195"></a><tt class="py-lineno">195</tt> <tt class="py-line"><tt class="py-docstring"> Must return a schematron schema document tree or None.</tt> </tt>
329 <a name="L196"></a><tt class="py-lineno">196</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
330 <a name="L197"></a><tt class="py-lineno">197</tt> <tt class="py-line"> <tt id="link-72" class="py-name" targets="Variable lxml.isoschematron.Schematron.schematron=lxml.isoschematron.Schematron-class.html#schematron"><a title="lxml.isoschematron.Schematron.schematron" class="py-name" href="#" onclick="return doclink('link-72', 'schematron', 'link-72');">schematron</a></tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
331 <a name="L198"></a><tt class="py-lineno">198</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">element</tt><tt class="py-op">.</tt><tt id="link-73" class="py-name" targets="Variable lxml.etree._Comment.tag=lxml.etree._Comment-class.html#tag,Variable lxml.etree._Element.tag=lxml.etree._Element-class.html#tag,Variable lxml.etree._Entity.tag=lxml.etree._Entity-class.html#tag,Variable lxml.etree._ProcessingInstruction.tag=lxml.etree._ProcessingInstruction-class.html#tag,Variable lxml.etree._ReadOnlyProxy.tag=lxml.etree._ReadOnlyProxy-class.html#tag,Function lxml.tests.test_xpathevaluator.tag()=lxml.tests.test_xpathevaluator-module.html#tag,Variable xml.etree.ElementTree.Element.tag=xml.etree.ElementTree.Element-class.html#tag"><a title="lxml.etree._Comment.tag
332 lxml.etree._Element.tag
333 lxml.etree._Entity.tag
334 lxml.etree._ProcessingInstruction.tag
335 lxml.etree._ReadOnlyProxy.tag
336 lxml.tests.test_xpathevaluator.tag
337 xml.etree.ElementTree.Element.tag" class="py-name" href="#" onclick="return doclink('link-73', 'tag', 'link-73');">tag</a></tt> <tt class="py-op">==</tt> <tt id="link-74" class="py-name"><a title="lxml.isoschematron._xml_schema_root" class="py-name" href="#" onclick="return doclink('link-74', '_xml_schema_root', 'link-9');">_xml_schema_root</a></tt><tt class="py-op">:</tt> </tt>
338 <a name="L199"></a><tt class="py-lineno">199</tt> <tt class="py-line"> <tt id="link-75" class="py-name"><a title="lxml.isoschematron.Schematron.schematron" class="py-name" href="#" onclick="return doclink('link-75', 'schematron', 'link-72');">schematron</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-76" class="py-name" targets="Variable lxml.isoschematron.Schematron._extract_xsd=lxml.isoschematron.Schematron-class.html#_extract_xsd"><a title="lxml.isoschematron.Schematron._extract_xsd" class="py-name" href="#" onclick="return doclink('link-76', '_extract_xsd', 'link-76');">_extract_xsd</a></tt><tt class="py-op">(</tt><tt class="py-name">element</tt><tt class="py-op">)</tt> </tt>
339 <a name="L200"></a><tt class="py-lineno">200</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">element</tt><tt class="py-op">.</tt><tt id="link-77" class="py-name" targets="Variable lxml.etree._Element.nsmap=lxml.etree._Element-class.html#nsmap"><a title="lxml.etree._Element.nsmap" class="py-name" href="#" onclick="return doclink('link-77', 'nsmap', 'link-77');">nsmap</a></tt><tt class="py-op">[</tt><tt class="py-name">element</tt><tt class="py-op">.</tt><tt id="link-78" class="py-name" targets="Variable lxml.etree._Element.prefix=lxml.etree._Element-class.html#prefix,Variable lxml.etree._ReadOnlyElementProxy.prefix=lxml.etree._ReadOnlyElementProxy-class.html#prefix,Variable lxml.etree._XPathFunctionNamespaceRegistry.prefix=lxml.etree._XPathFunctionNamespaceRegistry-class.html#prefix"><a title="lxml.etree._Element.prefix
340 lxml.etree._ReadOnlyElementProxy.prefix
341 lxml.etree._XPathFunctionNamespaceRegistry.prefix" class="py-name" href="#" onclick="return doclink('link-78', 'prefix', 'link-78');">prefix</a></tt><tt class="py-op">]</tt> <tt class="py-op">==</tt> <tt id="link-79" class="py-name"><a title="lxml.isoschematron.RELAXNG_NS" class="py-name" href="#" onclick="return doclink('link-79', 'RELAXNG_NS', 'link-4');">RELAXNG_NS</a></tt><tt class="py-op">:</tt> </tt>
342 <a name="L201"></a><tt class="py-lineno">201</tt> <tt class="py-line"> <tt class="py-comment"># RelaxNG does not have a single unique root element</tt> </tt>
343 <a name="L202"></a><tt class="py-lineno">202</tt> <tt class="py-line"> <tt id="link-80" class="py-name"><a title="lxml.isoschematron.Schematron.schematron" class="py-name" href="#" onclick="return doclink('link-80', 'schematron', 'link-72');">schematron</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-81" class="py-name" targets="Variable lxml.isoschematron.Schematron._extract_rng=lxml.isoschematron.Schematron-class.html#_extract_rng"><a title="lxml.isoschematron.Schematron._extract_rng" class="py-name" href="#" onclick="return doclink('link-81', '_extract_rng', 'link-81');">_extract_rng</a></tt><tt class="py-op">(</tt><tt class="py-name">element</tt><tt class="py-op">)</tt> </tt>
344 <a name="L203"></a><tt class="py-lineno">203</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt id="link-82" class="py-name"><a title="lxml.isoschematron.Schematron.schematron" class="py-name" href="#" onclick="return doclink('link-82', 'schematron', 'link-72');">schematron</a></tt> </tt>
345 </div><a name="L204"></a><tt class="py-lineno">204</tt> <tt class="py-line"> </tt>
346 <a name="L205"></a><tt class="py-lineno">205</tt> <tt class="py-line"> <tt class="py-comment"># customization points</tt> </tt>
347 <a name="L206"></a><tt class="py-lineno">206</tt> <tt class="py-line"> <tt class="py-comment"># etree.XSLT objects that provide the extract, include, expand, compile</tt> </tt>
348 <a name="L207"></a><tt class="py-lineno">207</tt> <tt class="py-line"> <tt class="py-comment"># steps</tt> </tt>
349 <a name="L208"></a><tt class="py-lineno">208</tt> <tt class="py-line"> <tt id="link-83" class="py-name"><a title="lxml.isoschematron.Schematron._extract_xsd" class="py-name" href="#" onclick="return doclink('link-83', '_extract_xsd', 'link-76');">_extract_xsd</a></tt> <tt class="py-op">=</tt> <tt id="link-84" class="py-name"><a title="lxml.isoschematron.extract_xsd" class="py-name" href="#" onclick="return doclink('link-84', 'extract_xsd', 'link-15');">extract_xsd</a></tt> </tt>
350 <a name="L209"></a><tt class="py-lineno">209</tt> <tt class="py-line"> <tt id="link-85" class="py-name"><a title="lxml.isoschematron.Schematron._extract_rng" class="py-name" href="#" onclick="return doclink('link-85', '_extract_rng', 'link-81');">_extract_rng</a></tt> <tt class="py-op">=</tt> <tt id="link-86" class="py-name"><a title="lxml.isoschematron.extract_rng" class="py-name" href="#" onclick="return doclink('link-86', 'extract_rng', 'link-21');">extract_rng</a></tt> </tt>
351 <a name="L210"></a><tt class="py-lineno">210</tt> <tt class="py-line"> <tt id="link-87" class="py-name" targets="Function lxml.ElementInclude._include()=lxml.ElementInclude-module.html#_include,Variable lxml.isoschematron.Schematron._include=lxml.isoschematron.Schematron-class.html#_include"><a title="lxml.ElementInclude._include
352 lxml.isoschematron.Schematron._include" class="py-name" href="#" onclick="return doclink('link-87', '_include', 'link-87');">_include</a></tt> <tt class="py-op">=</tt> <tt id="link-88" class="py-name"><a title="lxml.isoschematron.iso_dsdl_include" class="py-name" href="#" onclick="return doclink('link-88', 'iso_dsdl_include', 'link-27');">iso_dsdl_include</a></tt> </tt>
353 <a name="L211"></a><tt class="py-lineno">211</tt> <tt class="py-line"> <tt id="link-89" class="py-name" targets="Variable lxml.isoschematron.Schematron._expand=lxml.isoschematron.Schematron-class.html#_expand"><a title="lxml.isoschematron.Schematron._expand" class="py-name" href="#" onclick="return doclink('link-89', '_expand', 'link-89');">_expand</a></tt> <tt class="py-op">=</tt> <tt id="link-90" class="py-name"><a title="lxml.isoschematron.iso_abstract_expand" class="py-name" href="#" onclick="return doclink('link-90', 'iso_abstract_expand', 'link-33');">iso_abstract_expand</a></tt> </tt>
354 <a name="L212"></a><tt class="py-lineno">212</tt> <tt class="py-line"> <tt id="link-91" class="py-name" targets="Variable lxml.isoschematron.Schematron._compile=lxml.isoschematron.Schematron-class.html#_compile"><a title="lxml.isoschematron.Schematron._compile" class="py-name" href="#" onclick="return doclink('link-91', '_compile', 'link-91');">_compile</a></tt> <tt class="py-op">=</tt> <tt id="link-92" class="py-name"><a title="lxml.isoschematron.iso_svrl_for_xslt1" class="py-name" href="#" onclick="return doclink('link-92', 'iso_svrl_for_xslt1', 'link-39');">iso_svrl_for_xslt1</a></tt> </tt>
355 <a name="L213"></a><tt class="py-lineno">213</tt> <tt class="py-line"> <tt class="py-comment"># etree.XPath object that determines input document validity when applied to</tt> </tt>
356 <a name="L214"></a><tt class="py-lineno">214</tt> <tt class="py-line"> <tt class="py-comment"># the svrl result report; must return a list of result elements (empty if</tt> </tt>
357 <a name="L215"></a><tt class="py-lineno">215</tt> <tt class="py-line"> <tt class="py-comment"># valid)</tt> </tt>
358 <a name="L216"></a><tt class="py-lineno">216</tt> <tt class="py-line"> <tt id="link-93" class="py-name" targets="Variable lxml.isoschematron.Schematron._validation_errors=lxml.isoschematron.Schematron-class.html#_validation_errors"><a title="lxml.isoschematron.Schematron._validation_errors" class="py-name" href="#" onclick="return doclink('link-93', '_validation_errors', 'link-93');">_validation_errors</a></tt> <tt class="py-op">=</tt> <tt id="link-94" class="py-name"><a title="lxml.isoschematron.svrl_validation_errors" class="py-name" href="#" onclick="return doclink('link-94', 'svrl_validation_errors', 'link-45');">svrl_validation_errors</a></tt> </tt>
359 <a name="L217"></a><tt class="py-lineno">217</tt> <tt class="py-line"> </tt>
360 <a name="Schematron.__init__"></a><div id="Schematron.__init__-def"><a name="L218"></a><tt class="py-lineno">218</tt> <a class="py-toggle" href="#" id="Schematron.__init__-toggle" onclick="return toggle('Schematron.__init__');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.isoschematron.Schematron-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">etree</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">file</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">include</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">,</tt> <tt class="py-param">expand</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">,</tt> </tt>
361 <a name="L219"></a><tt class="py-lineno">219</tt> <tt class="py-line"> <tt class="py-param">include_params</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">,</tt> <tt class="py-param">expand_params</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">,</tt> <tt class="py-param">compile_params</tt><tt class="py-op">=</tt><tt class="py-op">{</tt><tt class="py-op">}</tt><tt class="py-op">,</tt> </tt>
362 <a name="L220"></a><tt class="py-lineno">220</tt> <tt class="py-line"> <tt class="py-param">store_schematron</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-param">store_xslt</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> <tt class="py-param">store_report</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">,</tt> </tt>
363 <a name="L221"></a><tt class="py-lineno">221</tt> <tt class="py-line"> <tt class="py-param">phase</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
364 </div><div id="Schematron.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Schematron.__init__-expanded"><a name="L222"></a><tt class="py-lineno">222</tt> <tt class="py-line"> <tt class="py-name">super</tt><tt class="py-op">(</tt><tt id="link-95" class="py-name" targets="Class lxml.etree.Schematron=lxml.etree.Schematron-class.html,Class lxml.isoschematron.Schematron=lxml.isoschematron.Schematron-class.html"><a title="lxml.etree.Schematron
365 lxml.isoschematron.Schematron" class="py-name" href="#" onclick="return doclink('link-95', 'Schematron', 'link-95');">Schematron</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-96" class="py-name" targets="Method lxml.builder.ElementMaker.__init__()=lxml.builder.ElementMaker-class.html#__init__,Method lxml.cssselect.Attrib.__init__()=lxml.cssselect.Attrib-class.html#__init__,Method lxml.cssselect.CSSSelector.__init__()=lxml.cssselect.CSSSelector-class.html#__init__,Method lxml.cssselect.Class.__init__()=lxml.cssselect.Class-class.html#__init__,Method lxml.cssselect.CombinedSelector.__init__()=lxml.cssselect.CombinedSelector-class.html#__init__,Method lxml.cssselect.Element.__init__()=lxml.cssselect.Element-class.html#__init__,Method lxml.cssselect.Function.__init__()=lxml.cssselect.Function-class.html#__init__,Method lxml.cssselect.Hash.__init__()=lxml.cssselect.Hash-class.html#__init__,Method lxml.cssselect.Or.__init__()=lxml.cssselect.Or-class.html#__init__,Method lxml.cssselect.Pseudo.__init__()=lxml.cssselect.Pseudo-class.html#__init__,Method lxml.cssselect.TokenStream.__init__()=lxml.cssselect.TokenStream-class.html#__init__,Method lxml.cssselect.XPathExpr.__init__()=lxml.cssselect.XPathExpr-class.html#__init__,Method lxml.cssselect.XPathExprOr.__init__()=lxml.cssselect.XPathExprOr-class.html#__init__,Method lxml.doctestcompare._RestoreChecker.__init__()=lxml.doctestcompare._RestoreChecker-class.html#__init__,Method lxml.etree.AttributeBasedElementClassLookup.__init__()=lxml.etree.AttributeBasedElementClassLookup-class.html#__init__,Method lxml.etree.CDATA.__init__()=lxml.etree.CDATA-class.html#__init__,Method lxml.etree.CommentBase.__init__()=lxml.etree.CommentBase-class.html#__init__,Method lxml.etree.DTD.__init__()=lxml.etree.DTD-class.html#__init__,Method lxml.etree.ETCompatXMLParser.__init__()=lxml.etree.ETCompatXMLParser-class.html#__init__,Method lxml.etree.ETXPath.__init__()=lxml.etree.ETXPath-class.html#__init__,Method lxml.etree.ElementBase.__init__()=lxml.etree.ElementBase-class.html#__init__,Method lxml.etree.ElementDefaultClassLookup.__init__()=lxml.etree.ElementDefaultClassLookup-class.html#__init__,Method lxml.etree.ElementNamespaceClassLookup.__init__()=lxml.etree.ElementNamespaceClassLookup-class.html#__init__,Method lxml.etree.EntityBase.__init__()=lxml.etree.EntityBase-class.html#__init__,Method lxml.etree.FallbackElementClassLookup.__init__()=lxml.etree.FallbackElementClassLookup-class.html#__init__,Method lxml.etree.HTMLParser.__init__()=lxml.etree.HTMLParser-class.html#__init__,Method lxml.etree.LxmlError.__init__()=lxml.etree.LxmlError-class.html#__init__,Method lxml.etree.PIBase.__init__()=lxml.etree.PIBase-class.html#__init__,Method lxml.etree.ParseError.__init__()=lxml.etree.ParseError-class.html#__init__,Method lxml.etree.PyErrorLog.__init__()=lxml.etree.PyErrorLog-class.html#__init__,Method lxml.etree.QName.__init__()=lxml.etree.QName-class.html#__init__,Method lxml.etree.RelaxNG.__init__()=lxml.etree.RelaxNG-class.html#__init__,Method lxml.etree.Schematron.__init__()=lxml.etree.Schematron-class.html#__init__,Method lxml.etree.TreeBuilder.__init__()=lxml.etree.TreeBuilder-class.html#__init__,Method lxml.etree.XInclude.__init__()=lxml.etree.XInclude-class.html#__init__,Method lxml.etree.XMLParser.__init__()=lxml.etree.XMLParser-class.html#__init__,Method lxml.etree.XMLSchema.__init__()=lxml.etree.XMLSchema-class.html#__init__,Method lxml.etree.XPath.__init__()=lxml.etree.XPath-class.html#__init__,Method lxml.etree.XPathDocumentEvaluator.__init__()=lxml.etree.XPathDocumentEvaluator-class.html#__init__,Method lxml.etree.XPathElementEvaluator.__init__()=lxml.etree.XPathElementEvaluator-class.html#__init__,Method lxml.etree.XSLT.__init__()=lxml.etree.XSLT-class.html#__init__,Method lxml.etree._BaseContext.__init__()=lxml.etree._BaseContext-class.html#__init__,Method lxml.etree._BaseErrorLog.__init__()=lxml.etree._BaseErrorLog-class.html#__init__,Method lxml.etree._BaseParser.__init__()=lxml.etree._BaseParser-class.html#__init__,Method lxml.etree._DomainErrorLog.__init__()=lxml.etree._DomainErrorLog-class.html#__init__,Method lxml.etree._ErrorLog.__init__()=lxml.etree._ErrorLog-class.html#__init__,Method lxml.etree._ListErrorLog.__init__()=lxml.etree._ListErrorLog-class.html#__init__,Method lxml.etree._OpaqueNodeWrapper.__init__()=lxml.etree._OpaqueNodeWrapper-class.html#__init__,Method lxml.etree._RotatingErrorLog.__init__()=lxml.etree._RotatingErrorLog-class.html#__init__,Method lxml.etree._TargetParserResult.__init__()=lxml.etree._TargetParserResult-class.html#__init__,Method lxml.etree._TempStore.__init__()=lxml.etree._TempStore-class.html#__init__,Method lxml.etree._XPathContext.__init__()=lxml.etree._XPathContext-class.html#__init__,Method lxml.etree._XPathEvaluatorBase.__init__()=lxml.etree._XPathEvaluatorBase-class.html#__init__,Method lxml.etree._XSLTContext.__init__()=lxml.etree._XSLTContext-class.html#__init__,Method lxml.etree.iterparse.__init__()=lxml.etree.iterparse-class.html#__init__,Method lxml.etree.iterwalk.__init__()=lxml.etree.iterwalk-class.html#__init__,Method lxml.html.CheckboxValues.__init__()=lxml.html.CheckboxValues-class.html#__init__,Method lxml.html.FieldsDict.__init__()=lxml.html.FieldsDict-class.html#__init__,Method lxml.html.HTMLParser.__init__()=lxml.html.HTMLParser-class.html#__init__,Method lxml.html.HtmlElementClassLookup.__init__()=lxml.html.HtmlElementClassLookup-class.html#__init__,Method lxml.html.InputGetter.__init__()=lxml.html.InputGetter-class.html#__init__,Method lxml.html.MultipleSelectOptions.__init__()=lxml.html.MultipleSelectOptions-class.html#__init__,Method lxml.html.XHTMLParser.__init__()=lxml.html.XHTMLParser-class.html#__init__,Method lxml.html._MethodFunc.__init__()=lxml.html._MethodFunc-class.html#__init__,Method lxml.html.clean.Cleaner.__init__()=lxml.html.clean.Cleaner-class.html#__init__,Method lxml.html.formfill.DefaultErrorCreator.__init__()=lxml.html.formfill.DefaultErrorCreator-class.html#__init__,Method lxml.html.html5parser.HTMLParser.__init__()=lxml.html.html5parser.HTMLParser-class.html#__init__,Method lxml.html.html5parser.XHTMLParser.__init__()=lxml.html.html5parser.XHTMLParser-class.html#__init__,Method lxml.isoschematron.Schematron.__init__()=lxml.isoschematron.Schematron-class.html#__init__,Method lxml.objectify.ElementMaker.__init__()=lxml.objectify.ElementMaker-class.html#__init__,Method lxml.objectify.ObjectPath.__init__()=lxml.objectify.ObjectPath-class.html#__init__,Method lxml.objectify.ObjectifyElementClassLookup.__init__()=lxml.objectify.ObjectifyElementClassLookup-class.html#__init__,Method lxml.objectify.PyType.__init__()=lxml.objectify.PyType-class.html#__init__,Method lxml.sax.ElementTreeContentHandler.__init__()=lxml.sax.ElementTreeContentHandler-class.html#__init__,Method lxml.sax.ElementTreeProducer.__init__()=lxml.sax.ElementTreeProducer-class.html#__init__,Method lxml.tests.common_imports.LargeFileLike.__init__()=lxml.tests.common_imports.LargeFileLike-class.html#__init__,Method lxml.tests.common_imports.LargeFileLikeUnicode.__init__()=lxml.tests.common_imports.LargeFileLikeUnicode-class.html#__init__,Method lxml.tests.common_imports.SillyFileLike.__init__()=lxml.tests.common_imports.SillyFileLike-class.html#__init__,Method lxml.tests.test_css.CSSTestCase.__init__()=lxml.tests.test_css.CSSTestCase-class.html#__init__,Method lxml.tests.test_threading.ThreadPipelineTestCase.Worker.__init__()=lxml.tests.test_threading.ThreadPipelineTestCase.Worker-class.html#__init__,Method lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver.__init__()=lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver-class.html#__init__"><a title="lxml.builder.ElementMaker.__init__
366 lxml.cssselect.Attrib.__init__
367 lxml.cssselect.CSSSelector.__init__
368 lxml.cssselect.Class.__init__
369 lxml.cssselect.CombinedSelector.__init__
370 lxml.cssselect.Element.__init__
371 lxml.cssselect.Function.__init__
372 lxml.cssselect.Hash.__init__
373 lxml.cssselect.Or.__init__
374 lxml.cssselect.Pseudo.__init__
375 lxml.cssselect.TokenStream.__init__
376 lxml.cssselect.XPathExpr.__init__
377 lxml.cssselect.XPathExprOr.__init__
378 lxml.doctestcompare._RestoreChecker.__init__
379 lxml.etree.AttributeBasedElementClassLookup.__init__
380 lxml.etree.CDATA.__init__
381 lxml.etree.CommentBase.__init__
382 lxml.etree.DTD.__init__
383 lxml.etree.ETCompatXMLParser.__init__
384 lxml.etree.ETXPath.__init__
385 lxml.etree.ElementBase.__init__
386 lxml.etree.ElementDefaultClassLookup.__init__
387 lxml.etree.ElementNamespaceClassLookup.__init__
388 lxml.etree.EntityBase.__init__
389 lxml.etree.FallbackElementClassLookup.__init__
390 lxml.etree.HTMLParser.__init__
391 lxml.etree.LxmlError.__init__
392 lxml.etree.PIBase.__init__
393 lxml.etree.ParseError.__init__
394 lxml.etree.PyErrorLog.__init__
395 lxml.etree.QName.__init__
396 lxml.etree.RelaxNG.__init__
397 lxml.etree.Schematron.__init__
398 lxml.etree.TreeBuilder.__init__
399 lxml.etree.XInclude.__init__
400 lxml.etree.XMLParser.__init__
401 lxml.etree.XMLSchema.__init__
402 lxml.etree.XPath.__init__
403 lxml.etree.XPathDocumentEvaluator.__init__
404 lxml.etree.XPathElementEvaluator.__init__
405 lxml.etree.XSLT.__init__
406 lxml.etree._BaseContext.__init__
407 lxml.etree._BaseErrorLog.__init__
408 lxml.etree._BaseParser.__init__
409 lxml.etree._DomainErrorLog.__init__
410 lxml.etree._ErrorLog.__init__
411 lxml.etree._ListErrorLog.__init__
412 lxml.etree._OpaqueNodeWrapper.__init__
413 lxml.etree._RotatingErrorLog.__init__
414 lxml.etree._TargetParserResult.__init__
415 lxml.etree._TempStore.__init__
416 lxml.etree._XPathContext.__init__
417 lxml.etree._XPathEvaluatorBase.__init__
418 lxml.etree._XSLTContext.__init__
419 lxml.etree.iterparse.__init__
420 lxml.etree.iterwalk.__init__
421 lxml.html.CheckboxValues.__init__
422 lxml.html.FieldsDict.__init__
423 lxml.html.HTMLParser.__init__
424 lxml.html.HtmlElementClassLookup.__init__
425 lxml.html.InputGetter.__init__
426 lxml.html.MultipleSelectOptions.__init__
427 lxml.html.XHTMLParser.__init__
428 lxml.html._MethodFunc.__init__
429 lxml.html.clean.Cleaner.__init__
430 lxml.html.formfill.DefaultErrorCreator.__init__
431 lxml.html.html5parser.HTMLParser.__init__
432 lxml.html.html5parser.XHTMLParser.__init__
433 lxml.isoschematron.Schematron.__init__
434 lxml.objectify.ElementMaker.__init__
435 lxml.objectify.ObjectPath.__init__
436 lxml.objectify.ObjectifyElementClassLookup.__init__
437 lxml.objectify.PyType.__init__
438 lxml.sax.ElementTreeContentHandler.__init__
439 lxml.sax.ElementTreeProducer.__init__
440 lxml.tests.common_imports.LargeFileLike.__init__
441 lxml.tests.common_imports.LargeFileLikeUnicode.__init__
442 lxml.tests.common_imports.SillyFileLike.__init__
443 lxml.tests.test_css.CSSTestCase.__init__
444 lxml.tests.test_threading.ThreadPipelineTestCase.Worker.__init__
445 lxml.tests.test_xmlschema.ETreeXMLSchemaResolversTestCase.simple_resolver.__init__" class="py-name" href="#" onclick="return doclink('link-96', '__init__', 'link-96');">__init__</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
446 <a name="L223"></a><tt class="py-lineno">223</tt> <tt class="py-line"> </tt>
447 <a name="L224"></a><tt class="py-lineno">224</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_store_report</tt> <tt class="py-op">=</tt> <tt class="py-name">store_report</tt> </tt>
448 <a name="L225"></a><tt class="py-lineno">225</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_schematron</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
449 <a name="L226"></a><tt class="py-lineno">226</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_validator_xslt</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
450 <a name="L227"></a><tt class="py-lineno">227</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_validation_report</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
451 <a name="L228"></a><tt class="py-lineno">228</tt> <tt class="py-line"> </tt>
452 <a name="L229"></a><tt class="py-lineno">229</tt> <tt class="py-line"> <tt class="py-comment"># parse schema document, may be a schematron schema or an XML Schema or</tt> </tt>
453 <a name="L230"></a><tt class="py-lineno">230</tt> <tt class="py-line"> <tt class="py-comment"># a RelaxNG schema with embedded schematron rules</tt> </tt>
454 <a name="L231"></a><tt class="py-lineno">231</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
455 <a name="L232"></a><tt class="py-lineno">232</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt id="link-97" class="py-name"><a title="lxml.etree
456 lxml.sax.ElementTreeContentHandler.etree
457 lxml.tests.test_elementtree.CElementTreeTestCase.etree
458 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
459 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-97', 'etree', 'link-2');">etree</a></tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
460 <a name="L233"></a><tt class="py-lineno">233</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt id="link-98" class="py-name"><a title="lxml.etree
461 lxml.sax.ElementTreeContentHandler.etree
462 lxml.tests.test_elementtree.CElementTreeTestCase.etree
463 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
464 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-98', 'etree', 'link-2');">etree</a></tt><tt class="py-op">,</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-99" class="py-name" targets="Class lxml.etree._Element=lxml.etree._Element-class.html"><a title="lxml.etree._Element" class="py-name" href="#" onclick="return doclink('link-99', '_Element', 'link-99');">_Element</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
465 <a name="L234"></a><tt class="py-lineno">234</tt> <tt class="py-line"> <tt id="link-100" class="py-name" targets="Variable lxml.etree.iterparse.root=lxml.etree.iterparse-class.html#root"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-100', 'root', 'link-100');">root</a></tt> <tt class="py-op">=</tt> <tt id="link-101" class="py-name"><a title="lxml.etree
466 lxml.sax.ElementTreeContentHandler.etree
467 lxml.tests.test_elementtree.CElementTreeTestCase.etree
468 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
469 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-101', 'etree', 'link-2');">etree</a></tt> </tt>
470 <a name="L235"></a><tt class="py-lineno">235</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
471 <a name="L236"></a><tt class="py-lineno">236</tt> <tt class="py-line"> <tt id="link-102" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-102', 'root', 'link-100');">root</a></tt> <tt class="py-op">=</tt> <tt id="link-103" class="py-name"><a title="lxml.etree
472 lxml.sax.ElementTreeContentHandler.etree
473 lxml.tests.test_elementtree.CElementTreeTestCase.etree
474 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
475 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-103', 'etree', 'link-2');">etree</a></tt><tt class="py-op">.</tt><tt id="link-104" class="py-name" targets="Method lxml.etree._ElementTree.getroot()=lxml.etree._ElementTree-class.html#getroot"><a title="lxml.etree._ElementTree.getroot" class="py-name" href="#" onclick="return doclink('link-104', 'getroot', 'link-104');">getroot</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
476 <a name="L237"></a><tt class="py-lineno">237</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">file</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
477 <a name="L238"></a><tt class="py-lineno">238</tt> <tt class="py-line"> <tt id="link-105" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-105', 'root', 'link-100');">root</a></tt> <tt class="py-op">=</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-106" class="py-name"><a title="lxml.cssselect.parse
478 lxml.etree._ElementTree.parse
480 lxml.html.ElementSoup.parse
481 lxml.html.html5parser.parse
483 lxml.html.soupparser.parse
485 lxml.tests.common_imports.HelperTestCase.parse" class="py-name" href="#" onclick="return doclink('link-106', 'parse', 'link-17');">parse</a></tt><tt class="py-op">(</tt><tt class="py-name">file</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-107" class="py-name"><a title="lxml.etree._ElementTree.getroot" class="py-name" href="#" onclick="return doclink('link-107', 'getroot', 'link-104');">getroot</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
486 <a name="L239"></a><tt class="py-lineno">239</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">Exception</tt><tt class="py-op">:</tt> </tt>
487 <a name="L240"></a><tt class="py-lineno">240</tt> <tt class="py-line"> <tt class="py-keyword">raise</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-108" class="py-name" targets="Class lxml.etree.SchematronParseError=lxml.etree.SchematronParseError-class.html"><a title="lxml.etree.SchematronParseError" class="py-name" href="#" onclick="return doclink('link-108', 'SchematronParseError', 'link-108');">SchematronParseError</a></tt><tt class="py-op">(</tt> </tt>
488 <a name="L241"></a><tt class="py-lineno">241</tt> <tt class="py-line"> <tt class="py-string">"No tree or file given: %s"</tt> <tt class="py-op">%</tt> <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">exc_info</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
489 <a name="L242"></a><tt class="py-lineno">242</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt id="link-109" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-109', 'root', 'link-100');">root</a></tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
490 <a name="L243"></a><tt class="py-lineno">243</tt> <tt class="py-line"> <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">"Empty tree"</tt><tt class="py-op">)</tt> </tt>
491 <a name="L244"></a><tt class="py-lineno">244</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt id="link-110" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-110', 'root', 'link-100');">root</a></tt><tt class="py-op">.</tt><tt id="link-111" class="py-name"><a title="lxml.etree._Comment.tag
492 lxml.etree._Element.tag
493 lxml.etree._Entity.tag
494 lxml.etree._ProcessingInstruction.tag
495 lxml.etree._ReadOnlyProxy.tag
496 lxml.tests.test_xpathevaluator.tag
497 xml.etree.ElementTree.Element.tag" class="py-name" href="#" onclick="return doclink('link-111', 'tag', 'link-73');">tag</a></tt> <tt class="py-op">==</tt> <tt id="link-112" class="py-name"><a title="lxml.isoschematron._schematron_root" class="py-name" href="#" onclick="return doclink('link-112', '_schematron_root', 'link-7');">_schematron_root</a></tt><tt class="py-op">:</tt> </tt>
498 <a name="L245"></a><tt class="py-lineno">245</tt> <tt class="py-line"> <tt id="link-113" class="py-name"><a title="lxml.isoschematron.Schematron.schematron" class="py-name" href="#" onclick="return doclink('link-113', 'schematron', 'link-72');">schematron</a></tt> <tt class="py-op">=</tt> <tt id="link-114" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-114', 'root', 'link-100');">root</a></tt> </tt>
499 <a name="L246"></a><tt class="py-lineno">246</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
500 <a name="L247"></a><tt class="py-lineno">247</tt> <tt class="py-line"> <tt id="link-115" class="py-name"><a title="lxml.isoschematron.Schematron.schematron" class="py-name" href="#" onclick="return doclink('link-115', 'schematron', 'link-72');">schematron</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-116" class="py-name" targets="Method lxml.isoschematron.Schematron._extract()=lxml.isoschematron.Schematron-class.html#_extract"><a title="lxml.isoschematron.Schematron._extract" class="py-name" href="#" onclick="return doclink('link-116', '_extract', 'link-116');">_extract</a></tt><tt class="py-op">(</tt><tt id="link-117" class="py-name"><a title="lxml.etree.iterparse.root" class="py-name" href="#" onclick="return doclink('link-117', 'root', 'link-100');">root</a></tt><tt class="py-op">)</tt> </tt>
501 <a name="L248"></a><tt class="py-lineno">248</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt id="link-118" class="py-name"><a title="lxml.isoschematron.Schematron.schematron" class="py-name" href="#" onclick="return doclink('link-118', 'schematron', 'link-72');">schematron</a></tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
502 <a name="L249"></a><tt class="py-lineno">249</tt> <tt class="py-line"> <tt class="py-keyword">raise</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-119" class="py-name"><a title="lxml.etree.SchematronParseError" class="py-name" href="#" onclick="return doclink('link-119', 'SchematronParseError', 'link-108');">SchematronParseError</a></tt><tt class="py-op">(</tt> </tt>
503 <a name="L250"></a><tt class="py-lineno">250</tt> <tt class="py-line"> <tt class="py-string">"Document is not a schematron schema or schematron-extractable"</tt><tt class="py-op">)</tt> </tt>
504 <a name="L251"></a><tt class="py-lineno">251</tt> <tt class="py-line"> <tt class="py-comment"># perform the iso-schematron skeleton implementation steps to get a</tt> </tt>
505 <a name="L252"></a><tt class="py-lineno">252</tt> <tt class="py-line"> <tt class="py-comment"># validating xslt</tt> </tt>
506 <a name="L253"></a><tt class="py-lineno">253</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt id="link-120" class="py-name" targets="Function lxml.ElementInclude.include()=lxml.ElementInclude-module.html#include,Package lxml.include=lxml.include-module.html,Method lxml.tests.test_etree.ETreeXIncludeTestCase.include()=lxml.tests.test_etree.ETreeXIncludeTestCase-class.html#include,Method lxml.tests.test_etree.ElementIncludeTestCase.include()=lxml.tests.test_etree.ElementIncludeTestCase-class.html#include"><a title="lxml.ElementInclude.include
508 lxml.tests.test_etree.ETreeXIncludeTestCase.include
509 lxml.tests.test_etree.ElementIncludeTestCase.include" class="py-name" href="#" onclick="return doclink('link-120', 'include', 'link-120');">include</a></tt><tt class="py-op">:</tt> </tt>
510 <a name="L254"></a><tt class="py-lineno">254</tt> <tt class="py-line"> <tt id="link-121" class="py-name"><a title="lxml.isoschematron.Schematron.schematron" class="py-name" href="#" onclick="return doclink('link-121', 'schematron', 'link-72');">schematron</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-122" class="py-name"><a title="lxml.ElementInclude._include
511 lxml.isoschematron.Schematron._include" class="py-name" href="#" onclick="return doclink('link-122', '_include', 'link-87');">_include</a></tt><tt class="py-op">(</tt><tt id="link-123" class="py-name"><a title="lxml.isoschematron.Schematron.schematron" class="py-name" href="#" onclick="return doclink('link-123', 'schematron', 'link-72');">schematron</a></tt><tt class="py-op">,</tt> <tt class="py-op">**</tt><tt class="py-name">include_params</tt><tt class="py-op">)</tt> </tt>
512 <a name="L255"></a><tt class="py-lineno">255</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">expand</tt><tt class="py-op">:</tt> </tt>
513 <a name="L256"></a><tt class="py-lineno">256</tt> <tt class="py-line"> <tt id="link-124" class="py-name"><a title="lxml.isoschematron.Schematron.schematron" class="py-name" href="#" onclick="return doclink('link-124', 'schematron', 'link-72');">schematron</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-125" class="py-name"><a title="lxml.isoschematron.Schematron._expand" class="py-name" href="#" onclick="return doclink('link-125', '_expand', 'link-89');">_expand</a></tt><tt class="py-op">(</tt><tt id="link-126" class="py-name"><a title="lxml.isoschematron.Schematron.schematron" class="py-name" href="#" onclick="return doclink('link-126', 'schematron', 'link-72');">schematron</a></tt><tt class="py-op">,</tt> <tt class="py-op">**</tt><tt class="py-name">expand_params</tt><tt class="py-op">)</tt> </tt>
514 <a name="L257"></a><tt class="py-lineno">257</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt id="link-127" class="py-name"><a title="lxml.isoschematron.schematron_schema_valid" class="py-name" href="#" onclick="return doclink('link-127', 'schematron_schema_valid', 'link-48');">schematron_schema_valid</a></tt><tt class="py-op">(</tt><tt id="link-128" class="py-name"><a title="lxml.isoschematron.Schematron.schematron" class="py-name" href="#" onclick="return doclink('link-128', 'schematron', 'link-72');">schematron</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
515 <a name="L258"></a><tt class="py-lineno">258</tt> <tt class="py-line"> <tt class="py-keyword">raise</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-129" class="py-name"><a title="lxml.etree.SchematronParseError" class="py-name" href="#" onclick="return doclink('link-129', 'SchematronParseError', 'link-108');">SchematronParseError</a></tt><tt class="py-op">(</tt> </tt>
516 <a name="L259"></a><tt class="py-lineno">259</tt> <tt class="py-line"> <tt class="py-string">"invalid schematron schema: %s"</tt> <tt class="py-op">%</tt> </tt>
517 <a name="L260"></a><tt class="py-lineno">260</tt> <tt class="py-line"> <tt id="link-130" class="py-name"><a title="lxml.isoschematron.schematron_schema_valid" class="py-name" href="#" onclick="return doclink('link-130', 'schematron_schema_valid', 'link-48');">schematron_schema_valid</a></tt><tt class="py-op">.</tt><tt id="link-131" class="py-name" targets="Variable lxml.etree.XInclude.error_log=lxml.etree.XInclude-class.html#error_log,Variable lxml.etree.XSLT.error_log=lxml.etree.XSLT-class.html#error_log,Variable lxml.etree._BaseParser.error_log=lxml.etree._BaseParser-class.html#error_log,Variable lxml.etree._Validator.error_log=lxml.etree._Validator-class.html#error_log,Variable lxml.etree._XPathEvaluatorBase.error_log=lxml.etree._XPathEvaluatorBase-class.html#error_log,Variable lxml.etree.iterparse.error_log=lxml.etree.iterparse-class.html#error_log"><a title="lxml.etree.XInclude.error_log
518 lxml.etree.XSLT.error_log
519 lxml.etree._BaseParser.error_log
520 lxml.etree._Validator.error_log
521 lxml.etree._XPathEvaluatorBase.error_log
522 lxml.etree.iterparse.error_log" class="py-name" href="#" onclick="return doclink('link-131', 'error_log', 'link-131');">error_log</a></tt><tt class="py-op">)</tt> </tt>
523 <a name="L261"></a><tt class="py-lineno">261</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">store_schematron</tt><tt class="py-op">:</tt> </tt>
524 <a name="L262"></a><tt class="py-lineno">262</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_schematron</tt> <tt class="py-op">=</tt> <tt id="link-132" class="py-name"><a title="lxml.isoschematron.Schematron.schematron" class="py-name" href="#" onclick="return doclink('link-132', 'schematron', 'link-72');">schematron</a></tt> </tt>
525 <a name="L263"></a><tt class="py-lineno">263</tt> <tt class="py-line"> <tt class="py-comment"># add new compile keyword args here if exposing them</tt> </tt>
526 <a name="L264"></a><tt class="py-lineno">264</tt> <tt class="py-line"> <tt class="py-name">compile_kwargs</tt> <tt class="py-op">=</tt> <tt class="py-op">{</tt><tt class="py-string">'phase'</tt><tt class="py-op">:</tt> <tt class="py-name">phase</tt><tt class="py-op">}</tt> </tt>
527 <a name="L265"></a><tt class="py-lineno">265</tt> <tt class="py-line"> <tt class="py-name">compile_params</tt> <tt class="py-op">=</tt> <tt id="link-133" class="py-name" targets="Function lxml.isoschematron._stylesheet_param_dict()=lxml.isoschematron-module.html#_stylesheet_param_dict"><a title="lxml.isoschematron._stylesheet_param_dict" class="py-name" href="#" onclick="return doclink('link-133', '_stylesheet_param_dict', 'link-133');">_stylesheet_param_dict</a></tt><tt class="py-op">(</tt><tt class="py-name">compile_params</tt><tt class="py-op">,</tt> <tt class="py-name">compile_kwargs</tt><tt class="py-op">)</tt> </tt>
528 <a name="L266"></a><tt class="py-lineno">266</tt> <tt class="py-line"> <tt id="link-134" class="py-name" targets="Variable lxml.isoschematron.Schematron.validator_xslt=lxml.isoschematron.Schematron-class.html#validator_xslt"><a title="lxml.isoschematron.Schematron.validator_xslt" class="py-name" href="#" onclick="return doclink('link-134', 'validator_xslt', 'link-134');">validator_xslt</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-135" class="py-name"><a title="lxml.isoschematron.Schematron._compile" class="py-name" href="#" onclick="return doclink('link-135', '_compile', 'link-91');">_compile</a></tt><tt class="py-op">(</tt><tt id="link-136" class="py-name"><a title="lxml.isoschematron.Schematron.schematron" class="py-name" href="#" onclick="return doclink('link-136', 'schematron', 'link-72');">schematron</a></tt><tt class="py-op">,</tt> <tt class="py-op">**</tt><tt class="py-name">compile_params</tt><tt class="py-op">)</tt> </tt>
529 <a name="L267"></a><tt class="py-lineno">267</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">store_xslt</tt><tt class="py-op">:</tt> </tt>
530 <a name="L268"></a><tt class="py-lineno">268</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_validator_xslt</tt> <tt class="py-op">=</tt> <tt id="link-137" class="py-name"><a title="lxml.isoschematron.Schematron.validator_xslt" class="py-name" href="#" onclick="return doclink('link-137', 'validator_xslt', 'link-134');">validator_xslt</a></tt> </tt>
531 <a name="L269"></a><tt class="py-lineno">269</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_validator</tt> <tt class="py-op">=</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-138" class="py-name"><a title="lxml.etree.ErrorDomains.XSLT
532 lxml.etree.XSLT" class="py-name" href="#" onclick="return doclink('link-138', 'XSLT', 'link-16');">XSLT</a></tt><tt class="py-op">(</tt><tt id="link-139" class="py-name"><a title="lxml.isoschematron.Schematron.validator_xslt" class="py-name" href="#" onclick="return doclink('link-139', 'validator_xslt', 'link-134');">validator_xslt</a></tt><tt class="py-op">)</tt> </tt>
533 </div><a name="L270"></a><tt class="py-lineno">270</tt> <tt class="py-line"> </tt>
534 <a name="Schematron.__call__"></a><div id="Schematron.__call__-def"><a name="L271"></a><tt class="py-lineno">271</tt> <a class="py-toggle" href="#" id="Schematron.__call__-toggle" onclick="return toggle('Schematron.__call__');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.isoschematron.Schematron-class.html#__call__">__call__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">etree</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
535 </div><div id="Schematron.__call__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Schematron.__call__-expanded"><a name="L272"></a><tt class="py-lineno">272</tt> <tt class="py-line"> <tt class="py-docstring">"""Validate doc using Schematron.</tt> </tt>
536 <a name="L273"></a><tt class="py-lineno">273</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
537 <a name="L274"></a><tt class="py-lineno">274</tt> <tt class="py-line"><tt class="py-docstring"> Returns true if document is valid, false if not.</tt> </tt>
538 <a name="L275"></a><tt class="py-lineno">275</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
539 <a name="L276"></a><tt class="py-lineno">276</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-140" class="py-name" targets="Method lxml.etree._Validator._clear_error_log()=lxml.etree._Validator-class.html#_clear_error_log"><a title="lxml.etree._Validator._clear_error_log" class="py-name" href="#" onclick="return doclink('link-140', '_clear_error_log', 'link-140');">_clear_error_log</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
540 <a name="L277"></a><tt class="py-lineno">277</tt> <tt class="py-line"> <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_validator</tt><tt class="py-op">(</tt><tt id="link-141" class="py-name"><a title="lxml.etree
541 lxml.sax.ElementTreeContentHandler.etree
542 lxml.tests.test_elementtree.CElementTreeTestCase.etree
543 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
544 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-141', 'etree', 'link-2');">etree</a></tt><tt class="py-op">)</tt> </tt>
545 <a name="L278"></a><tt class="py-lineno">278</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_store_report</tt><tt class="py-op">:</tt> </tt>
546 <a name="L279"></a><tt class="py-lineno">279</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_validation_report</tt> <tt class="py-op">=</tt> <tt class="py-name">result</tt> </tt>
547 <a name="L280"></a><tt class="py-lineno">280</tt> <tt class="py-line"> <tt class="py-name">errors</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-142" class="py-name"><a title="lxml.isoschematron.Schematron._validation_errors" class="py-name" href="#" onclick="return doclink('link-142', '_validation_errors', 'link-93');">_validation_errors</a></tt><tt class="py-op">(</tt><tt class="py-name">result</tt><tt class="py-op">)</tt> </tt>
548 <a name="L281"></a><tt class="py-lineno">281</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">errors</tt><tt class="py-op">:</tt> </tt>
549 <a name="L282"></a><tt class="py-lineno">282</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt id="link-143" class="py-name"><a title="lxml.etree
550 lxml.sax.ElementTreeContentHandler.etree
551 lxml.tests.test_elementtree.CElementTreeTestCase.etree
552 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
553 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-143', 'etree', 'link-2');">etree</a></tt><tt class="py-op">,</tt> <tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-144" class="py-name"><a title="lxml.etree._Element" class="py-name" href="#" onclick="return doclink('link-144', '_Element', 'link-99');">_Element</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
554 <a name="L283"></a><tt class="py-lineno">283</tt> <tt class="py-line"> <tt class="py-name">fname</tt> <tt class="py-op">=</tt> <tt id="link-145" class="py-name"><a title="lxml.etree
555 lxml.sax.ElementTreeContentHandler.etree
556 lxml.tests.test_elementtree.CElementTreeTestCase.etree
557 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
558 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-145', 'etree', 'link-2');">etree</a></tt><tt class="py-op">.</tt><tt id="link-146" class="py-name" targets="Method lxml.etree._Element.getroottree()=lxml.etree._Element-class.html#getroottree"><a title="lxml.etree._Element.getroottree" class="py-name" href="#" onclick="return doclink('link-146', 'getroottree', 'link-146');">getroottree</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt id="link-147" class="py-name" targets="Variable lxml.etree._ElementTree.docinfo=lxml.etree._ElementTree-class.html#docinfo"><a title="lxml.etree._ElementTree.docinfo" class="py-name" href="#" onclick="return doclink('link-147', 'docinfo', 'link-147');">docinfo</a></tt><tt class="py-op">.</tt><tt id="link-148" class="py-name" targets="Variable lxml.etree.DocInfo.URL=lxml.etree.DocInfo-class.html#URL"><a title="lxml.etree.DocInfo.URL" class="py-name" href="#" onclick="return doclink('link-148', 'URL', 'link-148');">URL</a></tt> <tt class="py-keyword">or</tt> <tt class="py-string">'<file>'</tt> </tt>
559 <a name="L284"></a><tt class="py-lineno">284</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
560 <a name="L285"></a><tt class="py-lineno">285</tt> <tt class="py-line"> <tt class="py-name">fname</tt> <tt class="py-op">=</tt> <tt id="link-149" class="py-name"><a title="lxml.etree
561 lxml.sax.ElementTreeContentHandler.etree
562 lxml.tests.test_elementtree.CElementTreeTestCase.etree
563 lxml.tests.test_elementtree.ETreeTestCaseBase.etree
564 lxml.tests.test_io.IOTestCaseBase.etree" class="py-name" href="#" onclick="return doclink('link-149', 'etree', 'link-2');">etree</a></tt><tt class="py-op">.</tt><tt id="link-150" class="py-name"><a title="lxml.etree._ElementTree.docinfo" class="py-name" href="#" onclick="return doclink('link-150', 'docinfo', 'link-147');">docinfo</a></tt><tt class="py-op">.</tt><tt id="link-151" class="py-name"><a title="lxml.etree.DocInfo.URL" class="py-name" href="#" onclick="return doclink('link-151', 'URL', 'link-148');">URL</a></tt> <tt class="py-keyword">or</tt> <tt class="py-string">'<file>'</tt> </tt>
565 <a name="L286"></a><tt class="py-lineno">286</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">error</tt> <tt class="py-keyword">in</tt> <tt class="py-name">errors</tt><tt class="py-op">:</tt> </tt>
566 <a name="L287"></a><tt class="py-lineno">287</tt> <tt class="py-line"> <tt class="py-comment"># Does svrl report the line number, anywhere? Don't think so.</tt> </tt>
567 <a name="L288"></a><tt class="py-lineno">288</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-152" class="py-name" targets="Method lxml.etree._Validator._append_log_message()=lxml.etree._Validator-class.html#_append_log_message"><a title="lxml.etree._Validator._append_log_message" class="py-name" href="#" onclick="return doclink('link-152', '_append_log_message', 'link-152');">_append_log_message</a></tt><tt class="py-op">(</tt> </tt>
568 <a name="L289"></a><tt class="py-lineno">289</tt> <tt class="py-line"> <tt id="link-153" class="py-name" targets="Variable lxml.etree._LogEntry.domain=lxml.etree._LogEntry-class.html#domain"><a title="lxml.etree._LogEntry.domain" class="py-name" href="#" onclick="return doclink('link-153', 'domain', 'link-153');">domain</a></tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-154" class="py-name"><a title="lxml.isoschematron.Schematron._domain" class="py-name" href="#" onclick="return doclink('link-154', '_domain', 'link-63');">_domain</a></tt><tt class="py-op">,</tt> <tt id="link-155" class="py-name" targets="Variable lxml.etree._LogEntry.type=lxml.etree._LogEntry-class.html#type,Variable lxml.html.InputElement.type=lxml.html.InputElement-class.html#type"><a title="lxml.etree._LogEntry.type
569 lxml.html.InputElement.type" class="py-name" href="#" onclick="return doclink('link-155', 'type', 'link-155');">type</a></tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-156" class="py-name"><a title="lxml.isoschematron.Schematron._error_type" class="py-name" href="#" onclick="return doclink('link-156', '_error_type', 'link-69');">_error_type</a></tt><tt class="py-op">,</tt> </tt>
570 <a name="L290"></a><tt class="py-lineno">290</tt> <tt class="py-line"> <tt id="link-157" class="py-name" targets="Variable lxml.etree._LogEntry.level=lxml.etree._LogEntry-class.html#level"><a title="lxml.etree._LogEntry.level" class="py-name" href="#" onclick="return doclink('link-157', 'level', 'link-157');">level</a></tt><tt class="py-op">=</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-158" class="py-name"><a title="lxml.isoschematron.Schematron._level" class="py-name" href="#" onclick="return doclink('link-158', '_level', 'link-66');">_level</a></tt><tt class="py-op">,</tt> <tt id="link-159" class="py-name" targets="Variable lxml.etree._LogEntry.line=lxml.etree._LogEntry-class.html#line"><a title="lxml.etree._LogEntry.line" class="py-name" href="#" onclick="return doclink('link-159', 'line', 'link-159');">line</a></tt><tt class="py-op">=</tt><tt class="py-number">0</tt><tt class="py-op">,</tt> <tt id="link-160" class="py-name" targets="Variable lxml.etree._LogEntry.message=lxml.etree._LogEntry-class.html#message"><a title="lxml.etree._LogEntry.message" class="py-name" href="#" onclick="return doclink('link-160', 'message', 'link-160');">message</a></tt><tt class="py-op">=</tt><tt class="py-name">_etree</tt><tt class="py-op">.</tt><tt id="link-161" class="py-name" targets="Function lxml.etree.tounicode()=lxml.etree-module.html#tounicode"><a title="lxml.etree.tounicode" class="py-name" href="#" onclick="return doclink('link-161', 'tounicode', 'link-161');">tounicode</a></tt><tt class="py-op">(</tt><tt class="py-name">error</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
571 <a name="L291"></a><tt class="py-lineno">291</tt> <tt class="py-line"> <tt id="link-162" class="py-name" targets="Variable lxml.etree._LogEntry.filename=lxml.etree._LogEntry-class.html#filename"><a title="lxml.etree._LogEntry.filename" class="py-name" href="#" onclick="return doclink('link-162', 'filename', 'link-162');">filename</a></tt><tt class="py-op">=</tt><tt class="py-name">fname</tt><tt class="py-op">)</tt> </tt>
572 <a name="L292"></a><tt class="py-lineno">292</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">False</tt> </tt>
573 <a name="L293"></a><tt class="py-lineno">293</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">True</tt> </tt>
574 </div><a name="L294"></a><tt class="py-lineno">294</tt> <tt class="py-line"> </tt>
575 <a name="Schematron.schematron"></a><div id="Schematron.schematron-def"><a name="L295"></a><tt class="py-lineno">295</tt> <a class="py-toggle" href="#" id="Schematron.schematron-toggle" onclick="return toggle('Schematron.schematron');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.isoschematron.Schematron-class.html#schematron">schematron</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
576 </div><div id="Schematron.schematron-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Schematron.schematron-expanded"><a name="L296"></a><tt class="py-lineno">296</tt> <tt class="py-line"> <tt class="py-docstring">"""ISO-schematron schema document (None if object has been initialized</tt> </tt>
577 <a name="L297"></a><tt class="py-lineno">297</tt> <tt class="py-line"><tt class="py-docstring"> with store_schematron=False).</tt> </tt>
578 <a name="L298"></a><tt class="py-lineno">298</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
579 <a name="L299"></a><tt class="py-lineno">299</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_schematron</tt> </tt>
580 </div><a name="L300"></a><tt class="py-lineno">300</tt> <tt class="py-line"> <tt id="link-163" class="py-name"><a title="lxml.isoschematron.Schematron.schematron" class="py-name" href="#" onclick="return doclink('link-163', 'schematron', 'link-72');">schematron</a></tt> <tt class="py-op">=</tt> <tt class="py-name">property</tt><tt class="py-op">(</tt><tt id="link-164" class="py-name"><a title="lxml.isoschematron.Schematron.schematron" class="py-name" href="#" onclick="return doclink('link-164', 'schematron', 'link-72');">schematron</a></tt><tt class="py-op">,</tt> <tt class="py-name">doc</tt><tt class="py-op">=</tt><tt id="link-165" class="py-name"><a title="lxml.isoschematron.Schematron.schematron" class="py-name" href="#" onclick="return doclink('link-165', 'schematron', 'link-72');">schematron</a></tt><tt class="py-op">.</tt><tt id="link-166" class="py-name" targets="Variable lxml.html.ElementSoup.__doc__=lxml.html.ElementSoup-module.html#__doc__,Variable lxml.html.soupparser.__doc__=lxml.html.soupparser-module.html#__doc__"><a title="lxml.html.ElementSoup.__doc__
581 lxml.html.soupparser.__doc__" class="py-name" href="#" onclick="return doclink('link-166', '__doc__', 'link-166');">__doc__</a></tt><tt class="py-op">)</tt> </tt>
582 <a name="L301"></a><tt class="py-lineno">301</tt> <tt class="py-line"> </tt>
583 <a name="Schematron.validator_xslt"></a><div id="Schematron.validator_xslt-def"><a name="L302"></a><tt class="py-lineno">302</tt> <a class="py-toggle" href="#" id="Schematron.validator_xslt-toggle" onclick="return toggle('Schematron.validator_xslt');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.isoschematron.Schematron-class.html#validator_xslt">validator_xslt</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
584 </div><div id="Schematron.validator_xslt-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Schematron.validator_xslt-expanded"><a name="L303"></a><tt class="py-lineno">303</tt> <tt class="py-line"> <tt class="py-docstring">"""ISO-schematron skeleton implementation XSLT validator document (None</tt> </tt>
585 <a name="L304"></a><tt class="py-lineno">304</tt> <tt class="py-line"><tt class="py-docstring"> if object has been initialized with store_xslt=False). </tt> </tt>
586 <a name="L305"></a><tt class="py-lineno">305</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
587 <a name="L306"></a><tt class="py-lineno">306</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_validator_xslt</tt> </tt>
588 </div><a name="L307"></a><tt class="py-lineno">307</tt> <tt class="py-line"> <tt id="link-167" class="py-name"><a title="lxml.isoschematron.Schematron.validator_xslt" class="py-name" href="#" onclick="return doclink('link-167', 'validator_xslt', 'link-134');">validator_xslt</a></tt> <tt class="py-op">=</tt> <tt class="py-name">property</tt><tt class="py-op">(</tt><tt id="link-168" class="py-name"><a title="lxml.isoschematron.Schematron.validator_xslt" class="py-name" href="#" onclick="return doclink('link-168', 'validator_xslt', 'link-134');">validator_xslt</a></tt><tt class="py-op">,</tt> <tt class="py-name">doc</tt><tt class="py-op">=</tt><tt id="link-169" class="py-name"><a title="lxml.isoschematron.Schematron.validator_xslt" class="py-name" href="#" onclick="return doclink('link-169', 'validator_xslt', 'link-134');">validator_xslt</a></tt><tt class="py-op">.</tt><tt id="link-170" class="py-name"><a title="lxml.html.ElementSoup.__doc__
589 lxml.html.soupparser.__doc__" class="py-name" href="#" onclick="return doclink('link-170', '__doc__', 'link-166');">__doc__</a></tt><tt class="py-op">)</tt> </tt>
590 <a name="L308"></a><tt class="py-lineno">308</tt> <tt class="py-line"> </tt>
591 <a name="Schematron.validation_report"></a><div id="Schematron.validation_report-def"><a name="L309"></a><tt class="py-lineno">309</tt> <a class="py-toggle" href="#" id="Schematron.validation_report-toggle" onclick="return toggle('Schematron.validation_report');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="lxml.isoschematron.Schematron-class.html#validation_report">validation_report</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
592 </div><div id="Schematron.validation_report-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Schematron.validation_report-expanded"><a name="L310"></a><tt class="py-lineno">310</tt> <tt class="py-line"> <tt class="py-docstring">"""ISO-schematron validation result report (None if result-storing has</tt> </tt>
593 <a name="L311"></a><tt class="py-lineno">311</tt> <tt class="py-line"><tt class="py-docstring"> been turned off).</tt> </tt>
594 <a name="L312"></a><tt class="py-lineno">312</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
595 <a name="L313"></a><tt class="py-lineno">313</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_validation_report</tt> </tt>
596 </div><a name="L314"></a><tt class="py-lineno">314</tt> <tt class="py-line"> <tt id="link-171" class="py-name" targets="Variable lxml.isoschematron.Schematron.validation_report=lxml.isoschematron.Schematron-class.html#validation_report"><a title="lxml.isoschematron.Schematron.validation_report" class="py-name" href="#" onclick="return doclink('link-171', 'validation_report', 'link-171');">validation_report</a></tt> <tt class="py-op">=</tt> <tt class="py-name">property</tt><tt class="py-op">(</tt><tt id="link-172" class="py-name"><a title="lxml.isoschematron.Schematron.validation_report" class="py-name" href="#" onclick="return doclink('link-172', 'validation_report', 'link-171');">validation_report</a></tt><tt class="py-op">,</tt> <tt class="py-name">doc</tt><tt class="py-op">=</tt><tt id="link-173" class="py-name"><a title="lxml.isoschematron.Schematron.validation_report" class="py-name" href="#" onclick="return doclink('link-173', 'validation_report', 'link-171');">validation_report</a></tt><tt class="py-op">.</tt><tt id="link-174" class="py-name"><a title="lxml.html.ElementSoup.__doc__
597 lxml.html.soupparser.__doc__" class="py-name" href="#" onclick="return doclink('link-174', '__doc__', 'link-166');">__doc__</a></tt><tt class="py-op">)</tt> </tt>
598 </div><a name="L315"></a><tt class="py-lineno">315</tt> <tt class="py-line"> </tt><script type="text/javascript">
600 expandto(location.href);
605 <!-- ==================== NAVIGATION BAR ==================== -->
606 <table class="navbar" border="0" width="100%" cellpadding="0"
607 bgcolor="#a0c0ff" cellspacing="0">
610 <th> <a
611 href="lxml-module.html">Home</a> </th>
614 <th> <a
615 href="module-tree.html">Trees</a> </th>
618 <th> <a
619 href="identifier-index.html">Indices</a> </th>
622 <th> <a
623 href="help.html">Help</a> </th>
625 <!-- Project homepage -->
626 <th class="navbar" align="right" width="100%">
627 <table border="0" cellpadding="0" cellspacing="0">
628 <tr><th class="navbar" align="center"
629 ><a class="navbar" target="_top" href="/">lxml API</a></th>
633 <table border="0" cellpadding="0" cellspacing="0" width="100%%">
635 <td align="left" class="footer">
636 Generated by Epydoc 3.0.1 on Tue Jul 31 10:14:20 2012
638 <td align="right" class="footer">
639 <a target="mainFrame" href="http://epydoc.sourceforge.net"
640 >http://epydoc.sourceforge.net</a>
645 <script type="text/javascript">
647 // Private objects are initially displayed (because if
648 // javascript is turned off then we want them to be
649 // visible); but by default, we want to hide them. So hide
650 // them unless we have a cookie that says to show them.