[xsd-users] parsing using cxx/tre. Possible?

Henric Zazzi hzazzi at kth.se
Tue Mar 4 07:03:40 EST 2014


Hi

I am at the moment developing a parser using cxx/tree, and would like to parse the files since they can be quite big.
I know that you can use cxx/parser for this, but I have already built some code using cxx/tree, and also am worried
that my XML is too complex for cxx/parser.

I have tried one approach where I open a XML file like....

<head>
     <level1>
           <level2>
                <level3>
                     <value1>MyValue</value1>
                     <value2>MyValue</value2>
                     <value3>MyValue</value3>
                     <value4>MyValue</value4>
                </level3>
                .....
            </level2>
            .....
      </level1>
</head>

Insteaod of just loading the whole XML tree with
auto_ptr <head> p (head_(file))

I open the file for streaming and search for the <level3> tag, I then reset the filepointer to the same
row as the <level3> tag and...
auto_ptr<level3> p (level3_(streamfilepointer))
This would permit me to only load into RAM the <level3> object and not the whole tree.
Unfortunately it did not work since it gave an error upoen execution saying "element p not recognized" or something similar.
Have I missed something or is this approach feasible??

Are there any ways to achieve to stream an XML file using CodeSynthesis cxx/tree??

With kind regards
Henric Zazzi



More information about the xsd-users mailing list