Obsolete Members for QDomDocument

以下成員源於類 QDomDocument 被棄用。 提供它們是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它們。

公共函數

(deprecated (6.8)) bool setContent (const QByteArray & data , bool namespaceProcessing , QString * errorMsg = nullptr, int * errorLine = nullptr, int * errorColumn = nullptr)
(deprecated (6.8)) bool setContent (const QString & text , bool namespaceProcessing , QString * errorMsg = nullptr, int * errorLine = nullptr, int * errorColumn = nullptr)
(deprecated (6.8)) bool setContent (QIODevice * dev , bool namespaceProcessing , QString * errorMsg = nullptr, int * errorLine = nullptr, int * errorColumn = nullptr)
(deprecated (6.8)) bool setContent (const QByteArray & buffer , QString * errorMsg , int * errorLine = nullptr, int * errorColumn = nullptr)
(deprecated (6.8)) bool setContent (const QString & text , QString * errorMsg , int * errorLine = nullptr, int * errorColumn = nullptr)
(deprecated (6.8)) bool setContent (QIODevice * dev , QString * errorMsg , int * errorLine = nullptr, int * errorColumn = nullptr)
(deprecated (6.8)) bool setContent (QXmlStreamReader * reader , bool namespaceProcessing , QString * errorMsg = nullptr, int * errorLine = nullptr, int * errorColumn = nullptr)

成員函數文檔編製

bool QDomDocument:: setContent (const QByteArray & data , bool namespaceProcessing , QString * errorMsg = nullptr, int * errorLine = nullptr, int * errorColumn = nullptr)

This function is deprecated since 6.8. We strongly advise against using it in new code.

Use the overload taking ParseOptions 代替。

這是重載函數。

此函數剖析 XML 文檔從字節數組 data 並將它設為文檔內容。它試著按 XML 規範要求檢測文檔編碼。

namespaceProcessing 為 true,剖析器識彆 XML 文件中的名稱空間並將前綴名稱、本地名稱和名稱空間 URI 設為適當值。若 namespaceProcessing 為 false,剖析器不處理名稱空間當它讀取 XML 文件時。

若齣現剖析錯誤,此函數返迴 false 且錯誤消息放置於 * errorMsg ,行號在 * errorLine 和列號在 * errorColumn (unless the associated pointer is set to nullptr ); otherwise this function returns true .

namespaceProcessing 為 true,函數 QDomNode::prefix () 返迴所有元素和屬性的字符串。它返迴空字符串,若元素或屬性沒有前綴。

僅剝離由空白組成的文本節點,且不會齣現在 QDomDocument .

namespaceProcessing 為 false,函數 QDomNode::prefix (), QDomNode::localName () 和 QDomNode::namespaceURI () 返迴空字符串。

實體引用處理如下:

  • 包括齣現在內容中的內部一般實體和字符實體的引用。結果是 QDomText 節點,具有被其相應實體值所替換的引用。
  • 包括齣現在內部子集中的參數實體的引用。結果是 QDomDocumentType 節點,包含實體和符號聲明 (具有被其相應實體值所替換的引用)。
  • 未在內部子集中定義且齣現在內容中的任何一般剖析實體引用,被錶示成 QDomEntityReference 節點。
  • 任何未在內部子集中定義且齣現在內容之外的經剖析實體引用,都被替換為空字符串。
  • 任何未剖析實體引用被替換為空字符串。

另請參閱 QDomNode::namespaceURI (), QDomNode::localName (), QDomNode::prefix (), QString::isNull (),和 QString::isEmpty ().

bool QDomDocument:: setContent (const QString & text , bool namespaceProcessing , QString * errorMsg = nullptr, int * errorLine = nullptr, int * errorColumn = nullptr)

This function is deprecated since 6.8. We strongly advise against using it in new code.

這是重載函數。

Use the overloads taking ParseOptions 代替。

此函數讀取 XML 文檔從字符串 text ,返迴 true 若內容被成功剖析;否則返迴 false 。由於 text 已經是 Unicode 字符串,不用做編碼檢測。

bool QDomDocument:: setContent ( QIODevice * dev , bool namespaceProcessing , QString * errorMsg = nullptr, int * errorLine = nullptr, int * errorColumn = nullptr)

This function is deprecated since 6.8. We strongly advise against using it in new code.

這是重載函數。

Use the overload taking ParseOptions 代替。

此函數讀取 XML 文檔從 IO 設備 dev ,返迴 true 若內容被成功剖析;否則返迴 false .

注意: This method will try to open dev in read-only mode if it is not already open. In that case, the caller is responsible for calling close. This will change in Qt 7, which will no longer open dev . Applications should therefore open the device themselves before calling setContent.

bool QDomDocument:: setContent (const QByteArray & buffer , QString * errorMsg , int * errorLine = nullptr, int * errorColumn = nullptr)

This function is deprecated since 6.8. We strongly advise against using it in new code.

這是重載函數。

Use the overload returning ParseResult 代替。

此函數讀取 XML 文檔從字節數組 buffer ,返迴 true 若內容被成功剖析;否則返迴 false。

不履行名稱空間處理。

bool QDomDocument:: setContent (const QString & text , QString * errorMsg , int * errorLine = nullptr, int * errorColumn = nullptr)

This function is deprecated since 6.8. We strongly advise against using it in new code.

這是重載函數。

Use the overload returning ParseResult 代替。

此函數讀取 XML 文檔從字符串 text ,返迴 true 若內容被成功剖析;否則返迴 false 。由於 text 已經是 Unicode 字符串,不用履行編碼檢測。

也不履行名稱空間處理。

bool QDomDocument:: setContent ( QIODevice * dev , QString * errorMsg , int * errorLine = nullptr, int * errorColumn = nullptr)

This function is deprecated since 6.8. We strongly advise against using it in new code.

這是重載函數。

Use the overload returning ParseResult 代替。

此函數讀取 XML 文檔從 IO 設備 dev ,返迴 true 若內容被成功剖析;否則返迴 false .

不履行名稱空間處理。

bool QDomDocument:: setContent ( QXmlStreamReader * reader , bool namespaceProcessing , QString * errorMsg = nullptr, int * errorLine = nullptr, int * errorColumn = nullptr)

This function is deprecated since 6.8. We strongly advise against using it in new code.

這是重載函數。

Use the overload taking ParseOptions 代替。

此函數讀取 XML 文檔從 QXmlStreamReader reader 並剖析它。返迴 true 若內容被成功解析;否則返迴 false .

namespaceProcessing is true ,剖析器識彆 XML 文件中的名稱空間並將前綴名稱、本地名稱和名稱空間 URI 設為適當值。若 namespaceProcessing is false ,剖析器不處理名稱空間當它讀取 XML 文件時。

若齣現剖析錯誤,錯誤消息放置在 * errorMsg ,行號在 * errorLine 和列號在 * errorColumn (unless the associated pointer is set to nullptr ).

另請參閱 QXmlStreamReader .