<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # QXmlQuery Class Reference ## [[QtXmlPatterns](index.htm) module] 該QXmlQuery類執行的XQuery查詢XML數據,或仿照看起來像XML的非XML數據。[More...](#details) ### Types * `enum QueryLanguage { XQuery10, XSLT20 }` ### Methods * `__init__ (self)` * `__init__ (self, QXmlQuery?other)` * `__init__ (self, QXmlNamePool?np)` * `__init__ (self, QueryLanguage?queryLanguage, QXmlNamePool?pool?=?QXmlNamePool())` * `bindVariable (self, QXmlName?name, QXmlItem?value)` * `bindVariable (self, QXmlName?name, QIODevice)` * `bindVariable (self, QXmlName?name, QXmlQuery?query)` * `bindVariable (self, QString?localName, QXmlItem?value)` * `bindVariable (self, QString?localName, QIODevice)` * `bindVariable (self, QString?localName, QXmlQuery?query)` * `evaluateTo (self, QXmlResultItems?result)` * `bool evaluateTo (self, QAbstractXmlReceiver?callback)` * `bool evaluateTo (self, QStringList?target)` * `bool evaluateTo (self, QIODevice?target)` * `bool evaluateTo (self, QString?output)` * `QString evaluateToString (self)` * `QStringList evaluateToStringList (self)` * `QXmlName initialTemplateName (self)` * `bool isValid (self)` * `QAbstractMessageHandler messageHandler (self)` * `QXmlNamePool namePool (self)` * `QNetworkAccessManager networkAccessManager (self)` * `QueryLanguage queryLanguage (self)` * `setFocus (self, QXmlItem?item)` * `bool setFocus (self, QUrl?documentURI)` * `bool setFocus (self, QIODevice?document)` * `bool setFocus (self, QString?focus)` * `setInitialTemplateName (self, QXmlName?name)` * `setInitialTemplateName (self, QString?name)` * `setMessageHandler (self, QAbstractMessageHandler?messageHandler)` * `setNetworkAccessManager (self, QNetworkAccessManager?newManager)` * `setQuery (self, QString?sourceCode, QUrl?documentUri?=?QUrl())` * `setQuery (self, QIODevice?sourceCode, QUrl?documentUri?=?QUrl())` * `setQuery (self, QUrl?queryURI, QUrl?baseUri?=?QUrl())` * `setUriResolver (self, QAbstractUriResolver?resolver)` * `QAbstractUriResolver uriResolver (self)` * * * ## Detailed Description 該QXmlQuery類執行的XQuery查詢XML數據,或仿照看起來像XML的非XML數據。 該QXmlQuery類編譯和執行寫入查詢[XQuery language](http://www.w3.org/TR/xquery/)。 QXmlQuery通常是用來查詢XML數據,但它也可以查詢已仿照看起來像XML的非XML數據。 使用QXmlQuery查詢XML數據,如下面的代碼片段,很簡單,因為它可以使用內置的[XML data model](qabstractxmlnodemodel.html)作為其代表來遍歷數據基礎查詢引擎。在指定了內置的數據模型[XQuery 1.0 and XPath 2.0 Data Model](http://www.w3.org/TR/xpath-datamodel/)。 ``` QXmlQuery query; query.setQuery("doc('index.html')/html/body/p[1]"); [QXmlSerializer](qxmlserializer.html) serializer(query, myOutputDevice); query.evaluateTo(&serializer); ``` 該示例使用QXmlQuery來匹配XML文檔的第一個段落,然后[output the result](qxmlserializer.html)到設備為XML。 使用QXmlQuery查詢_non-XML_數據需要寫入的子類[QAbstractXmlNodeModel](qabstractxmlnodemodel.html)作為替換為內置的XML數據模型的使用。自定義數據模型將能夠遍歷非XML數據所要求的[QAbstractXmlNodeModel](qabstractxmlnodemodel.html)接口。這個自定義數據模型的實例就變成使用的查詢引擎遍歷非XML數據的委讬。有關如何使用QXmlQuery查詢非XML數據,請參閱文檔的一個例子[QAbstractXmlNodeModel](qabstractxmlnodemodel.html)。 ### Running XQueries 要運行設置與QXmlQuery查詢,調用的評價功能之一。 * evaluateTo([QAbstractXmlReceiver](qabstractxmlreceiver.html) *) is called with a pointer to an XML [receiver](qabstractxmlreceiver.html), which receives the query results as a sequence of callbacks. The receiver callback class is like the callback class used for translating the output of a SAX parser. [QXmlSerializer](qxmlserializer.html), for example, is a receiver callback class for translating the sequence of callbacks for output as unformatted XML text. * evaluateTo([QXmlResultItems](qxmlresultitems.html) *) is called with a pointer to an iterator for an empty sequence of query [result items](qxmlresultitems.html). The Java-like iterator allows the query results to be accessed sequentially. * evaluateTo([QStringList](qstringlist.html) *) is like evaluateTo([QXmlResultItems](qxmlresultitems.html) *), but the query must evaluate to a sequence of strings. ### Running XPath Expressions XPath語言是的一個子集[XQuery](index.htm)語言,所以運行XPath表達式是一樣的運行[XQuery](index.htm)查詢。通過使用XPath表達式來QXmlQuery[setQuery](qxmlquery.html#setQuery)( ) 。 ### Running XSLT stylesheets 運行一個XSLT樣式表是喜歡跑步的[XQuery](index.htm),不同之處在于,當你構建你的QXmlQuery ,你必須通過[QXmlQuery.XSLT20](qxmlquery.html#QueryLanguage-enum)告訴QXmlQuery解釋不管它從得到[setQuery](qxmlquery.html#setQuery)( )作為XSLT樣式表,而不是一個[XQuery](index.htm)。您還必須通過調用設置輸入文件[setFocus](qxmlquery.html#setFocus)( ) 。 ``` QXmlQuery query(QXmlQuery.XSLT20); query.setFocus([QUrl](qurl.html)("myInput.xml")); query.setQuery([QUrl](qurl.html)("myStylesheet.xsl")); query.evaluateTo(out); ``` **Note:**目前,[setFocus](qxmlquery.html#setFocus)( )必須被調用_before_ [setQuery](qxmlquery.html#setQuery)( )使用XSLT時。 另一種方式來運行一個XSLT樣式表是使用`xmlpatterns`命令行實用程序。 ``` xmlpatterns myStylesheet.xsl myInput.xml ``` **Note:**對于目前的版本中, XSLT支持應考慮實驗。見[XSLT conformance](index.htm#xslt-2-0)了解詳情。 樣式表參數使用綁定[bindVariable](qxmlquery.html#bindVariable)( ) 。 ### Binding A Query To A Starting Node 當一個查詢被執行的XML數據,如代碼段所述,`doc()`函數返回的內置數據模型,其中的查詢評估將開始的節點。但是,當一個查詢運行在包含非XML數據的一個自定義節點模型[bindVariable](qxmlquery.html#bindVariable)( )函數必須調用一個變量名綁定到自定義模型的起始節點。澳元變量引用被用在[XQuery](index.htm)文字來訪問自定義模型的起始節點。這是沒有必要聲明外部查詢中的變量名。參見示例說明文檔中的[QAbstractXmlNodeModel](qabstractxmlnodemodel.html)。 ### Reentrancy and Thread-Safety QXmlQuery是可重入的,但不是線程安全的。它是安全使用QxmlQuery拷貝構造函數來創建查詢的副本,并執行相同的查詢多次。在幕后, QXmlQuery將重用,如打開的文件和編譯的查詢的資源盡可能。但它是不是安全使用QXmlQuery的同一實例中的多個線程。 ### Error Handling 可發生在查詢計算錯誤。例子包括錯誤類型和文件加載錯誤。當發生錯誤時: * The error message is sent to the [messageHandler](qxmlquery.html#messageHandler)(). * [QXmlResultItems.hasError](qxmlresultitems.html#hasError)() will return `true`, or [evaluateTo](qxmlquery.html#evaluateTo)() will return `false`; * The results of the evaluation are undefined. ### Resource Management 當查詢運行時,它會解析文件,分配內部數據結構來保存它們,則可能在網絡上加載其他資源。這時候可能會重復使用這些分配的資源,以避免重新加載并重新分析他們。 When [setQuery](qxmlquery.html#setQuery)()被調用時,該查詢的文本被編譯成一個內部數據結構,并進行了優化。優化的形式隨后可重復用于查詢的多個評估。由于編譯 - 優化的過程可以是昂貴的,它重復了同樣的查詢,應避免使用QXmlQuery的一個單獨的實例為每個查詢文本。 一旦文件被解析,它的內部表示保持在QXmlQuery實例,并在多個QXmlQuery實例共享。 實例[QCoreApplication](qcoreapplication.html)必須存在QXmlQuery才能使用。 ### Event Handling 當QXmlQuery訪問資源(例如,呼叫`fn:doc()`加載一個文件,或通過綁定變量訪問設備) ,事件循環使用,這意味著事件將被處理。為了避免處理事件時, QXmlQuery訪問的資源,在一個單獨的線程中創建您的QXmlQuery實例。 * * * ## Type Documentation ``` QXmlQuery.QueryLanguage ``` 指定是否要[QXmlQuery](qxmlquery.html)解釋輸入到[setQuery](qxmlquery.html#setQuery)()作為[XQuery](index.htm)或作為XSLT樣式表。 | Constant | Value | Description | | --- | --- | --- | | `QXmlQuery.XQuery10` | `1` | [XQuery](index.htm)1.0 。 | | `QXmlQuery.XSLT20` | `2` | XSLT 2.0的選擇,在W3C XML模式1.1的唯一性約束上找到了禁區XPath模式。除了限制的語法,表達式的類型檢查階段假定節點序列成為焦點。領域, W3C XML模式1.1的唯一性約束上找到了禁區XPath模式。除了限制的語法,表達式的類型檢查階段假定節點序列成為焦點。表示的XPath 2.0 。擁有公共API中沒有作用,它的內部使用。由于有了XmlSchema11IdentityConstraintSelector和XmlSchema11IdentityConstraintField ,表達式的類型檢查階段假定節點序列成為焦點。 | 這個枚舉被引入或修改的Qt 4.5 。 **See also** [setQuery](qxmlquery.html#setQuery)( ) 。 * * * ## Method Documentation ``` QXmlQuery.__init__ (self) ``` 構造不能使用,直到無效的,空的查詢[setQuery](qxmlquery.html#setQuery)()被調用。 **Note:**如果您打算使用這個這個構造函數必須不能使用[QXmlQuery](qxmlquery.html)處理XSL -T樣式表。其他的構造,必須在這種情況下被使用。 ``` QXmlQuery.__init__ (self, QXmlQuery?other) ``` 構造一個[QXmlQuery](qxmlquery.html)即副本_other_。新的實例將與現有的查詢盡可能共享資源。 ``` QXmlQuery.__init__ (self, QXmlNamePool?np) ``` 構建將使用一個查詢_np_正如它的名字池。該查詢不能被計算,直到[setQuery](qxmlquery.html#setQuery)( )被調用。 ``` QXmlQuery.__init__ (self, QueryLanguage?queryLanguage, QXmlNamePool?pool?=?QXmlNamePool()) ``` 構建體將被用來執行XQuery查詢或XSL -T樣式表的查詢,這取決于的值_queryLanguage_。它將使用_np_正如它的名字池。 **Note:**如果你的[QXmlQuery](qxmlquery.html)將處理XSL -T樣式表,這個構造函數必須被使用。默認的構造函數只能創建實例[QXmlQuery](qxmlquery.html)運行的XQuery 。 **Note:**本新聞稿中的XSL -T的支持,被認為是實驗性的。請參閱[XSLT conformance](index.htm#xslt-2-0)了解詳情。 此功能被引入Qt的4.5 。 **See also** [queryLanguage](qxmlquery.html#queryLanguage)( ) 。 ``` QXmlQuery.bindVariable (self, QXmlName?name, QXmlItem?value) ``` 綁定變量_name_到_value_使$_name_可以從查詢中用于指代的_value_。 _name_必須不_null_。_name_。 ISNULL( )必須返回False 。如果_name_已綁定由以前的bindVariable ( )調用,它以前的綁定將被改寫。 If _value_為null ,這樣_value_。 ISNULL( )返回True,_name_已經有約束力的,效果是消除了現有綁定_name_。 要綁定類型的值[QString](qstring.html) or [QUrl](qurl.html),包裝在一個值[QVariant](qvariant.html)這樣,[QXmlItem](qxmlitem.html)的[QVariant](qvariant.html)構造函數被調用。 由查詢處理的所有字符串必須是有效的[XQuery](index.htm)字符串,這意味著它們必須只包含XML 1.0字符。然而,這一要求沒有被選中。如果查詢處理一個無效的字符串,該行為是未定義的。 **See also** [QVariant.isValid](qvariant.html#isValid)( )[How QVariant maps to XQuery's Data Model](index.htm#qtxdm)和[QXmlItem.isNull](qxmlitem.html#isNull)( ) 。 ``` QXmlQuery.bindVariable (self, QXmlName?name, QIODevice) ``` 綁定變量_name_到_device_使$_name_可以從查詢中用于指代的_device_。該[QIODevice](qiodevice.html) _device_暴露于查詢作為類型的URI`xs:anyURI`,它可以被傳遞到`fn:doc()`函數來進行讀取。例如,該功能可用于在存儲器中通過XML文檔來`fn:doc`。 ``` [QByteArray](qbytearray.html) myDocument; [QBuffer](qbuffer.html) buffer(&myDocument); // This is a QIODevice. buffer.open([QIODevice](qiodevice.html).ReadOnly); [QXmlQuery](qxmlquery.html) query; query.bindVariable("myDocument", &buffer); query.setQuery("doc($myDocument)"); ``` 調用者必須確保_device_已被打開,至少[QIODevice.ReadOnly](qiodevice.html#OpenModeFlag-enum)在此之前綁定。否則,行為是未定義的。 如果該查詢將訪問包含在一個XML文檔[QString](qstring.html),使用[QBuffer](qbuffer.html)如下面的代碼片段所示。假設_myQString_包含`&lt;document&gt;content&lt;/document&gt;` ``` [QBuffer](qbuffer.html) device; device.setData(myQString.toUtf8()); device.open([QIODevice](qiodevice.html).ReadOnly); [QXmlQuery](qxmlquery.html) query; query.bindVariable("inputDocument", &device); query.setQuery("doc($inputDocument)/query[theDocument]"); ``` _name_必須不_null_。_name_。 ISNULL( )必須返回False 。如果_name_已綁定,其以前的綁定將被改寫。該URI,它_name_計算結果為是任意的,可能會改變。 如果該變量綁定的變化(例如,飛行如果同名一個以前的綁定是一個[QVariant](qvariant.html),或者,如果沒有先前的綁定) ,[isValid](qxmlquery.html#isValid)( )將返回`false`,并且需要查詢文本的重新編譯。重新編譯查詢,請致電[setQuery](qxmlquery.html#setQuery)( ) 。出于這個原因,[bindVariable](qxmlquery.html#bindVariable)( )之前,應叫[setQuery](qxmlquery.html#setQuery)() ,如果可能的話。 **Note:** _device_不能被刪除,而這[QXmlQuery](qxmlquery.html)存在。 ``` QXmlQuery.bindVariable (self, QXmlName?name, QXmlQuery?query) ``` 結合查詢的結果_query_,一個變量的名字_name_。 評價_query_當這個函數被調用時會被展開。 If _query_是無效的,行為是未定義的。_query_將被復制。 此功能被引入Qt的4.5 。 **See also** [isValid](qxmlquery.html#isValid)( ) 。 ``` QXmlQuery.bindVariable (self, QString?localName, QXmlItem?value) ``` 這是一個重載函數。 這個函數構造一個[QXmlName](qxmlname.html)從_localName_使用查詢的[namespace](qxmlnamepool.html)。然后,該函數的行為與重載函數。它等價于下面的代碼片段。 ``` [QXmlNamePool](qxmlnamepool.html) namePool(query.namePool()); query.bindVariable([QXmlName](qxmlname.html)(namePool, localName), value); ``` ``` QXmlQuery.bindVariable (self, QString?localName, QIODevice) ``` 這是一個重載函數。 If _localName_是一個有效的[NCName](qxmlname.html#isNCName),這個功能相當于下面的代碼片段。 ``` [QXmlNamePool](qxmlnamepool.html) namePool(query.namePool()); query.bindVariable([QXmlName](qxmlname.html)(namePool, localName), device); ``` A [QXmlName](qxmlname.html)從構造_localName_,并傳遞到帶有相應的過載_device_。 **See also** [QXmlName.isNCName](qxmlname.html#isNCName)( ) 。 ``` QXmlQuery.bindVariable (self, QString?localName, QXmlQuery?query) ``` 這是一個重載函數。 具有相同的行為和效果被重載的函數,但需要在變量名_localName_作為[QString](qstring.html)。_query_用作重載的函數。 此功能被引入Qt的4.5 。 ``` QXmlQuery.evaluateTo (self, QXmlResultItems?result) ``` 起動評價,并使其在可_result_。如果_result_為null,則行為是未定義的。評估發生增量(懶惰的評價) ,作為主叫方使用[QXmlResultItems.next](qxmlresultitems.html#next)()來獲取下一個結果。 **See also** [QXmlResultItems.next](qxmlresultitems.html#next)( ) 。 ``` bool QXmlQuery.evaluateTo (self, QAbstractXmlReceiver?callback) ``` 評估該查詢,并將其結果作為對一個序列的回調[receiver](qabstractxmlreceiver.html) _callback_。[QXmlQuery](qxmlquery.html)不采取所有權_callback_。 如果評估過程中發生錯誤,錯誤信息被發送到[messageHandler](qxmlquery.html#messageHandler)()和`false`返回。 如果此查詢[is invalid](qxmlquery.html#isValid),`false`返回和行為是未定義的。如果_callback_為空,行為是未定義的。 **See also** [QAbstractXmlReceiver](qabstractxmlreceiver.html)和[isValid](qxmlquery.html#isValid)( ) 。 ``` bool QXmlQuery.evaluateTo (self, QStringList?target) ``` 嘗試評估該查詢,并將結果返回在_target_ [string list](qstringlist.html)。 如果查詢[is valid](qxmlquery.html#isValid)和評估成功,則返回True 。否則,返回False,并且內容_target_是不確定的。 查詢必須評估為序列`xs:string`值。如果查詢不計算為一個字符串序列,這些值通常可以通過增加一個調用轉換`string()`在本月底[XQuery](index.htm)。 If _target_為null,則行為是未定義的。 ``` bool QXmlQuery.evaluateTo (self, QIODevice?target) ``` 評估查詢,序列化輸出為XML到_output_。 如果評估過程中發生錯誤,錯誤信息被發送到[messageHandler](qxmlquery.html#messageHandler)( )的內容_output_是不確定的,`false`返回,否則`true`返回。 If _output_ is `null`行為是不確定的。[QXmlQuery](qxmlquery.html)不采取所有權_output_。 在內部,類[QXmlFormatter](qxmlformatter.html)用于此。 此功能被引入Qt的4.5 。 ``` bool QXmlQuery.evaluateTo (self, QString?output) ``` 評估查詢或樣式表,并將輸出寫入到_target_。 [QXmlSerializer](qxmlserializer.html)用于將輸出寫入到_target_。在將來的版本中,它預計這一功能將被更改為尊重在樣式表中設置序列化選項。 如果評估過程中發生錯誤,錯誤信息被發送到[messageHandler](qxmlquery.html#messageHandler)()和`false`返回。 If _target_ is `null`或者是不是至少在開[QIODevice.WriteOnly](qiodevice.html#OpenModeFlag-enum)模式,其行為是未定義的。[QXmlQuery](qxmlquery.html)不采取所有權_target_。 這是一個重載函數。 此功能被引入Qt的4.5 。 ``` QString QXmlQuery.evaluateToString (self) ``` ``` QStringList QXmlQuery.evaluateToStringList (self) ``` ``` QXmlName QXmlQuery.initialTemplateName (self) ``` [](qxmlname.html) [返回XSL -T樣式表的模板,運行一個XSL -T樣式表時,處理器將調用的名頭。此功能僅在使用適用](qxmlname.html)[QXmlQuery](qxmlquery.html)處理XSL -T樣式表。缺省情況下,初始模板設置。在這種情況下,一個默認的構造[QXmlName](qxmlname.html)返回。 此功能被引入Qt的4.5 。 **See also** [setInitialTemplateName](qxmlquery.html#setInitialTemplateName)( ) 。 ``` bool QXmlQuery.isValid (self) ``` 返回True如果這個查詢是有效的。無效的查詢的例子是那些包含語法錯誤或者還沒有[setQuery](qxmlquery.html#setQuery)( )召之即來呢。 ``` QAbstractMessageHandler QXmlQuery.messageHandler (self) ``` [](qabstractmessagehandler.html) [返回處理這個編譯和運行時消息的消息處理程序](qabstractmessagehandler.html)[QXmlQuery](qxmlquery.html)。 **See also** [setMessageHandler](qxmlquery.html#setMessageHandler)( ) 。 ``` QXmlNamePool QXmlQuery.namePool (self) ``` [](qxmlnamepool.html) [返回此名稱池](qxmlnamepool.html)[QXmlQuery](qxmlquery.html)構建[names](qxmlname.html)。有沒有setter的名字池,因為混合池的名稱會導致錯誤,由于名稱的混亂。 ``` QNetworkAccessManager QXmlQuery.networkAccessManager (self) ``` [ 返回該網絡管理器,或0 ,如果它沒有被設置。 此功能被引入Qt的4.5 。 ](qnetworkaccessmanager.html) [**See also**](qnetworkaccessmanager.html) [setNetworkAccessManager](qxmlquery.html#setNetworkAccessManager)( ) 。 ``` QueryLanguage QXmlQuery.queryLanguage (self) ``` [](qxmlquery.html#QueryLanguage-enum) [返回一個值,指示這是什么](qxmlquery.html#QueryLanguage-enum)[QXmlQuery](qxmlquery.html)被用于。默認值是[QXmlQuery.XQuery10](qxmlquery.html#QueryLanguage-enum),這意味著[QXmlQuery](qxmlquery.html)被用于執行[XQuery](index.htm)和XPath查詢。[QXmlQuery.XSLT20](qxmlquery.html#QueryLanguage-enum)也可以退回,這表明[QXmlQuery](qxmlquery.html)是運行XSL -T電子表格。 此功能被引入Qt的4.5 。 ``` QXmlQuery.setFocus (self, QXmlItem?item) ``` 將焦點設置_item_。重點是一組上下文項表達式和路徑表達式從導航的項目。例如,在表達式_p/span_時,該元件_p_計算結果為是重點下面的表達式,_span_。 焦點可以使用上下文項表達式來訪問,即,點( “。”) 。 默認情況下,焦點未設置,是不確定的。因此,它會導致動態誤差,`XPDY0002`如果聚焦是試圖將被訪問。之前的查詢設置與重點必須設置[setQuery](qxmlquery.html#setQuery)( ) 。 沒有設置它為null的項定義的行為。 ``` bool QXmlQuery.setFocus (self, QUrl?documentURI) ``` 這是一個重載函數。 將焦點是位于文檔_documentURI_并返回True 。如果_documentURI_無法加載,則返回False。它是不確定在什么時候該文件可能被加載。當加載文檔,消息處理程序和URI解析器在此設置[QXmlQuery](qxmlquery.html)被使用。 If _documentURI_為空或不是一個有效的URI ,這個函數的行為是未定義的。 此功能被引入Qt的4.5 。 ``` bool QXmlQuery.setFocus (self, QIODevice?document) ``` 將焦點是_document_從讀[QIODevice](qiodevice.html)并返回True 。如果_document_無法加載,則返回False。 [QXmlQuery](qxmlquery.html)不采取所有權_document_。用戶可以保證一個文件是可從_document_設備與該文件是不是空的。該設備必須至少在只讀模式打開。_document_必須保持在范圍只要當前查詢是活動的。 這是一個重載函數。 此功能被引入Qt的4.5 。 ``` bool QXmlQuery.setFocus (self, QString?focus) ``` 這個函數的作用相同,調用[setFocus](qxmlquery.html#setFocus)( )過載與[QIODevice](qiodevice.html)其內容是_focus_編碼為UTF- 8 。即,_focus_被視為它包含在XML文檔。 返回作為過載相同的結果。 這是一個重載函數。 此功能被引入Qt的4.6 。 ``` QXmlQuery.setInitialTemplateName (self, QXmlName?name) ``` 設置_name_初始模板。初始模板,而不是試圖匹配模板的上下文節點(如果有的話)一個處理器調用第一個。如果初始模板沒有設置,模板調用的標準順序將被使用。 此功能僅在使用適用[QXmlQuery](qxmlquery.html)處理XSL -T樣式表。該名稱將成為編譯的樣式表的一部分。因此,這個函數必須在調用之前調用[setQuery](qxmlquery.html#setQuery)( ) 。 如果樣式表沒有命名模板_name_,該處理器將使用模板調用的標準順序。 此功能被引入Qt的4.5 。 **See also** [initialTemplateName](qxmlquery.html#initialTemplateName)( ) 。 ``` QXmlQuery.setInitialTemplateName (self, QString?name) ``` 這是一個重載函數。 設置初始模板的名稱,以_localName_,它必須是一個有效的[local name](qxmlname.html#localName)。初始模板,而不是試圖匹配模板的上下文節點(如果有的話)一個處理器調用第一個。如果初始模板沒有設置,模板調用的標準順序將被使用。 此功能僅在使用適用[QXmlQuery](qxmlquery.html)處理XSL -T樣式表。該名稱將成為編譯的樣式表的一部分。因此,這個函數必須在調用之前調用[setQuery](qxmlquery.html#setQuery)( ) 。 If _localName_不是一個有效的[local name](qxmlname.html#localName),效果是不確定的。如果樣式表沒有命名模板_localName_,該處理器將使用模板調用的標準順序。 此功能被引入Qt的4.5 。 **See also** [initialTemplateName](qxmlquery.html#initialTemplateName)( ) 。 ``` QXmlQuery.setMessageHandler (self, QAbstractMessageHandler?messageHandler) ``` 更改[message handler](qabstractmessagehandler.html)這[QXmlQuery](qxmlquery.html)至_aMessageHandler_。該查詢將所有的編譯和運行時消息,此消息處理程序。[QXmlQuery](qxmlquery.html)不采取所有權_aMessageHandler_。 通常情況下,默認的消息處理就足夠了。它寫的編譯和運行時消息,_stderr_。默認的消息處理程序,包括顏色代碼,如果_stderr_可以使色彩。 請注意,更改消息處理程序查詢已經編譯后沒有效果,即查詢在運行時使用相同的消息處理程序,它使用在編譯時。 When [QXmlQuery](qxmlquery.html)電話[QAbstractMessageHandler.message](qabstractmessagehandler.html#message)( ) ,參數如下: | message() argument | Semantics | | --- | --- | | [QtMsgType](index.htm#QtMsgType-enum) type | Only [QtWarningMsg](index.htm#QtMsgType-enum) and [QtFatalMsg](index.htm#QtMsgType-enum) are used. The former identifies a compile or runtime warning, while the latter identifies a dynamic or static error. | | const [QString](qstring.html) & description | An XHTML document which is the actual message. It is translated into the current language. | | const [QUrl](qurl.html) &identifier | Identifies the error with a URI, where the fragment is the error code, and the rest of the URI is the error namespace. | | const [QSourceLocation](qsourcelocation.html) & sourceLocation | Identifies where the error occurred. | **See also** [messageHandler](qxmlquery.html#messageHandler)( ) 。 ``` QXmlQuery.setNetworkAccessManager (self, QNetworkAccessManager?newManager) ``` 設置網絡管理員_newManager_。[QXmlQuery](qxmlquery.html)不采取所有權_newManager_。 此功能被引入Qt的4.5 。 **See also** [networkAccessManager](qxmlquery.html#networkAccessManager)( ) 。 ``` QXmlQuery.setQuery (self, QString?sourceCode, QUrl?documentUri?=?QUrl()) ``` 此套[QXmlQuery](qxmlquery.html)到[XQuery](index.htm)從讀_sourceCode_設備。該設備必須已經打開了至少[QIODevice.ReadOnly](qiodevice.html#OpenModeFlag-enum)。 _documentURI_表示從得到的查詢_sourceCode_設備。它是靜態上下文的基URI ,如在定義[XQuery language](http://www.w3.org/TR/xquery/)。它在內部使用,以解決出現在查詢中相對URI ,以及消息的報告。_documentURI_可以為空。如果為空,則[application file path](qcoreapplication.html#applicationFilePath)被使用。如果不是空的,它可以是相對的或絕對的。如果是相對的,它解決了自身對[application file path](qcoreapplication.html#applicationFilePath)之前就被采用。如果_documentURI_既不是一個有效的URI ,也沒有空,其結果是不確定的。 如果查詢包含一個靜態錯誤(如語法錯誤) ,則錯誤消息被發送到[messageHandler](qxmlquery.html#messageHandler)()和[isValid](qxmlquery.html#isValid)( )將返回_false_。 變量必須setQuery前綁定( )被調用。 的編碼[XQuery](index.htm)在_sourceCode_檢測到內部使用的規則來設置和檢測編碼[XQuery](index.htm)文件,這些文件中的解釋[XQuery language](http://www.w3.org/TR/xquery/)。 If _sourceCode_ is `null`或無法讀取,或者如果_documentURI_是不是一個有效的URI ,行為是未定義的。 **See also** [isValid](qxmlquery.html#isValid)( ) 。 ``` QXmlQuery.setQuery (self, QIODevice?sourceCode, QUrl?documentUri?=?QUrl()) ``` 此套[QXmlQuery](qxmlquery.html)到[XQuery](index.htm)從讀_queryURI_。使用[isValid](qxmlquery.html#isValid)( )調用此函數后。如果發生讀取錯誤_queryURI_比如,查詢不存在,無法讀取,或者是無效的,[isValid](qxmlquery.html#isValid)( )將返回_false_。 所支持的URI方案是相同的[XQuery](index.htm)功能`fn:doc`,除了queryURI可以是一個變量綁定的對象。 _baseURI_是靜態上下文的基URI ,如定義[XQuery language](http://www.w3.org/TR/xquery/)。它在內部使用,以解決出現在查詢中相對URI ,以及消息的報告。如果_baseURI_是空的,_queryURI_被使用。否則,_baseURI_被使用,并且它解決了對[application file path](qcoreapplication.html#applicationFilePath)如果它是相對的。 If _queryURI_為空或無效,或者如果_baseURI_是無效的,這個函數的行為是未定義的。 ``` QXmlQuery.setQuery (self, QUrl?queryURI, QUrl?baseUri?=?QUrl()) ``` 這是一個重載函數。 這個函數的行為和要求是一樣的setQuery ([QIODevice](qiodevice.html)* ,常量[QUrl](qurl.html)&),后[XQuery](index.htm)已經讀取的IO設備插入一個字符串。因為_sourceCode_已經是一個Unicode字符串,檢測它的編碼是不必要的。 ``` QXmlQuery.setUriResolver (self, QAbstractUriResolver?resolver) ``` 設置的URI解析器_resolver_。[QXmlQuery](qxmlquery.html)不采取所有權_resolver_。 **See also** [uriResolver](qxmlquery.html#uriResolver)( ) 。 ``` QAbstractUriResolver QXmlQuery.uriResolver (self) ``` [](qabstracturiresolver.html) [返回查詢的URI解析器。如果沒有的URI解析器已定,](qabstracturiresolver.html)[QtXmlPatterns](index.htm)將使用的URI的查詢,因為它們。 這個URI解析器提供了一個抽象層,或_polymorphic URIs_。解析器可以重寫_logical_URI與物理的,或者它可以翻譯過時的或無效的URI來有效的。 [QtXmlPatterns](index.htm)調用的URI解析器遇到所有的URI ,除了命名空間。具體而言,所有內建的函數來處理的URI (`fn:doc()`和`fn:doc-available()`) 。 在的情況下`fn:doc()`,絕對URI是基URI在靜態情況下(這最有可能是查詢的位置) 。而不是使用URI指定的用戶的返回值[QAbstractUriResolver.resolve](qabstracturiresolver.html#resolve)()將被使用。 When [QtXmlPatterns](index.htm)電話[QAbstractUriResolver.resolve](qabstracturiresolver.html#resolve)( )的絕對URI是由授權的URI[XQuery](index.htm)語言,相對URI是由用戶指定的URI。 **See also** [setUriResolver](qxmlquery.html#setUriResolver)( ) 。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看