0

調べたい大きな XML ファイル (2000 ~ 3000 行) があります。目的は、Qtreeview 内のすべてのデータを表示し、間違っている可能性のあるデータを強調することです。

Qt の例 (XBEL) と Jasmin Blanchette の本でテストしましたが、例としては役に立ちませんでした (さらに、XMLStream がサポートされなくなったことを認識しています)。

Qtreeview で強調表示されたデータの一部を解析して表示する最良の方法は何ですか? (QTreeview は私の例でのデータ解釈のためだけのものです。私はそれを処理する方法を知っています)

解析するファイルの抜粋:

<Description xmlns="file://DeviceDescription-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.software.com/schemas/Description-1.0.xsd Description-1.0.xsd file://Description-1.0.xsd OEMcCustom.xsd " xmlns:se="file://Description-1.0.xsd">
  <Connector connectorId="1" explicit="false" hostpath="-1" interface="Serial" moduleType="91" role="child" alwaysmapping="true">
        <Parameter ParameterId="8000" type="std:BOOL">
            <Attributes download="false" offlineaccess="read" />
            <Default>true</Default>
            <Name>NameConfig</Name>
            <Description>Use the new NameConfig format</Description>
        </Parameter>
        <Parameter ParameterId="12345692" type="localTypes:CHANNEL_PACKED">
                    <Attributes />
                    <Default>
                        <Element name="FunctionCode">3</Element>
                        <Element name="ReadOffset">16#0000</Element>
                        <Element name="ReadLength">4</Element>
                        <Element name="WriteOffset">0</Element>
                        <Element name="WriteLength">0</Element>
                        <Element name="Trigger">5</Element>
                        <Element name="CycleTime">100</Element>
                        <Element name="ErrorHandling">true</Element>
                        <Element name="EnableRegisterBitMapping" />
                    </Default>
                    <Name>Channel 1</Name>
                    <Description>ChannelConfig</Description>
                </Parameter>    
  </Connector>
</Description>
4

1 に答える 1

1

http://qt-project.org/doc/qt-5.1/qtxml/qtxml-module.html

ページの下部にある説明に注意してください。

モジュールはもはや積極的に保守されていません。代わりに Qt Coreの クラスQXmlStreamReaderとクラスを使用してください 。QXmlStreamWriter

http://qt-project.org/doc/qt-5.1/qtcore/qxmlstreamreader.html#details

これを理解して使用するにはしばらく時間がかかりますが、最速のはずです。すべてのデータ検証とエラー チェックを取得するのは少し面倒かもしれませんが、実行可能です。

それをツリービューに追加するには、もう少し考えなければならないかもしれません...しかし、ここにいくつかの指針があります:

http://qt-project.org/doc/qt-5.1/qtwidgets/qtreeview.html#details

http://qt-project.org/doc/qt-4.8/itemviews-simpledommodel.html

http://qt-project.org/doc/qt-4.8/examples-xml.html

それでもまだ十分なリンクがない場合は、さらにいくつかのリンクを次に示します。

http://qt-project.org/doc/qt-4.8/qsimplexmlnodemodel.html#details

http://qt-project.org/doc/qt-4.8/xmlpatterns-filetree.html

それが役立つことを願っています。

于 2013-10-25T20:59:19.560 に答える