/** * Handle the comment. * @param readcontext The context for reading with all necessary information. */ protected void handleComment(ReadContextDesktop readcontext) throws Exception { if(readcontext.getReadIgnore()==0) readcontext.setComment(readcontext.getParser().getText()); else if(DEBUG) System.out.println("Ignoring: "+readcontext.getParser().getText()); // System.out.println("Found comment: "+comment); }
/** * Handle the content. * @param readcontext The context for reading with all necessary information. */ protected void handleContent(ReadContextDesktop readcontext) throws Exception { if(readcontext.getReadIgnore()==0) readcontext.getTopStackElement().addContent(readcontext.getParser().getText()); else if(DEBUG) System.out.println("Ignoring: "+readcontext.getParser().getText()); // System.out.println("content: "+parser.getLocalName()+" "+content); }
if(readcontext.getReadIgnore()==0) XMLStreamReader parser = readcontext.getParser(); StackElement topse = readcontext.getTopStackElement(); jadex.xml.stax.QName[] fullpath = readcontext.getXMLPath(); final TypeInfo typeinfo = readcontext.getPathManager().getTypeInfo(localname, fullpath, topse.getRawAttributes()); readcontext.setStackElement(topse, readcontext.getStackSize()-1); StackElement se = readcontext.getTopStackElement(); readcontext.getReporter().report("No content mapping for: "+topse.getContent()+" tag="+topse.getTag(), "link error", se, se.getLocation()); readcontext.getReporter().report("Error during postprocessing: "+e, "postprocessor error", topse, topse.getLocation()); final StackElement[] stack = readcontext.getStack(); // Use snapshot of stack for error report, as stack isn't available in delayed post processors. final int fi = i; readcontext.getPostProcessors().put(Integer.valueOf(postprocs[i].getPass()), new IPostProcessorCall() readcontext.getReadObjects().put(id, topse.getObject()); if(readcontext.getStackSize()>0 && bulklink) List childs = readcontext.removeChildren(topse.getObject()); if(childs!=null) if(readcontext.getStackSize()>1)
XMLStreamReader parser = readcontext.getParser(); if(readcontext.getReadIgnore()>0) readcontext.setReadIgnore(readcontext.getReadIgnore()+1); if(DEBUG) System.out.println("Ignoring: "+parser.getLocalName()); else if(readcontext.getReadIgnore()==0) jadex.xml.stax.QName[] fullpath = readcontext.getXMLPath(localname); TypeInfo typeinfo = readcontext.getPathManager().getTypeInfo(localname, fullpath, rawattrs); IObjectReaderHandler handler = typeinfo!=null ? typeinfo.getReaderHandler() : null; if(handler==null) if(readcontext.getTopStackElement()!=null && readcontext.getTopStackElement().getReaderHandler()!=null) handler = readcontext.getTopStackElement().getReaderHandler(); else if(readcontext.getDefaultHandler()!=null) handler = readcontext.getDefaultHandler(); readcontext.getReporter().report("No handler for element: "+localname, "type info error", readcontext, StaxLocationWrapper.fromLocation(parser.getLocation())); if(readcontext.getStackSize()>0) StackElement pse = (StackElement)readcontext.getTopStackElement();
ReadContextDesktop readcontext = new ReadContextDesktop(tipmanager, handler, parser, StaxXMLReporterWrapper.fromXMLReporter(factory.getXMLReporter()), callcontext, classloader); READ_CONTEXT.set(readcontext); try for(int i=1; readcontext.getPostProcessors().size()>0; i++) List ps = (List)readcontext.getPostProcessors().remove(Integer.valueOf(i)); if(ps!=null) jadex.xml.stax.ILocation loc = readcontext.getStackSize()>0 ? readcontext.getTopStackElement().getLocation() : StaxLocationWrapper.fromLocation(parser.getLocation()); readcontext.getReporter().report(e.toString(), "XML error", readcontext, loc); return readcontext.getRootObject()==NULL ? null : readcontext.getRootObject();
public void callPostProcessor() throws Exception { try { Object check = postprocs[fi].postProcess(readcontext, ftopse.getObject()); if(check!=null) { readcontext.getReporter().report("Object replacement only possible in first pass.", "postprocessor error", ftopse, ftopse.getLocation()); } } catch(Exception e) { // e.printStackTrace(); readcontext.getReporter().report("Error during postprocessing: "+e, "postprocessor error", stack, ftopse!=null ? ftopse.getLocation() : readcontext.getLocation()); } } });