PDA

View Full Version : Problem parsing dynamically generated XML


johncorro
11-04-2004, 05:01 AM
I have a servlet that generates dynamic XML content that I consume w/ the dataset class. For this specific situation, I process 3 peer nodes w/ an XPath query (just like in example 2.1 at http://www.laszlosystems.com/lps-2.2/docs/guide/data-tutorial.html#d0e4671).

The problem is that when I process the XML generated from the servlet, only 1 node is being processed (despite all 3 being present). If I invoke the servlet directly from the browser, copy the generated content, paste into a staticly defined dataset in the LZX file, and re-run the LZX file...all 3 nodes are magically processed. The LZX file isn't changed (except for changing the dataset from invoking the servlet to just have staticly declared XML in it).

Can anyone lend any insight or wisdom to help me resolve this problem?

jawadz
11-05-2004, 11:47 AM
I think you are writing the XML, as it is getting available, to the output stream right away. Instead, write the whole XML data to a string and then print the entire string to the output stream. This will give all the data to LZX at once and it will get processed fine. Actually what happens is the LZX goes through all the nodes, it just keeps overwriting them and once the data is finished, you are left with just the last node.

Hope this helps.