/** * Notify an attribute. Attributes are notified after the startElement event, and before any * children. */ public void attribute( int nameCode, int typeCode, CharSequence value, int locationId, int properties) throws XPathException { int index = pendingAttributes.getIndexByFingerprint(nameCode & 0xfffff); if (index < 0) { pendingAttributes.addAttribute(nameCode, typeCode, value.toString(), locationId, properties); } else { pendingAttributes.setAttribute( index, nameCode, typeCode, value.toString(), locationId, properties); } }
/** Start of document */ public void open() throws XPathException { pendingAttributes = new AttributeCollectionImpl(getPipelineConfiguration().getConfiguration().getNamePool()); if (handler == null) { throw new IllegalStateException("ContentHandlerProxy.open(): no underlying handler provided"); } try { locationProvider = getPipelineConfiguration().getLocationProvider(); pendingAttributes.setLocationProvider(locationProvider); locator = new ContentHandlerProxyLocator(this); handler.setDocumentLocator(locator); handler.startDocument(); } catch (SAXException err) { handleSAXException(err); } depth = 0; }
/** * Notify the start of the content, that is, the completion of all attributes and namespaces. Note * that the initial receiver of output from XSLT instructions will not receive this event, it has * to detect it itself. Note that this event is reported for every element even if it has no * attributes, no namespaces, and no content. */ public void startContent() throws XPathException { try { NamePool namePool = pipe.getConfiguration().getNamePool(); if (depth > 0 || !requireWellFormed) { String uri = namePool.getURI(pendingElement); String localName = namePool.getLocalName(pendingElement); String qname = namePool.getDisplayName(pendingElement); handler.startElement(uri, localName, qname, pendingAttributes); elementStack.push(uri); elementStack.push(localName); elementStack.push(qname); pendingAttributes.clear(); pendingElement = -1; } } catch (SAXException err) { handleSAXException(err); } }