From: Din S. <di...@ya...> - 2006-08-02 05:21:28
|
Hi, I have explored woodstox also, issue with STAX parsers that I am having is I need to build complete xml, whereas in vtd or sax i can get the fragment and write it to a file. Example <persons> <person> <name>name1</name> <age>22</age> <address>address</address> </person> <person> . . </person> . . </persons> Now I want to put say 10 person records in file 1and so on, with vtd, i will get the fragment and I will write that to file, with sax also I can get entire person record, but with SAX, I don't get the complete person record. So I have to create a XMLWriter, use, functions like writeStartElement, writeAttribute, etc. Basically building the entire structure which is already there. Please let me know if there is a way to extract the complete person record. Thanks. --- Tatu Saloranta <cow...@ya...> wrote: > --- Din Sush <di...@ya...> wrote: > > > Well I only need to split the document and don't > > need > > to go back to parsed document, and I don't need > DOM > > like functionality. > > > > Will VTD-XML be still better in this scenario. > > I would suggest that if you do have time, you > investigate both using VTD-XML, and a Stax > implementation (such as > http://woodstox.codehaus.org). > My feeling is that it all comes down to which one > API > you feel more comfortable with, or perhaps whether > have to use a xml-compliant standard-based solution > or > not. > Both can perform well enough, assuming you are not > limited by VTD-XML due to main memory requirements. > Stax memory usage is not linear with document > length, > so there are no practical input size limitations. > > If you do end up both approaches, it would be very > nice to get the performance numbers, since this > would > be an actual real-world use case, instead of > benchmarks. Plus if code is simple enough, perhaps > it > could become a benchmark for these types of > operations? > > > Secondly as the entire document needs to be loaded > > in > > the memory, the whole idea of splitting is that I > am > > getting "Out of Memory" error won't I get the same > > error when I am using VTD-XML, than it kind of > > defeats > > the purpose. Correct me if I am wrong in the > > interpretation as I have never used VTD. > > You are correct here. While limit is much higher > than > with, say, DOM (2x or perhaps 3x), there is a limit. > > -+ Tatu +- > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam > protection around > http://mail.yahoo.com > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |