File: qxmlschema.html

package info (click to toggle)
python-qt4 4.7.3-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 28,504 kB
  • ctags: 4,680
  • sloc: python: 28,738; cpp: 8,897; sh: 245; xml: 243; makefile: 150
file content (112 lines) | stat: -rw-r--r-- 13,955 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QXmlSchema Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QXmlSchema Class Reference<br /><sup><sup>[<a href="qtxmlpatterns.html">QtXmlPatterns</a> module]</sup></sup></h1><p>The QXmlSchema class provides loading and validation of a W3C XML Schema. <a href="#details">More...</a></p>
<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qxmlschema.html#QXmlSchema">__init__</a></b> (<i>self</i>)</li><li><div class="fn" />QUrl <b><a href="qxmlschema.html#documentUri">documentUri</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qxmlschema.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qxmlschema.html#load">load</a></b> (<i>self</i>, QUrl)</li><li><div class="fn" />bool <b><a href="qxmlschema.html#load-2">load</a></b> (<i>self</i>, QIODevice, QUrl&#160;<i>documentUri</i>&#160;=&#160;QUrl())</li><li><div class="fn" />bool <b><a href="qxmlschema.html#load-3">load</a></b> (<i>self</i>, QByteArray, QUrl&#160;<i>documentUri</i>&#160;=&#160;QUrl())</li><li><div class="fn" />QAbstractMessageHandler <b><a href="qxmlschema.html#messageHandler">messageHandler</a></b> (<i>self</i>)</li><li><div class="fn" />QXmlNamePool <b><a href="qxmlschema.html#namePool">namePool</a></b> (<i>self</i>)</li><li><div class="fn" />QNetworkAccessManager <b><a href="qxmlschema.html#networkAccessManager">networkAccessManager</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qxmlschema.html#setMessageHandler">setMessageHandler</a></b> (<i>self</i>, QAbstractMessageHandler)</li><li><div class="fn" /><b><a href="qxmlschema.html#setNetworkAccessManager">setNetworkAccessManager</a></b> (<i>self</i>, QNetworkAccessManager)</li><li><div class="fn" /><b><a href="qxmlschema.html#setUriResolver">setUriResolver</a></b> (<i>self</i>, QAbstractUriResolver)</li><li><div class="fn" />QAbstractUriResolver <b><a href="qxmlschema.html#uriResolver">uriResolver</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QXmlSchema class provides loading and validation of a W3C XML Schema.</p>
<p>The QXmlSchema class loads, compiles and validates W3C XML Schema files that can be used further for validation of XML instance documents via <a href="qxmlschemavalidator.html">QXmlSchemaValidator</a>.</p>
<p>The following example shows how to load a XML Schema file from the network and test whether it is a valid schema document:</p>
<pre>     QUrl url("http:<span class="comment">//www.schema-example.org/myschema.xsd");</span>

     QXmlSchema schema;
     if (schema.load(url) == true)
         qDebug() &lt;&lt; "schema is valid";
     else
         qDebug() &lt;&lt; "schema is invalid";</pre>
<a name="xml-schema-version" />
<h3>XML Schema Version</h3>
<p>This class is used to represent schemas that conform to the <a href="http://www.w3.org/XML/Schema">XML Schema</a> 1.0 specification.</p>
<p>See also <a href="qxmlschemavalidator.html">QXmlSchemaValidator</a> and <a href="xmlpatterns-schema.html">XML Schema Validation Example</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QXmlSchema" />QXmlSchema.__init__ (<i>self</i>)</h3><p>Constructs an invalid, empty schema that cannot be used until <a href="qxmlschema.html#load">load</a>() is called.</p>
<h3 class="fn"><a name="documentUri" /><a href="qurl.html">QUrl</a> QXmlSchema.documentUri (<i>self</i>)</h3><p>Returns the document URI of the schema or an empty URI if no schema has been set.</p>
<a name="//apple_ref/cpp/instm/QXmlSchema/isValid" />
<h3 class="fn"><a name="isValid" />bool QXmlSchema.isValid (<i>self</i>)</h3><p>Returns true if this schema is valid. Examples of invalid schemas are ones that contain syntax errors or that do not conform the W3C XML Schema specification.</p>
<a name="//apple_ref/cpp/instm/QXmlSchema/load" />
<h3 class="fn"><a name="load" />bool QXmlSchema.load (<i>self</i>, <a href="qurl.html">QUrl</a>)</h3><p>Sets this <a href="qxmlschema.html">QXmlSchema</a> to a schema loaded from the <i>source</i> URI.</p>
<p>If the schema <a href="qxmlschema.html#isValid">is invalid</a>, <tt>false</tt> is returned and the behavior is undefined.</p>
<p>Example:</p>
<pre>     QUrl url("http:<span class="comment">//www.schema-example.org/myschema.xsd");</span>

     QXmlSchema schema;
     if (schema.load(url) == true)
         qDebug() &lt;&lt; "schema is valid";
     else
         qDebug() &lt;&lt; "schema is invalid";</pre>
