level++;
Element e = (Element)item;
switch (level) {
case 1:
if (!e.getName().equals(XML.FEED_NAME)) {
throw new XMLException("Feed does not start with an Atom 'feed' element: "+e.getName(),(Location)e);
}
docDest = new DocumentDestination();
//System.out.println("Feed: "+e.isBaseURIInherited()+", "+e.getBaseURI());
docDest.send(e.getInfoset().createItemConstructor().createDocument(e.getBaseURI()));
docDest.send(e);
break;
case 2:
if (!feedSent) {
if (e.getName().equals(XML.ENTRY_NAME)) {
// send the feed document
this.onFeed(docDest.getDocument());
feedSent = true;
// Now collect the first entry
//System.out.println("Entry: "+e.isBaseURIInherited()+", "+e.getBaseURI());
docDest = new DocumentDestination();
docDest.send(e.getInfoset().createItemConstructor().createDocument(e.getBaseURI()));
e.localizeNamespaceDeclarations();
docDest.send(e);
} else {
docDest.send(e);
}
} else {
if (!e.getName().equals(XML.ENTRY_NAME)) {
throw new XMLException("Non-entry element after the first entry: "+e.getName(),(Location)e);
}
// collect the entry
//System.out.println("Entry: "+e.isBaseURIInherited()+", "+e.getBaseURI());
docDest = new DocumentDestination();