PDA

View Full Version : Best way to read xml



steg90
26th September 2007, 10:04
Hi,

I have the following XML :



<WORKSPACE>
<CANCHANNELS>
<CAN id="1" baud="500" view="S">
<FILTER type="PASS" ACCEPT="000" MASK="000" EXTENDED="0" FILTERONID="1">
<CANFILTERS>
<FILTERS ID="7e8" />
<FILTERS ID="2e8" />
<FILTERS ID="3e8" />
</CANFILTERS>
</FILTER>
</CAN>
<CAN id="2" baud="125" view="C">
<FILTER type="PASS" ACCEPT="000" MASK="000" EXTENDED="0" FILTERONID="1">
<CANFILTERS>
<FILTERS ID="4e8" />
<FILTERS ID="5e8" />
</CANFILTERS>
</FILTER>
</CAN>
</CANCHANNELS>
</WORKSPACE>


Just wondering if QXmlStreamReader is the way to go to read it in?

Thanks for any advice,
Steve

wysota
26th September 2007, 10:46
I'd use the DOM approach (QDomDocument and friends) but it depends on what exactly you want to do with the data.

steg90
26th September 2007, 11:06
Thanks,

Just want to read the xml into some structures I will be creating.

I have just used QXmlStreamReader object, seemed easy enough.

Brandybuck
26th September 2007, 17:38
I haven't used the new stream reader, but if you're just reading into a structure, it sounds the way to go.