📄 simpleresulttreeimpl.java
字号:
} public Node makeNode(DTMAxisIterator iter) { return null; } public NodeList makeNodeList(int index) { return null; } public NodeList makeNodeList(DTMAxisIterator iter) { return null; } public String getLanguage(int node) { return null; } public int getSize() { return 2; } public String getDocumentURI(int node) { return "simple_rtf" + _documentURIIndex++; } public void setFilter(StripFilter filter) { } public void setupMapping(String[] names, String[] uris, int[] types, String[] namespaces) { } public boolean isElement(final int node) { return false; } public boolean isAttribute(final int node) { return false; } public String lookupNamespace(int node, String prefix) throws TransletException { return null; } /** * Return the node identity from a node handle. */ public int getNodeIdent(final int nodehandle) { return (nodehandle != DTM.NULL) ? (nodehandle - _documentID) : DTM.NULL; } /** * Return the node handle from a node identity. */ public int getNodeHandle(final int nodeId) { return (nodeId != DTM.NULL) ? (nodeId + _documentID) : DTM.NULL; } public DOM getResultTreeFrag(int initialSize, int rtfType) { return null; } public DOM getResultTreeFrag(int initialSize, int rtfType, boolean addToManager) { return null; } public SerializationHandler getOutputDomBuilder() { return this; } public int getNSType(int node) { return 0; } public String getUnparsedEntityURI(String name) { return null; } public Hashtable getElementsWithIDs() { return null; } /** Implementation of the SerializationHandler interfaces **/ /** * We only need to override the endDocument, characters, and * setEscaping interfaces. A simple RTF does not have element * nodes. We do not need to touch startElement and endElement. */ public void startDocument() throws SAXException { } public void endDocument() throws SAXException { // Set the String value when the document is built. if (_size == 1) _text = _textArray[0]; else { StringBuffer buffer = new StringBuffer(); for (int i = 0; i < _size; i++) { buffer.append(_textArray[i]); } _text = buffer.toString(); } } public void characters(String str) throws SAXException { // Resize the text array if necessary if (_size >= _textArray.length) { String[] newTextArray = new String[_textArray.length * 2]; System.arraycopy(_textArray, 0, newTextArray, 0, _textArray.length); _textArray = newTextArray; } // If the escape setting is false, set the corresponding bit in // the _dontEscape BitArray. if (!_escaping) { // The _dontEscape array is only created when needed. if (_dontEscape == null) { _dontEscape = new BitArray(8); } // Resize the _dontEscape array if necessary if (_size >= _dontEscape.size()) _dontEscape.resize(_dontEscape.size() * 2); _dontEscape.setBit(_size); } _textArray[_size++] = str; } public void characters(char[] ch, int offset, int length) throws SAXException { if (_size >= _textArray.length) { String[] newTextArray = new String[_textArray.length * 2]; System.arraycopy(_textArray, 0, newTextArray, 0, _textArray.length); _textArray = newTextArray; } if (!_escaping) { if (_dontEscape == null) { _dontEscape = new BitArray(8); } if (_size >= _dontEscape.size()) _dontEscape.resize(_dontEscape.size() * 2); _dontEscape.setBit(_size); } _textArray[_size++] = new String(ch, offset, length); } public boolean setEscaping(boolean escape) throws SAXException { final boolean temp = _escaping; _escaping = escape; return temp; } /** Implementation of the DTM interfaces **/ /** * The DTM interfaces are not used in this class. Implementing the DTM * interface is a requirement from MultiDOM. If we have a better way * of handling multiple documents, we can get rid of the DTM dependency. * * The following interfaces are just placeholders. The implementation * does not have an impact because they will not be used. */ public void setFeature(String featureId, boolean state) { } public void setProperty(String property, Object value) { } public DTMAxisTraverser getAxisTraverser(final int axis) { return null; } public boolean hasChildNodes(int nodeHandle) { return (getNodeIdent(nodeHandle) == RTF_ROOT); } public int getFirstChild(int nodeHandle) { int nodeID = getNodeIdent(nodeHandle); if (nodeID == RTF_ROOT) return getNodeHandle(RTF_TEXT); else return DTM.NULL; } public int getLastChild(int nodeHandle) { return getFirstChild(nodeHandle); } public int getAttributeNode(int elementHandle, String namespaceURI, String name) { return DTM.NULL; } public int getFirstAttribute(int nodeHandle) { return DTM.NULL; } public int getFirstNamespaceNode(int nodeHandle, boolean inScope) { return DTM.NULL; } public int getNextSibling(int nodeHandle) { return DTM.NULL; } public int getPreviousSibling(int nodeHandle) { return DTM.NULL; } public int getNextAttribute(int nodeHandle) { return DTM.NULL; } public int getNextNamespaceNode(int baseHandle, int namespaceHandle, boolean inScope) { return DTM.NULL; } public int getOwnerDocument(int nodeHandle) { return getDocument(); } public int getDocumentRoot(int nodeHandle) { return getDocument(); } public XMLString getStringValue(int nodeHandle) { return new XMLStringDefault(getStringValueX(nodeHandle)); } public int getStringValueChunkCount(int nodeHandle) { return 0; } public char[] getStringValueChunk(int nodeHandle, int chunkIndex, int[] startAndLen) { return null; } public int getExpandedTypeID(String namespace, String localName, int type) { return DTM.NULL; } public String getLocalNameFromExpandedNameID(int ExpandedNameID) { return EMPTY_STR; } public String getNamespaceFromExpandedNameID(int ExpandedNameID) { return EMPTY_STR; } public String getLocalName(int nodeHandle) { return EMPTY_STR; } public String getPrefix(int nodeHandle) { return null; } public String getNamespaceURI(int nodeHandle) { return EMPTY_STR; } public String getNodeValue(int nodeHandle) { return (getNodeIdent(nodeHandle) == RTF_TEXT) ? _text : null; } public short getNodeType(int nodeHandle) { int nodeID = getNodeIdent(nodeHandle); if (nodeID == RTF_TEXT) return DTM.TEXT_NODE; else if (nodeID == RTF_ROOT) return DTM.ROOT_NODE; else return DTM.NULL; } public short getLevel(int nodeHandle) { int nodeID = getNodeIdent(nodeHandle); if (nodeID == RTF_TEXT) return 2; else if (nodeID == RTF_ROOT) return 1; else return DTM.NULL; } public boolean isSupported(String feature, String version) { return false; } public String getDocumentBaseURI() { return EMPTY_STR; } public void setDocumentBaseURI(String baseURI) { } public String getDocumentSystemIdentifier(int nodeHandle) { return null; } public String getDocumentEncoding(int nodeHandle) { return null; } public String getDocumentStandalone(int nodeHandle) { return null; } public String getDocumentVersion(int documentHandle) { return null; } public boolean getDocumentAllDeclarationsProcessed() { return false; } public String getDocumentTypeDeclarationSystemIdentifier() { return null; } public String getDocumentTypeDeclarationPublicIdentifier() { return null; } public int getElementById(String elementId) { return DTM.NULL; } public boolean supportsPreStripping() { return false; } public boolean isNodeAfter(int firstNodeHandle, int secondNodeHandle) { return lessThan(firstNodeHandle, secondNodeHandle); } public boolean isCharacterElementContentWhitespace(int nodeHandle) { return false; } public boolean isDocumentAllDeclarationsProcessed(int documentHandle) { return false; } public boolean isAttributeSpecified(int attributeHandle) { return false; } public void dispatchCharactersEvents( int nodeHandle, org.xml.sax.ContentHandler ch, boolean normalize) throws org.xml.sax.SAXException { } public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch) throws org.xml.sax.SAXException { } public org.w3c.dom.Node getNode(int nodeHandle) { return makeNode(nodeHandle); } public boolean needsTwoThreads() { return false; } public org.xml.sax.ContentHandler getContentHandler() { return null; } public org.xml.sax.ext.LexicalHandler getLexicalHandler() { return null; } public org.xml.sax.EntityResolver getEntityResolver() { return null; } public org.xml.sax.DTDHandler getDTDHandler() { return null; } public org.xml.sax.ErrorHandler getErrorHandler() { return null; } public org.xml.sax.ext.DeclHandler getDeclHandler() { return null; } public void appendChild(int newChild, boolean clone, boolean cloneDepth) { } public void appendTextChild(String str) { } public SourceLocator getSourceLocatorFor(int node) { return null; } public void documentRegistration() { } public void documentRelease() { } public void migrateTo(DTMManager manager) { }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -