@TestTargetNew( level = TestLevel.COMPLETE, method = "setDocumentHandler", args = { DocumentHandler.class } ) public void testSetDocumentHandler() { // There is no getter for the DocumentHandler, so we can only test // indirectly whether is has been set correctly. try { adapter.startDocument(); } catch (SAXException e) { throw new RuntimeException("Unexpected exception", e); } assertEquals("startDocument", logger.getMethod()); assertEquals(new Object[] { }, logger.getArgs()); // null case adapter.setDocumentHandler(null); }
public HTMLHandler( Constructor htmlBuilderConstructor, Method getHTMLDocumentMethod) throws Exception { htmlBuilder = (DocumentHandler) htmlBuilderConstructor.newInstance( new Object[0]); this.getHTMLDocumentMethod = getHTMLDocumentMethod; }
/** * Start a new DataTypeHandler if element is known to be a * data-type and a TaskHandler otherwise. * * <p>Factored out of TargetHandler.</p> * * @since Ant 1.6 */ private static void handleElement(ProjectHelperImpl helperImpl, DocumentHandler parent, Target target, String elementName, AttributeList attrs) throws SAXParseException { if ("description".equals(elementName)) { // created for side effect new DescriptionHandler(helperImpl, parent); //NOSONAR } else if (helperImpl.project.getDataTypeDefinitions().get(elementName) != null) { new DataTypeHandler(helperImpl, parent, target).init(elementName, attrs); } else { new TaskHandler(helperImpl, parent, target, null, target).init(elementName, attrs); } }
public DocumentHandler asDocumentHandler() throws IOException { prepare(); return this; }
/** SAX Parser API. */ public void setDocumentHandler(DocumentHandler handler) { documentHandler = handler; }
public void setDocumentHandler(DocumentHandler handler) { logger.add("setDocumentHandler", handler); }
public void setDocumentHandler(DocumentHandler handler) { }
/** * Constructor. * * @param parentHandler The handler which should be restored to the * parser at the end of the element. * Must not be <code>null</code>. * * @param parent Parent of this element (task/data type/etc). * Must not be <code>null</code>. * * @param parentWrapper Wrapper for the parent element, if any. * Must not be <code>null</code>. * * @param target Target this element is part of. * Must not be <code>null</code>. */ public NestedElementHandler(ProjectHelperImpl helperImpl, DocumentHandler parentHandler, Object parent, RuntimeConfigurable parentWrapper, Target target) { super(helperImpl, parentHandler); if (parent instanceof TypeAdapter) { this.parent = ((TypeAdapter) parent).getProxy(); } else { this.parent = parent; } this.parentWrapper = parentWrapper; this.target = target; }
/** * Creates a handler and sets the parser to use it * for the current element. * * @param helperImpl the ProjectHelperImpl instance associated * with this handler. * * @param parentHandler The handler which should be restored to the * parser at the end of the element. * Must not be <code>null</code>. */ public AbstractHandler(ProjectHelperImpl helperImpl, DocumentHandler parentHandler) { this.parentHandler = parentHandler; this.helperImpl = helperImpl; // Start handling SAX events helperImpl.parser.setDocumentHandler(this); }
/** * Constructor. * * @param parentHandler The handler which should be restored to the * parser at the end of the element. * Must not be <code>null</code>. * * @param container Container for the element. * Must not be <code>null</code>. * * @param parentWrapper Wrapper for the parent element, if any. * May be <code>null</code>. * * @param target Target this element is part of. * Must not be <code>null</code>. */ public TaskHandler(ProjectHelperImpl helperImpl, DocumentHandler parentHandler, TaskContainer container, RuntimeConfigurable parentWrapper, Target target) { super(helperImpl, parentHandler); this.container = container; this.parentWrapper = parentWrapper; this.target = target; }
/** * Register the SAX1 document event handler. * * <p>Note that the SAX1 document handler has no Namespace * support.</p> * * @param handler The new SAX1 document event handler. * @see org.xml.sax.Parser#setDocumentHandler */ public void setDocumentHandler (DocumentHandler handler) { documentHandler = handler; }
/** * Allow an application to register a document event handler. * <p> * If the application does not register a document handler, all * document events reported by the SAX parser will be silently * ignored (this is the default behaviour implemented by * HandlerBase). * <p> * Applications may register a new or different handler in the * middle of a parse, and the SAX parser must begin using the new * handler immediately. * * @param documentHandler The document handler. */ public void setDocumentHandler(DocumentHandler documentHandler) { fDocumentHandler = documentHandler; }
/** * Return a {@link DocumentHandler} interface into this serializer. * If the serializer does not support the {@link DocumentHandler} * interface, it should return null. */ public DocumentHandler asDocumentHandler() throws IOException;