/** * Converts the String to a character array and calls the SAX method * characters(char[],int,int); * * @see ExtendedContentHandler#characters(String) */ public void characters(String chars) throws SAXException { final int length = chars.length(); if (length > m_charsBuff.length) { m_charsBuff = new char[length*2 + 1]; } chars.getChars(0, length, m_charsBuff, 0); this.characters(m_charsBuff, 0, length); }
/** * Pass the call on to the underlying handler * @see org.xml.sax.ext.DeclHandler#elementDecl(String, String) */ public void elementDecl(String arg0, String arg1) throws SAXException { if (m_firstTagNotEmitted) { emitFirstTag(); } m_handler.elementDecl(arg0, arg1); }
flush(); m_handler.startElement(namespaceURI, localName, elementName, atts); m_firstElementPrefix = getPrefixPartUnknown(elementName); firePseudoElement(elementName); flush();
/** * This method is used when a prefix/uri namespace mapping * is indicated after the element was started with a * startElement() and before and endElement(). * startPrefixMapping(prefix,uri) would be used before the * startElement() call. * @param uri the URI of the namespace * @param prefix the prefix associated with the given URI. * * @see ExtendedContentHandler#namespaceAfterStartElement(String, String) */ public void namespaceAfterStartElement(String prefix, String uri) throws SAXException { // hack for XSLTC with finding URI for default namespace if (m_firstTagNotEmitted && m_firstElementURI == null && m_firstElementName != null) { String prefix1 = getPrefixPart(m_firstElementName); if (prefix1 == null && EMPTYSTRING.equals(prefix)) { // the elements URI is not known yet, and it // doesn't have a prefix, and we are currently // setting the uri for prefix "", so we have // the uri for the element... lets remember it m_firstElementURI = uri; } } startPrefixMapping(prefix,uri, false); }
/** * Pass the call on to the underlying handler * @see ExtendedContentHandler#endElement(String) */ public void endElement(String elementName) throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.endElement(elementName); }
private void emitFirstTag() throws SAXException { if (m_firstElementName != null) { if (m_wrapped_handler_not_initialized) { initStreamOutput(); m_wrapped_handler_not_initialized = false; } // Output first tag m_handler.startElement(m_firstElementURI, null, m_firstElementName, m_attributes); // don't need the collected attributes of the first element anymore. m_attributes = null; // Output namespaces of first tag if (m_namespacePrefix != null) { final int n = m_namespacePrefix.size(); for (int i = 0; i < n; i++) { final String prefix = (String) m_namespacePrefix.elementAt(i); final String uri = (String) m_namespaceURI.elementAt(i); m_handler.startPrefixMapping(prefix, uri, false); } m_namespacePrefix = null; m_namespaceURI = null; } m_firstTagNotEmitted = false; } }
getLocalNameUnknown(m_firstElementName).equalsIgnoreCase("html");
boolean firstElementIsHTML = isFirstElemHTML();
/** * @see org.xml.sax.ContentHandler#startPrefixMapping(String, String) * @param prefix The prefix that maps to the URI * @param uri The URI for the namespace */ public void startPrefixMapping(String prefix, String uri) throws SAXException { this.startPrefixMapping(prefix,uri, true); }
public void startElement(String qName) throws SAXException { this.startElement(null, null, qName, null); }
/** * Pass the call on to the underlying handler * @see org.xml.sax.ContentHandler#endDocument() */ public void endDocument() throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.endDocument(); }
private void emitFirstTag() throws SAXException { if (m_firstElementName != null) { if (m_wrapped_handler_not_initialized) { initStreamOutput(); m_wrapped_handler_not_initialized = false; } // Output first tag m_handler.startElement(m_firstElementURI, null, m_firstElementName, m_attributes); // don't need the collected attributes of the first element anymore. m_attributes = null; // Output namespaces of first tag if (m_namespacePrefix != null) { final int n = m_namespacePrefix.size(); for (int i = 0; i < n; i++) { final String prefix = (String) m_namespacePrefix.elementAt(i); final String uri = (String) m_namespaceURI.elementAt(i); m_handler.startPrefixMapping(prefix, uri, false); } m_namespacePrefix = null; m_namespaceURI = null; } m_firstTagNotEmitted = false; } }
getLocalNameUnknown(m_firstElementName).equalsIgnoreCase("html");
boolean firstElementIsHTML = isFirstElemHTML();
/** * @see org.xml.sax.ContentHandler#startPrefixMapping(String, String) * @param prefix The prefix that maps to the URI * @param uri The URI for the namespace */ public void startPrefixMapping(String prefix, String uri) throws SAXException { this.startPrefixMapping(prefix,uri, true); }
public void startElement(String qName) throws SAXException { this.startElement(null, null, qName, null); }
flush(); m_handler.startElement(namespaceURI, localName, elementName, atts); m_firstElementPrefix = getPrefixPartUnknown(elementName); firePseudoElement(elementName); flush();
/** * Pass the call on to the underlying handler * @see org.xml.sax.ext.LexicalHandler#endEntity(String) */ public void endEntity(String name) throws SAXException { if (m_firstTagNotEmitted) { emitFirstTag(); } m_handler.endEntity(name); }
/** * Converts the String to a character array and calls the SAX method * characters(char[],int,int); * * @see ExtendedContentHandler#characters(String) */ public void characters(String chars) throws SAXException { final int length = chars.length(); if (length > m_charsBuff.length) { m_charsBuff = new char[length*2 + 1]; } chars.getChars(0, length, m_charsBuff, 0); this.characters(m_charsBuff, 0, length); }
/** * Pass the call on to the underlying handler * @see org.xml.sax.ext.LexicalHandler#comment(char[], int, int) */ public void comment(char[] ch, int start, int length) throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.comment(ch, start, length); }