diff --git a/src/main/java/org/commcare/data/xml/DataModelPullParser.java b/src/main/java/org/commcare/data/xml/DataModelPullParser.java index d76f26e0d2..ee9f3307c1 100644 --- a/src/main/java/org/commcare/data/xml/DataModelPullParser.java +++ b/src/main/java/org/commcare/data/xml/DataModelPullParser.java @@ -10,6 +10,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.LinkedHashSet; +import java.util.List; import java.util.Vector; /** @@ -28,13 +29,14 @@ public class DataModelPullParser extends ElementParser { private final InputStream is; private final String requiredRootEnvelope = null; private final CommCareOTARestoreListener rListener; + private List blocksToSkipParsing; public DataModelPullParser(InputStream is, TransactionParserFactory factory) throws InvalidStructureException, IOException { this(is, factory, false); } public DataModelPullParser(InputStream is, TransactionParserFactory factory, CommCareOTARestoreListener rl) throws InvalidStructureException, IOException { - this(is, factory, false, false, rl); + this(is, factory, false, false, rl, null); } public DataModelPullParser(InputStream is, TransactionParserFactory factory, boolean deep) throws InvalidStructureException, IOException { @@ -42,10 +44,10 @@ public DataModelPullParser(InputStream is, TransactionParserFactory factory, boo } public DataModelPullParser(InputStream is, TransactionParserFactory factory, boolean failfast, boolean deep) throws InvalidStructureException, IOException { - this(is, factory, failfast, deep, null); + this(is, factory, failfast, deep, null, null); } - public DataModelPullParser(InputStream is, TransactionParserFactory factory, boolean failfast, boolean deep, CommCareOTARestoreListener rListener) throws InvalidStructureException, IOException { + public DataModelPullParser(InputStream is, TransactionParserFactory factory, boolean failfast, boolean deep, CommCareOTARestoreListener rListener, List blocksToSkipParsing) throws InvalidStructureException, IOException { super(ElementParser.instantiateParser(is)); this.is = is; this.failfast = failfast; @@ -53,6 +55,7 @@ public DataModelPullParser(InputStream is, TransactionParserFactory factory, boo errors = new Vector<>(); this.deep = deep; this.rListener = rListener; + this.blocksToSkipParsing = blocksToSkipParsing; } @Override @@ -126,6 +129,11 @@ private void parseBlock(String root, LinkedHashSet parsers) t continue; } + if (blocksToSkipParsing != null && blocksToSkipParsing.equals(name)) { + this.skipBlock(name); + continue; + } + TransactionParser transaction = factory.getParser(parser); if (transaction == null) { if (deep) {