VTD doc parsing - cannot read any nodes

I am trying to parse a document but i cannot read any of the nodes.

DATASTREAM4 is a series of

The plan is to have a header (static string value), row (each iteration of sotransitem), and tail (static string value to close out the xml).

Using the string xmlbuild, I add the header then loop through each of the rows in DATASTREAM4.
It should look at a single value, compare it to the last, then do a series depending on the results. At the end of it all it adds the tail to close everything out.

If I use el.getText() it will read the entire sotransitem as expected. I can take that from each loop and append it to the string like so…

If i try to use any child nodes I get a null pointer.
I tried el.getFirstChild()…null
I cannot access any actual data within sotransitem

I can only guess that it is simply a literal string that VTD cant see as an XML and I need to tell it that it is XML or convert it somehow.

Could it be something to do with it being wrapped in cdata? Any other ideas?


The content of the item node is an xml string wrapped by CDATA.

For each item node, you need to parse that xml string content into its own VTDDocument, then you can navigate it.

Like this:

VTDDocument itemDoc = new VTDDocument(el.getText());

ahh ok. That makes sense. I assumed it wrote the entire thing to a doc and I could read through it.


Nevermind. figured out this myself.

Ignore the man behind the curtain…