File outputFile = renderFile(ua, "nops.fo", "");
InputStream in = new java.io.FileInputStream(outputFile);
try {
MODCAParser parser = new MODCAParser(in);
UnparsedStructuredField field = skipTo(parser, 0xD3A8A8); //Begin Document
//NOP in fo:declarations
field = parser.readNextStructuredField();
assertEquals(0xD3EEEE, field.getSfTypeID());
assertEquals("fo:declarations", getNopText(field));
field = parser.readNextStructuredField();
assertEquals(0xD3A8AD, field.getSfTypeID()); //Begin Named Page Group
//NOPs in fo:page-sequence
field = parser.readNextStructuredField();
assertEquals(0xD3EEEE, field.getSfTypeID());
assertEquals("fo:page-sequence: start", getNopText(field));
field = parser.readNextStructuredField();
assertEquals(0xD3EEEE, field.getSfTypeID());
assertEquals("fo:page-sequence: end", getNopText(field));
field = parser.readNextStructuredField();
assertEquals(0xD3A8AF, field.getSfTypeID()); //Begin Page
field = skipTo(parser, 0xD3A9C9); //End Active Environment Group
field = parser.readNextStructuredField();
assertEquals(0xD3EEEE, field.getSfTypeID());
assertEquals("fo:simple-page-master: first", getNopText(field));
field = skipTo(parser, 0xD3A9C9); //End Active Environment Group
field = parser.readNextStructuredField();
assertEquals(0xD3EEEE, field.getSfTypeID());
assertEquals("fo:simple-page-master: rest", getNopText(field));
} finally {
IOUtils.closeQuietly(in);
}
int counter = 0;
in = new java.io.FileInputStream(outputFile);
try {
MODCAParser parser = new MODCAParser(in);
while (true) {
UnparsedStructuredField field = parser.readNextStructuredField();
if (field == null) {
break;
}
if (field.getSfTypeID() == 0xD3EEEE) {
counter++;
}
}
} finally {
IOUtils.closeQuietly(in);