protected final void handleEndDocument() throws SAXException { visitor.endDocument(); }
private void handleEndElement(EndElement event) throws SAXException { if(!seenText && predictor.expectText()) { visitor.text(""); } // fire endElement QName qName = event.getName(); tagName.uri = fixNull(qName.getNamespaceURI()); tagName.local = qName.getLocalPart(); visitor.endElement(tagName); // end namespace bindings for( Iterator<Namespace> i = event.getNamespaces(); i.hasNext();) { String prefix = fixNull(i.next().getPrefix()); // be defensive visitor.endPrefixMapping(prefix); } seenText = false; }
/** * @param externalLocator * If the caller is producing SAX events from sources other than Unicode and angle brackets, * the caller can override the default SAX {@link Locator} object by this object * to provide better location information. */ public SAXConnector(XmlVisitor next, LocatorEx externalLocator ) { this.next = next; this.context = next.getContext(); this.predictor = next.getPredictor(); this.loc = externalLocator; }
private void handleEndElement() throws SAXException { processText(false); // fire endElement tagName.uri = fixNull(staxStreamReader.getNamespaceURI()); tagName.local = staxStreamReader.getLocalName(); visitor.endElement(tagName); // end namespace bindings int nsCount = staxStreamReader.getNamespaceCount(); for (int i = nsCount - 1; i >= 0; i--) { visitor.endPrefixMapping(fixNull(staxStreamReader.getNamespacePrefix(i))); } }
private void handleStartElement() throws SAXException { processText(true); // start namespace bindings int nsCount = staxStreamReader.getNamespaceCount(); for (int i = 0; i < nsCount; i++) { visitor.startPrefixMapping( fixNull(staxStreamReader.getNamespacePrefix(i)), fixNull(staxStreamReader.getNamespaceURI(i))); } // fire startElement tagName.uri = fixNull(staxStreamReader.getNamespaceURI()); tagName.local = staxStreamReader.getLocalName(); tagName.atts = attributes; visitor.startElement(tagName); }
public void startDocument(LocatorEx locator, NamespaceContext nsContext) throws SAXException { next.startDocument(locator,nsContext); }
public void text( CharSequence pcdata ) throws SAXException { if(!followXop) next.text(pcdata); else followXop = false; }
public UnmarshallingContext getContext() { return next.getContext(); }
public void endElement(TagName tagName) throws SAXException { if(inXopInclude) { // consume </xop:Include> by ourselves. inXopInclude = false; followXop = true; return; } next.endElement(tagName); }
public void endPrefixMapping(String prefix) throws SAXException { next.endPrefixMapping(prefix); }
public void startPrefixMapping(String prefix, String nsUri) throws SAXException { next.startPrefixMapping(prefix,nsUri); }
public void startElement(TagName tagName) throws SAXException { if(tagName.local.equals("Include") && tagName.uri.equals(WellKnownNamespace.XOP)) { // found xop:Include String href = tagName.atts.getValue("href"); DataHandler attachment = au.getAttachmentAsDataHandler(href); if(attachment==null) { // report an error and ignore parent.getEventHandler().handleEvent(null); // TODO } base64data.set(attachment); next.text(base64data); inXopInclude = true; followXop = true; } else next.startElement(tagName); }
public TextPredictor getPredictor() { return next.getPredictor(); } }
@Override public void startElement(String uri, String local, String qname, Attributes atts) throws SAXException { if (logger.isLoggable(Level.FINER)) { logger.log(Level.FINER, "SAXConnector.startElement: {0}:{1}:{2}, attrs: {3}", new Object[]{uri, local, qname, atts}); } // work gracefully with misconfigured parsers that don't support namespaces if( uri==null || uri.length()==0 ) uri=""; if( local==null || local.length()==0 ) local=qname; if( qname==null || qname.length()==0 ) qname=local; processText(!context.getCurrentState().isMixed()); tagName.uri = uri; tagName.local = local; tagName.qname = qname; tagName.atts = atts; next.startElement(tagName); }
private void handleStartElement(StartElement event) throws SAXException { // start namespace bindings for (Iterator i = event.getNamespaces(); i.hasNext();) { Namespace ns = (Namespace)i.next(); visitor.startPrefixMapping( fixNull(ns.getPrefix()), fixNull(ns.getNamespaceURI())); } // fire startElement QName qName = event.getName(); tagName.uri = fixNull(qName.getNamespaceURI()); String localName = qName.getLocalPart(); tagName.uri = fixNull(qName.getNamespaceURI()); tagName.local = localName; tagName.atts = getAttributes(event); visitor.startElement(tagName); seenText = false; }
private void handleEndElement() throws SAXException { processUnreportedText(); tagName.uri = fastInfosetStreamReader.accessNamespaceURI(); tagName.local = fastInfosetStreamReader.accessLocalName(); visitor.endElement(tagName); for (int i = fastInfosetStreamReader.accessNamespaceCount() - 1; i >= 0; i--) { visitor.endPrefixMapping(fastInfosetStreamReader.getNamespacePrefix(i)); } }
public void startDocument(LocatorEx loc, NamespaceContext nsContext) throws SAXException { next.startDocument(loc,nsContext); }
public void text( CharSequence pcdata ) throws SAXException { next.text(pcdata); }
public UnmarshallingContext getContext() { return next.getContext(); }
@Override public void endElement(String uri, String localName, String qName) throws SAXException { if (logger.isLoggable(Level.FINER)) { logger.log(Level.FINER, "SAXConnector.startElement: {0}:{1}:{2}", new Object[]{uri, localName, qName}); } processText(false); tagName.uri = uri; tagName.local = localName; tagName.qname = qName; next.endElement(tagName); }