D
deodiaus
I am trying to read this xml
---------------- begin xml ----------
<Aqrun2dCapDialog>
<AqRSDialog>
<userprefixfield></userprefixfield>
<m_rsName>RunScripts.ksh</m_rsName>
</AqRSDialog>
<singlevalfield>0.1</singlevalfield>
<rangefromvalfield>0.1</rangefromvalfield>
<rangetovalfield></rangetovalfield>
<varlist><varitem0>M1 Total thickness From: 0.135 To: 0.139 Step:
0.001</varitem0>
<varitem1>M1 Signal line width 0.1,.2</varitem1>
</varlist>
</Aqrun2dCapDialog>
------------- end xml -----------------
but having a problem in that the code seems to not treat <varitem0>
<varitem0> independently, as 2 separate fields, rather as 1 entitiy,
i.e. the text reads
tagName={varitem} tagText={M1 Total thickness From: 0.135 To: 0.139
Step:
0.001M1 Signal line width 0.1,.2}
rather than the desired output
tagName={varitem0} tagText={M1 Total thickness From: 0.135 To: 0.139
Step:
0.001}
tagName={varitem1} tagText={M1 Signal line width 0.1,.2}
using the sample QT code from www.trolltech.com 's help
if (AqmainWindow::m_pDoc) delete AqmainWindow::m_pDoc;
AqmainWindow::m_pDoc = new QDomDocument( "mydocument" );
QFile f( filenameAqs.latin1() );
if ( !f.open( IO_ReadOnly ) )
return;
if ( !AqmainWindow::m_pDoc->setContent( &f ) ) {
f.close();
return;
}
f.close();
QDomElement docElem = AqmainWindow::m_pDoc->documentElement();
if( !docElem.isNull() ) { // the node was really an element.
#ifdef _DEBUG
cout <<" documentElementName={" << docElem.tagName() << "}" <<
endl;
#endif//_DEBUG
}
QDomNode n = docElem.firstChild();
while( !n.isNull() ) {
QDomElement e = n.toElement();
if( !e.isNull() ) { // the node was really an element.
#ifdef _DEBUG
cout <<" tagName={" << e.tagName() << "} tagText={" <<
e.text().latin1()<< "}" << endl;
#endif//_DEBUG
if (e.tagName() == "Aqrun2dCapDialog" ) {
Aqrun2dCapDialog::m_bSettingsAqsExist = true;
}
} n = n.nextSibling();
}
---------------- begin xml ----------
<Aqrun2dCapDialog>
<AqRSDialog>
<userprefixfield></userprefixfield>
<m_rsName>RunScripts.ksh</m_rsName>
</AqRSDialog>
<singlevalfield>0.1</singlevalfield>
<rangefromvalfield>0.1</rangefromvalfield>
<rangetovalfield></rangetovalfield>
<varlist><varitem0>M1 Total thickness From: 0.135 To: 0.139 Step:
0.001</varitem0>
<varitem1>M1 Signal line width 0.1,.2</varitem1>
</varlist>
</Aqrun2dCapDialog>
------------- end xml -----------------
but having a problem in that the code seems to not treat <varitem0>
<varitem0> independently, as 2 separate fields, rather as 1 entitiy,
i.e. the text reads
tagName={varitem} tagText={M1 Total thickness From: 0.135 To: 0.139
Step:
0.001M1 Signal line width 0.1,.2}
rather than the desired output
tagName={varitem0} tagText={M1 Total thickness From: 0.135 To: 0.139
Step:
0.001}
tagName={varitem1} tagText={M1 Signal line width 0.1,.2}
using the sample QT code from www.trolltech.com 's help
if (AqmainWindow::m_pDoc) delete AqmainWindow::m_pDoc;
AqmainWindow::m_pDoc = new QDomDocument( "mydocument" );
QFile f( filenameAqs.latin1() );
if ( !f.open( IO_ReadOnly ) )
return;
if ( !AqmainWindow::m_pDoc->setContent( &f ) ) {
f.close();
return;
}
f.close();
QDomElement docElem = AqmainWindow::m_pDoc->documentElement();
if( !docElem.isNull() ) { // the node was really an element.
#ifdef _DEBUG
cout <<" documentElementName={" << docElem.tagName() << "}" <<
endl;
#endif//_DEBUG
}
QDomNode n = docElem.firstChild();
while( !n.isNull() ) {
QDomElement e = n.toElement();
if( !e.isNull() ) { // the node was really an element.
#ifdef _DEBUG
cout <<" tagName={" << e.tagName() << "} tagText={" <<
e.text().latin1()<< "}" << endl;
#endif//_DEBUG
if (e.tagName() == "Aqrun2dCapDialog" ) {
Aqrun2dCapDialog::m_bSettingsAqsExist = true;
}
} n = n.nextSibling();
}