dtmnodeproxy.java
来自「java jdk 1.4的源码」· Java 代码 · 共 1,381 行 · 第 1/3 页
JAVA
1,381 行
public boolean hasAttribute(String name) { return DTM.NULL != dtm.getAttributeNode(node,null,name); } /** * Method hasAttributeNS * * * @param name * @param x * * (hasAttributeNS) @return */ public boolean hasAttributeNS(String name, String x) { return DTM.NULL != dtm.getAttributeNode(node,x,name); } /** * * @return * @see org.w3c.dom.Node */ public final Document getOwnerDocument() { // Note that this uses the DOM-compatable version of the call return (Document)(dtm.getNode(dtm.getOwnerDocument(node))); } /** * * @param newChild * @param refChild * * @return * * @throws DOMException * @see org.w3c.dom.Node -- DTMNodeProxy is read-only */ public final Node insertBefore(Node newChild, Node refChild) throws DOMException { throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } /** * * @param newChild * @param oldChild * * @return * * @throws DOMException * @see org.w3c.dom.Node -- DTMNodeProxy is read-only */ public final Node replaceChild(Node newChild, Node oldChild) throws DOMException { throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } /** * * @param oldChild * * @return * * @throws DOMException * @see org.w3c.dom.Node -- DTMNodeProxy is read-only */ public final Node removeChild(Node oldChild) throws DOMException { throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } /** * * @param newChild * * @return * * @throws DOMException * @see org.w3c.dom.Node -- DTMNodeProxy is read-only */ public final Node appendChild(Node newChild) throws DOMException { throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } /** * * @return * @see org.w3c.dom.Node */ public final boolean hasChildNodes() { return (DTM.NULL != dtm.getFirstChild(node)); } /** * * @param deep * * @return * @see org.w3c.dom.Node -- DTMNodeProxy is read-only */ public final Node cloneNode(boolean deep) { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @return * @see org.w3c.dom.Document */ public final DocumentType getDoctype() { return null; } /** * * @return * @see org.w3c.dom.Document */ public final DOMImplementation getImplementation() { return implementation; } /** This is a bit of a problem in DTM, since a DTM may be a Document * Fragment and hence not have a clear-cut Document Element. We can * make it work in the well-formed cases but would that be confusing for others? * * @return * @see org.w3c.dom.Document */ public final Element getDocumentElement() { int dochandle=dtm.getDocument(); int elementhandle=dtm.NULL; for(int kidhandle=dtm.getFirstChild(dochandle); kidhandle!=dtm.NULL; kidhandle=dtm.getNextSibling(kidhandle)) { switch(dtm.getNodeType(kidhandle)) { case Node.ELEMENT_NODE: if(elementhandle!=dtm.NULL) { elementhandle=dtm.NULL; // More than one; ill-formed. kidhandle=dtm.getLastChild(dochandle); // End loop } else elementhandle=kidhandle; break; // These are harmless; document is still wellformed case Node.COMMENT_NODE: case Node.PROCESSING_INSTRUCTION_NODE: case Node.DOCUMENT_TYPE_NODE: break; default: elementhandle=dtm.NULL; // ill-formed kidhandle=dtm.getLastChild(dochandle); // End loop break; } } if(elementhandle==dtm.NULL) throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); else return (Element)(dtm.getNode(elementhandle)); } /** * * @param tagName * * @return * * @throws DOMException * @see org.w3c.dom.Document */ public final Element createElement(String tagName) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @return * @see org.w3c.dom.Document */ public final DocumentFragment createDocumentFragment() { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param data * * @return * @see org.w3c.dom.Document */ public final Text createTextNode(String data) { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param data * * @return * @see org.w3c.dom.Document */ public final Comment createComment(String data) { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param data * * @return * * @throws DOMException * @see org.w3c.dom.Document */ public final CDATASection createCDATASection(String data) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param target * @param data * * @return * * @throws DOMException * @see org.w3c.dom.Document */ public final ProcessingInstruction createProcessingInstruction( String target, String data) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param name * * @return * * @throws DOMException * @see org.w3c.dom.Document */ public final Attr createAttribute(String name) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param name * * @return * * @throws DOMException * @see org.w3c.dom.Document */ public final EntityReference createEntityReference(String name) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param tagname * * @return * @see org.w3c.dom.Document */ public final NodeList getElementsByTagName(String tagname) { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param importedNode * @param deep * * @return * * @throws DOMException * @see org.w3c.dom.Document as of DOM Level 2 -- DTMNodeProxy is read-only */ public final Node importNode(Node importedNode, boolean deep) throws DOMException { throw new DTMDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } /** * * @param namespaceURI * @param qualifiedName * * @return * * @throws DOMException * @see org.w3c.dom.Document as of DOM Level 2 */ public final Element createElementNS( String namespaceURI, String qualifiedName) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param namespaceURI * @param qualifiedName * * @return * * @throws DOMException * @see org.w3c.dom.Document as of DOM Level 2 */ public final Attr createAttributeNS( String namespaceURI, String qualifiedName) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param namespaceURI * @param localName * * @return * @see org.w3c.dom.Document as of DOM Level 2 */ public final NodeList getElementsByTagNameNS(String namespaceURI, String localName) { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param elementId * * @return * @see org.w3c.dom.Document as of DOM Level 2 */ public final Element getElementById(String elementId) { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param offset * * @return * * @throws DOMException * @see org.w3c.dom.Text */ public final Text splitText(int offset) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @return * * @throws DOMException * @see org.w3c.dom.CharacterData */ public final String getData() throws DOMException { return dtm.getNodeValue(node); } /** * * @param data * * @throws DOMException * @see org.w3c.dom.CharacterData */ public final void setData(String data) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @return * @see org.w3c.dom.CharacterData */ public final int getLength() { // %OPT% This should do something smarter? return dtm.getNodeValue(node).length(); } /** * * @param offset * @param count * * @return * * @throws DOMException * @see org.w3c.dom.CharacterData */ public final String substringData(int offset, int count) throws DOMException { return getData().substring(offset,offset+count); } /** * * @param arg * * @throws DOMException * @see org.w3c.dom.CharacterData */ public final void appendData(String arg) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /** * * @param offset * @param arg * * @throws DOMException * @see org.w3c.dom.CharacterData */ public final void insertData(int offset, String arg) throws DOMException { throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR); } /**
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?