tounknownstream.java
来自「JAVA 所有包」· Java 代码 · 共 1,314 行 · 第 1/3 页
JAVA
1,314 行
m_needToCallStartDocument = true; } public void startElement(String qName) throws SAXException { this.startElement(null, null, qName, null); } public void startElement(String namespaceURI, String localName, String qName) throws SAXException { this.startElement(namespaceURI, localName, qName, null); } public void startElement( String namespaceURI, String localName, String elementName, Attributes atts) throws SAXException { if (m_needToCallSetDocumentInfo){ super.setDocumentInfo(); m_needToCallSetDocumentInfo = false; } /* we are notified of the start of an element */ if (m_firstTagNotEmitted) { /* we have not yet sent the first element on its way */ if (m_firstElementName != null) { /* this is not the first element, but a later one. * But we have the old element pending, so flush it out, * then send this one on its way. */ flush(); m_handler.startElement(namespaceURI, localName, elementName, atts); } else { /* this is the very first element that we have seen, * so save it for flushing later. We may yet get to know its * URI due to added attributes. */ m_wrapped_handler_not_initialized = true; m_firstElementName = elementName; // null if not known m_firstElementPrefix = getPrefixPartUnknown(elementName); // null if not known m_firstElementURI = namespaceURI; // null if not known m_firstElementLocalName = localName; if (m_tracer != null) firePseudoElement(elementName); /* we don't want to call our own addAttributes, which * merely delegates to the wrapped handler, but we want to * add these attributes to m_attributes. So me must call super. * addAttributes() In this case m_attributes is only used for the * first element, after that this class totally delegates to the * wrapped handler which is either XML or HTML. */ if (atts != null) super.addAttributes(atts); // if there are attributes, then lets make the flush() // call the startElement on the handler and send the // attributes on their way. if (atts != null) flush(); } } else { // this is not the first element, but a later one, so just // send it on its way. m_handler.startElement(namespaceURI, localName, elementName, atts); } } /** * Pass the call on to the underlying handler * @see ExtendedLexicalHandler#comment(String) */ public void comment(String comment) throws SAXException { if (m_firstTagNotEmitted && m_firstElementName != null) { emitFirstTag(); } else if (m_needToCallStartDocument) { m_handler.startDocument(); m_needToCallStartDocument = false; } m_handler.comment(comment); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#getDoctypePublic() */ public String getDoctypePublic() { return m_handler.getDoctypePublic(); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#getDoctypeSystem() */ public String getDoctypeSystem() { return m_handler.getDoctypeSystem(); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#getEncoding() */ public String getEncoding() { return m_handler.getEncoding(); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#getIndent() */ public boolean getIndent() { return m_handler.getIndent(); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#getIndentAmount() */ public int getIndentAmount() { return m_handler.getIndentAmount(); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#getMediaType() */ public String getMediaType() { return m_handler.getMediaType(); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#getOmitXMLDeclaration() */ public boolean getOmitXMLDeclaration() { return m_handler.getOmitXMLDeclaration(); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#getStandalone() */ public String getStandalone() { return m_handler.getStandalone(); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#getVersion() */ public String getVersion() { return m_handler.getVersion(); } /** * @see XSLOutputAttributes#setDoctype(String, String) */ public void setDoctype(String system, String pub) { m_handler.setDoctypePublic(pub); m_handler.setDoctypeSystem(system); } /** * Set the doctype in the underlying XML handler. Remember that this method * was called, just in case we need to transfer this doctype to an HTML handler * @param doctype the public doctype to set * @see XSLOutputAttributes#setDoctypePublic(String) */ public void setDoctypePublic(String doctype) { m_handler.setDoctypePublic(doctype); m_setDoctypePublic_called = true; } /** * Set the doctype in the underlying XML handler. Remember that this method * was called, just in case we need to transfer this doctype to an HTML handler * @param doctype the system doctype to set * @see XSLOutputAttributes#setDoctypeSystem(String) */ public void setDoctypeSystem(String doctype) { m_handler.setDoctypeSystem(doctype); m_setDoctypeSystem_called = true; } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#setEncoding(String) */ public void setEncoding(String encoding) { m_handler.setEncoding(encoding); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#setIndent(boolean) */ public void setIndent(boolean indent) { m_handler.setIndent(indent); } /** * Pass the call on to the underlying handler */ public void setIndentAmount(int value) { m_handler.setIndentAmount(value); } /** * @see XSLOutputAttributes#setMediaType(String) */ public void setMediaType(String mediaType) { m_handler.setMediaType(mediaType); m_setMediaType_called = true; } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#setOmitXMLDeclaration(boolean) */ public void setOmitXMLDeclaration(boolean b) { m_handler.setOmitXMLDeclaration(b); } /** * Pass the call on to the underlying handler * @see XSLOutputAttributes#setStandalone(String) */ public void setStandalone(String standalone) { m_handler.setStandalone(standalone); } /** * @see XSLOutputAttributes#setVersion(String) */ /** * Pass the call on to the underlying handler * @see org.xml.sax.ext.DeclHandler#attributeDecl(String, String, String, String, String) */ public void attributeDecl( String arg0, String arg1, String arg2, String arg3, String arg4) throws SAXException { m_handler.attributeDecl(arg0, arg1, arg2, arg3, arg4); } /** * 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); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ext.DeclHandler#externalEntityDecl(String, String, String) */ public void externalEntityDecl( String name, String publicId, String systemId) throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.externalEntityDecl(name, publicId, systemId); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ext.DeclHandler#internalEntityDecl(String, String) */ public void internalEntityDecl(String arg0, String arg1) throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.internalEntityDecl(arg0, arg1); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ContentHandler#characters(char[], int, int) */ public void characters(char[] characters, int offset, int length) throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.characters(characters, offset, length); } /** * 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(); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ContentHandler#endElement(String, String, String) */ public void endElement(String namespaceURI, String localName, String qName) throws SAXException { if (m_firstTagNotEmitted) { flush(); if (namespaceURI == null && m_firstElementURI != null) namespaceURI = m_firstElementURI; if (localName == null && m_firstElementLocalName != null) localName = m_firstElementLocalName; } m_handler.endElement(namespaceURI, localName, qName); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ContentHandler#endPrefixMapping(String) */ public void endPrefixMapping(String prefix) throws SAXException { m_handler.endPrefixMapping(prefix); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int) */ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.ignorableWhitespace(ch, start, length); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ContentHandler#processingInstruction(String, String) */ public void processingInstruction(String target, String data) throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.processingInstruction(target, data); } /** * Pass the call on to the underlying handler * @see org.xml.sax.ContentHandler#setDocumentLocator(Locator) */ public void setDocumentLocator(Locator locator) { super.setDocumentLocator(locator); m_handler.setDocumentLocator(locator); }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?