[xsd-users] Returning data by criteria

Bidski bidski at bigpond.net.au
Tue Feb 16 03:56:55 EST 2010


Hello all,

I was wondering if it is possible to selectively return certain data from a xml file, the same as you would if you were using SQL statements with a database. As an example, say this is our xml file.

<?xml version="1.0"?>

<people>

    <person>

        <first-name>John</first-name>

        <last-name>Doe</last-name>

        <gender>male</gender>

        <age>32</age>

    </person>

    <person>

        <first-name>Jane</first-name>

        <last-name>Doe</last-name>

        <gender>female</gender>

        <age>28</age>

    </person>

</people>



Is it possible to just get the data pertaining to John Doe's record? Or to return, say, the age of every male that is listed in the xml file (assuming that we had more records). I know that with the cxx/parser you can retrieve the data of specific fields (i.e. age and gender only) but from what I can  tell you still have to get that information for every record. Am I wrong here? Is it possible to return only the information pertaining to 1 (or less than all) records?



My problem is that each record in my xml file has a minimum of 39 fields (with an extra 4 fields being able to occur anywhere from 0-????? times) and, currently, I have about 1,800 records. I originally tried using the cxx/tree method, just to see how it worked, with the results being slow and very memory consuming (this file in particular took up about 25MB memory) and caused me to re-shuffle some of my variables to avoid stack overflows. Now I am using the cxx/parser method, which has reduced memory consumption down to about 3MB or so, but the parsing is still sluggish (takes roughly 4-7 seconds to parse the file, depending on how many fields I am interested in).

So is it possible to just return singular records, or parts of singular records?



Thanks in advance

Bidski


More information about the xsd-users mailing list