String lang = null;
for (Iterator it = doc.getChildren().iterator(); it.hasNext();) {
final Object o = it.next();
if (!(o instanceof ProcessingInstruction)) continue;
final ProcessingInstruction pi = (ProcessingInstruction)o;
final String target = pi.getTarget();
if ("page".equals(target)) {
//we handle only the language attribute here
final Map params = pi.parseData();
final String l = (String)params.remove("language");
if (l != null) {
noEL("language", l, pi);
lang = l;
}
if (!params.isEmpty())
pis.add(pi); //process it later
} else if ("import".equals(target)) { //import
final Map params = pi.parseData();
final String src = (String)params.remove("src");
final String dirs = (String)params.remove("directives");
if (!params.isEmpty())
log.warning("Ignored unknown attributes: "+params.keySet()+", "+pi.getLocator());
noELnorEmpty("src", src, pi);
noEL("directives", dirs, pi);
imports.add(new String[] {src, dirs});
} else {
pis.add(pi);