<p>See also <a href="qxmlschema.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="load-2" />bool QXmlSchema.load (<i>self</i>, <a href="qiodevice.html">QIODevice</a>, <a href="qurl.html">QUrl</a>&#160;<i>documentUri</i>&#160;=&#160;QUrl())</h3><p>Sets this <a href="qxmlschema.html">QXmlSchema</a> to a schema read from the <i>source</i> device. The device must have been opened with at least <a href="qiodevice.html#OpenModeFlag-enum">QIODevice.ReadOnly</a>.</p>
<p><i>documentUri</i> represents the schema obtained from the <i>source</i> device. It is the base URI of the schema, that is used internally to resolve relative URIs that appear in the schema, and for message reporting.</p>
<p>If <i>source</i> is <tt>null</tt> or not readable, or if <i>documentUri</i> is not a valid URI, behavior is undefined.</p>
<p>If the schema <a href="qxmlschema.html#isValid">is invalid</a>, <tt>false</tt> is returned and the behavior is undefined.</p>
<p>Example:</p>
<pre>     QFile file("myschema.xsd");
     file.open(QIODevice.ReadOnly);

     QXmlSchema schema;
     schema.load(&amp;file, QUrl.fromLocalFile(file.fileName()));

     if (schema.isValid())
         qDebug() &lt;&lt; "schema is valid";
     else
         qDebug() &lt;&lt; "schema is invalid";</pre>
<p>See also <a href="qxmlschema.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="load-3" />bool QXmlSchema.load (<i>self</i>, <a href="qbytearray.html">QByteArray</a>, <a href="qurl.html">QUrl</a>&#160;<i>documentUri</i>&#160;=&#160;QUrl())</h3><p>Sets this <a href="qxmlschema.html">QXmlSchema</a> to a schema read from the <i>data</i></p>
<p><i>documentUri</i> represents the schema obtained from the <i>data</i>. It is the base URI of the schema, that is used internally to resolve relative URIs that appear in the schema, and for message reporting.</p>
<p>If <i>documentUri</i> is not a valid URI, behavior is undefined.</p>
<p>If the schema <a href="qxmlschema.html#isValid">is invalid</a>, <tt>false</tt> is returned and the behavior is undefined.</p>
<p>Example:</p>
<pre>     QByteArray data( "&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;"
                      "&lt;xsd:schema"
                      "        xmlns:xsd=\"http:<span class="comment">//www.w3.org/2001/XMLSchema\""</span>
                      "        xmlns=\"http:<span class="comment">//qt.nokia.com/xmlschematest\""</span>
                      "        targetNamespace=\"http:<span class="comment">//qt.nokia.com/xmlschematest\""</span>
                      "        version=\"1.0\""
                      "        elementFormDefault=\"qualified\"&gt;"
                      "&lt;/xsd:schema&gt;" );

     QBuffer buffer(&amp;data);
     buffer.open(QIODevice.ReadOnly);

     QXmlSchema schema;
     schema.load(&amp;buffer);

     if (schema.isValid())
         qDebug() &lt;&lt; "schema is valid";
     else
         qDebug() &lt;&lt; "schema is invalid";</pre>
