if(levelIndex == 0) {
return doc;
}
}
} else if(node instanceof XmlContent) {
XmlContent content = (XmlContent) node;
if(currentPath.getLast() instanceof Content) {
currentPath.removeLast();
}
currentPath.addLast(new Content(content.getText()));
if(record) {
// build document
doc.addContent(new Content(content.getText()));
}
} else {
// don't know how to handle this type, internal error
throw new XmlReaderException("Unknown XmlNode type: " + node);
}