Dear all,
I am using CVI 8.0.1 with the cvixml.fp 'xml-driver'/parser. When I retrieve a list of elements using: CVIXMLFindElements,
I get the 'feeling' that the elements are placed in the ListType in a strange order.
My code pretty much looks like this:
#define FILE_PATH "test2.xml"
void xmlTest2(){
CVIXMLDocument cfgDoc = 0;
CVIXMLElement currElem = 0,child=0;
ListType elementList = 0;
char valueBuffer[10];
int numberOfElements,cntr;
//load the doc
CVIXMLLoadDocument (FILE_PATH, &cfgDoc);
//get the root
CVIXMLGetRootElement (cfgDoc, &currElem);
//get the childeren we want
CVIXMLFindElements (currElem,"a",&elementList);
//get the number of elements
numberOfElements = ListNumItems (elementList);
//go through all elements
for(cntr=0;cntr<numberOfElements;cntr++){
//get next element
ListGetItem (elementList, &child, cntr);
//get the value of the element
CVIXMLGetElementValue(child,valueBuffer);
//print fvalue
printf("%s\n",valueBuffer);
}
//don't bother memory clean-up for now, or is that the problem ?
}
the xml file looks like this:
<?xml version="1.0"?>
<root>
<a>1</a>
<a>2</a>
<a>3</a>
<a>4</a>
<a>5</a>
</root>
The print out is like this:
5
1
2
3
4
Any thoughts ? Thanks in advance !