I am using the Structured Data --> XML --> XML Reader to import some XML into KNIME columns. In another node, I wish to read that XML and something funny happens:
This line...
XMLCell xmlcell = (XMLCell) row.getCell(1);
...yields this ERROR: Execute failed: org.knime.core.data.xml.XMLBlobCell cannot be cast to org.knime.core.data.xml.XMLCell
But...: Execute failed: org.knime.core.data.xml.XMLCell cannot be cast to org.knime.core.data.xml.XMLBlobCell
What is going on? Can't cast to either and both are telling me it's the other one? Maybe I am missing something obvious here, but any pointers would be greatly appreciated.
Further investigation revealed that the XML Reader appears to deliver both CellTypes.
INFO Node 0:13 processing row
INFO Node 0:13 org.knime.core.data.xml.XMLBlobCell
INFO Node 0:13 processing row
INFO Node 0:13 org.knime.core.data.xml.XMLBlobCell
INFO Node 0:13 processing row
INFO Node 0:13 org.knime.core.data.xml.XMLCell
INFO Node 0:13 processing row
INFO Node 0:13 org.knime.core.data.xml.XMLBlobCell
INFO Node 0:13 processing row
INFO Node 0:13 org.knime.core.data.xml.XMLBlobCell
INFO Node 0:13 processing row
INFO Node 0:13 org.knime.core.data.xml.XMLBlobCell
INFO Node 0:13 processing row
INFO Node 0:13 org.knime.core.data.xml.XMLBlobCell
INFO Node 0:13 processing row
INFO Node 0:13 org.knime.core.data.xml.XMLCell
I am surprised at this type mixing in one column. Looking at the XML, it all looks the same. Well, for now I just
Thanks for taking the time to reply. I had further described what I did in a comment that still seems to be in the queue for moderation. It is working either way. Still baffling though that apparently identical XML should produce different DataTypes in the same column.
The data type is the same, but the cell implementation is different, depending on the size. Therefore never ever cast to a cell implementation, only to the corresponding data value interface.