Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Reader in = new BufferedReader(new FileReader(fileName));
Input Source input = new InputSource(in);
DOMParser parser = new DOMParser();
int whatToShow = NodeFilter.SHOW_ALL;
NodeFilter filter = new NodeFilter() {
public short acceptNode(Node n) {
if (n.getNodeType() == Node.TEXT_NODE) {
if(((Text)n).getData().trim().length() == 0)
return NodeFilter.FILTER_REJECT;
return NodeFilter.FILTER_ACCEPT;
Document doc = parser.getDocument();
DocumentTraversal traversal = (DocumentTraversal)doc;
TreeWalker walker = traversal.createTreeWalker(doc, whatToShow, filter, false);
//now we have a tree we can recursively walk down to create the needed staging tables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.