<p>See also <a href="qxmlschema.html#isValid">isValid</a>() and <a href="qxmlschema.html#isValid">isValid</a>().</p>
<a name="//apple_ref/cpp/instm/QXmlSchema/messageHandler" />
<h3 class="fn"><a name="messageHandler" /><a href="qabstractmessagehandler.html">QAbstractMessageHandler</a> QXmlSchema.messageHandler (<i>self</i>)</h3><p>Returns the message handler that handles compile and validation messages for this <a href="qxmlschema.html">QXmlSchema</a>.</p>
<p>See also <a href="qxmlschema.html#setMessageHandler">setMessageHandler</a>().</p>
<a name="//apple_ref/cpp/instm/QXmlSchema/namePool" />
<h3 class="fn"><a name="namePool" /><a href="qxmlnamepool.html">QXmlNamePool</a> QXmlSchema.namePool (<i>self</i>)</h3><p>Returns the name pool used by this <a href="qxmlschema.html">QXmlSchema</a> for constructing <a href="qxmlname.html">names</a>. There is no setter for the name pool, because mixing name pools causes errors due to name confusion.</p>
<a name="//apple_ref/cpp/instm/QXmlSchema/networkAccessManager" />
<h3 class="fn"><a name="networkAccessManager" /><a href="qnetworkaccessmanager.html">QNetworkAccessManager</a> QXmlSchema.networkAccessManager (<i>self</i>)</h3><p>Returns the network manager, or 0 if it has not been set.</p>
<p>See also <a href="qxmlschema.html#setNetworkAccessManager">setNetworkAccessManager</a>().</p>
<a name="//apple_ref/cpp/instm/QXmlSchema/setMessageHandler" />
<h3 class="fn"><a name="setMessageHandler" />QXmlSchema.setMessageHandler (<i>self</i>, <a href="qabstractmessagehandler.html">QAbstractMessageHandler</a>)</h3><p>Changes the <a href="qabstractmessagehandler.html">message handler</a> for this <a href="qxmlschema.html">QXmlSchema</a> to <i>handler</i>. The schema sends all compile and validation messages to this message handler. <a href="qxmlschema.html">QXmlSchema</a> does not take ownership of <i>handler</i>.</p>
<p>Normally, the default message handler is sufficient. It writes compile and validation messages to <i>stderr</i>. The default message handler includes color codes if <i>stderr</i> can render colors.</p>
<p>When <a href="qxmlschema.html">QXmlSchema</a> calls <a href="qabstractmessagehandler.html#message">QAbstractMessageHandler.message</a>(), the arguments are as follows:</p>
<p><table align="center" border="0" cellpadding="2" cellspacing="1" class="generic">
<thead><tr class="qt-style" valign="top"><th>message() argument</th><th>Semantics</th></tr></thead>
<tr class="odd" valign="top"><td><a href="qtcore.html#QtMsgType-enum">QtMsgType</a> type</td><td>Only <a href="qtcore.html#QtMsgType-enum">QtWarningMsg</a> and <a href="qtcore.html#QtMsgType-enum">QtFatalMsg</a> are used. The former identifies a warning, while the latter identifies an error.</td></tr>
<tr class="even" valign="top"><td>const <a href="qstring.html">QString</a> &amp; description</td><td>An XHTML document which is the actual message. It is translated into the current language.</td></tr>
<tr class="odd" valign="top"><td>const <a href="qurl.html">QUrl</a> &amp;identifier</td><td>Identifies the error with a URI, where the fragment is the error code, and the rest of the URI is the error namespace.</td></tr>
<tr class="even" valign="top"><td>const <a href="qsourcelocation.html">QSourceLocation</a> &amp; sourceLocation</td><td>Identifies where the error occurred.</td></tr>
</table></p>
<p>See also <a href="qxmlschema.html#messageHandler">messageHandler</a>().</p>
<a name="//apple_ref/cpp/instm/QXmlSchema/setNetworkAccessManager" />
<h3 class="fn"><a name="setNetworkAccessManager" />QXmlSchema.setNetworkAccessManager (<i>self</i>, <a href="qnetworkaccessmanager.html">QNetworkAccessManager</a>)</h3><p>Sets the network manager to <i>manager</i>. <a href="qxmlschema.html">QXmlSchema</a> does not take ownership of <i>manager</i>.</p>
<p>See also <a href="qxmlschema.html#networkAccessManager">networkAccessManager</a>().</p>
<a name="//apple_ref/cpp/instm/QXmlSchema/setUriResolver" />
<h3 class="fn"><a name="setUriResolver" />QXmlSchema.setUriResolver (<i>self</i>, <a href="qabstracturiresolver.html">QAbstractUriResolver</a>)</h3><p>Sets the URI resolver to <i>resolver</i>. <a href="qxmlschema.html">QXmlSchema</a> does not take ownership of <i>resolver</i>.</p>
<p>See also <a href="qxmlschema.html#uriResolver">uriResolver</a>().</p>
<a name="//apple_ref/cpp/instm/QXmlSchema/uriResolver" />
<h3 class="fn"><a name="uriResolver" /><a href="qabstracturiresolver.html">QAbstractUriResolver</a> QXmlSchema.uriResolver (<i>self</i>)</h3><p>Returns the schema's URI resolver. If no URI resolver has been set, <a href="qtxmlpatterns.html">QtXmlPatterns</a> will use the URIs in schemas as they are.</p>
<p>The URI resolver provides a level of abstraction, or <i>polymorphic URIs</i>. A resolver can rewrite <i>logical</i> URIs to physical ones, or it can translate obsolete or invalid URIs to valid ones.</p>
<p>When <a href="qtxmlpatterns.html">QtXmlPatterns</a> calls <a href="qabstracturiresolver.html#resolve">QAbstractUriResolver.resolve</a>() the absolute URI is the URI mandated by the schema specification, and the relative URI is the URI specified by the user.</p>
<p>See also <a href="qxmlschema.html#setUriResolver">setUriResolver</a>().</p>
<p /><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.7.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt&#160;4.6.2</td></tr></table></div></address></body></html>