protected XMLInputFactory2 getFactory()
{
System.setProperty("javax.xml.stream.XMLInputFactory",
"com.ctc.wstx.stax.WstxInputFactory");
XMLInputFactory2 f = (XMLInputFactory2) XMLInputFactory.newInstance();
System.out.println("Factory instance: "+f.getClass());
//f.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE);
f.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
//f.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
f.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.FALSE);
f.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES,
Boolean.FALSE
//Boolean.TRUE
);
f.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.TRUE);
//f.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
f.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
//f.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.TRUE);
f.setProperty(XMLInputFactory.RESOLVER, new TestResolver1());
if (f.isPropertySupported(XMLInputFactory2.P_REPORT_PROLOG_WHITESPACE)) {
f.setProperty(XMLInputFactory2.P_REPORT_PROLOG_WHITESPACE,
Boolean.FALSE
//Boolean.TRUE
);
}
f.setProperty(XMLInputFactory2.XSP_SUPPORT_XMLID,
XMLInputFactory2.XSP_V_XMLID_TYPING
//XMLInputFactory2.XSP_V_XMLID_NONE
);
if (f.isPropertySupported(WstxInputProperties.P_MIN_TEXT_SEGMENT)) {
f.setProperty(WstxInputProperties.P_MIN_TEXT_SEGMENT,
new Integer(1));
//new Integer(23));
}
//f.setProperty(XMLInputFactory2.P_LAZY_PARSING, Boolean.FALSE);
/*
if (f.isPropertySupported(WstxInputProperties.P_CUSTOM_INTERNAL_ENTITIES)) {
java.util.Map m = new java.util.HashMap();
m.put("myent", "foobar");
m.put("myent2", "<tag>R&B + &myent;</tag>");
f.setProperty(WstxInputProperties.P_CUSTOM_INTERNAL_ENTITIES, m);
}
*/
if (f.isPropertySupported(WstxInputProperties.P_DTD_RESOLVER)) {
f.setProperty(WstxInputProperties.P_DTD_RESOLVER,
new TestResolver2());
}
if (f.isPropertySupported(WstxInputProperties.P_ENTITY_RESOLVER)) {
f.setProperty(WstxInputProperties.P_ENTITY_RESOLVER,
new TestResolver2());
}
/* Uncomment for boundary-condition stress tests; should be ok to
* use some fairly small (but not tiny) number...
*/
if (f.isPropertySupported(WstxInputProperties.P_INPUT_BUFFER_LENGTH)) {
f.setProperty(WstxInputProperties.P_INPUT_BUFFER_LENGTH,
new Integer(32));
}
/*
if (f.isPropertySupported(WstxInputProperties.P_TEXT_BUFFER_LENGTH)) {
f.setProperty(WstxInputProperties.P_TEXT_BUFFER_LENGTH,
new Integer(17));
}
*/
f.setProperty(WstxInputProperties.P_INPUT_PARSING_MODE,
//WstxInputProperties.PARSING_MODE_FRAGMENT
//WstxInputProperties.PARSING_MODE_DOCUMENTS
WstxInputProperties.PARSING_MODE_DOCUMENT
);