⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 soapdocumentimpl.java

📁 Java有关XML编程需要用到axis 的源代码 把里面bin下的包导入相应的Java工程 进行使用
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    /**     * Return SOAPElements (what if they want SOAPEnvelope or Header/Body?)     *      * @param namespaceURI     * @param qualifiedName     * @return @throws     *         DOMException     */    public Element createElementNS(String namespaceURI, String qualifiedName)    throws DOMException {        org.apache.axis.soap.SOAPConstants soapConstants = null;        if (Constants.URI_SOAP11_ENV.equals(namespaceURI)) {            soapConstants = org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS;        } else if (Constants.URI_SOAP12_ENV.equals(namespaceURI)) {            soapConstants = org.apache.axis.soap.SOAPConstants.SOAP12_CONSTANTS;        }        // For special SOAP Element        MessageElement me = null;        if (soapConstants != null) {            if (qualifiedName.equals(Constants.ELEM_ENVELOPE)) {                // TODO: confirm SOAP 1.1!                me = new SOAPEnvelope(soapConstants);             } else if (qualifiedName.equals(Constants.ELEM_HEADER)) {                me = new SOAPHeader(null, soapConstants);                // Dummy SOAPEnv required?            } else if (qualifiedName.equals(Constants.ELEM_BODY)) {                me = new SOAPBody(null, soapConstants);            } else if (qualifiedName.equals(Constants.ELEM_FAULT)) {                me = null;            } else if (qualifiedName.equals(Constants.ELEM_FAULT_DETAIL)) {                // TODO:                me = null;            } else {                throw new DOMException(                        DOMException.INVALID_STATE_ERR,                "No such Localname for SOAP URI");            }            // TODO:            return null;            // general Elements        } else {            me = new MessageElement(namespaceURI, qualifiedName);        }        if (me != null)            me.setOwnerDocument(soapPart);        return me;    }    /**     * Attribute is not particularly dealt with in SAAJ.     *       */    public Attr createAttributeNS(String namespaceURI, String qualifiedName)    throws DOMException {        return delegate.createAttributeNS(namespaceURI, qualifiedName);    }    /**     * search the SOAPPart in order of SOAPHeader and SOAPBody for the     * requested Element name     *       */    public NodeList getElementsByTagNameNS(            String namespaceURI,            String localName) {        try {        	NodeListImpl list = new NodeListImpl();            if (soapPart != null) {                SOAPEnvelope soapEnv =                    (org.apache.axis.message.SOAPEnvelope) soapPart                    .getEnvelope();                SOAPHeader header =                    (org.apache.axis.message.SOAPHeader) soapEnv.getHeader();                if (header != null) {                	list.addNodeList(header.getElementsByTagNameNS(                            namespaceURI,                            localName));                }                SOAPBody body =                    (org.apache.axis.message.SOAPBody) soapEnv.getBody();                if (body != null) {                	list.addNodeList(body.getElementsByTagNameNS(                            namespaceURI,                            localName));                }            }            return list;        } catch (SOAPException se) {            throw new DOMException(DOMException.INVALID_STATE_ERR, "");        }    }    /**     * search the SOAPPart in order of SOAPHeader and SOAPBody for the     * requested Element name     *       */    public NodeList getElementsByTagName(String localName) {        try {            NodeListImpl list = new NodeListImpl();            if (soapPart != null) {                SOAPEnvelope soapEnv =                    (org.apache.axis.message.SOAPEnvelope) soapPart                    .getEnvelope();                SOAPHeader header =                    (org.apache.axis.message.SOAPHeader) soapEnv.getHeader();                if (header != null) {                    list.addNodeList(header.getElementsByTagName(localName));                }                SOAPBody body =                    (org.apache.axis.message.SOAPBody) soapEnv.getBody();                if (body != null) {                    list.addNodeList(body.getElementsByTagName(localName));                }            }            return list;        } catch (SOAPException se) {            throw new DOMException(DOMException.INVALID_STATE_ERR, "");        }    }    /**     * Returns the <code>Element</code> whose <code>ID</code> is given by     * <code>elementId</code>. If no such element exists, returns <code>null</code>.     * Behavior is not defined if more than one element has this <code>ID</code>.     * The DOM implementation must have information that says which attributes     * are of type ID. Attributes with the name "ID" are not of type ID unless     * so defined. Implementations that do not know whether attributes are of     * type ID or not are expected to return <code>null</code>.     *      * @param elementId     *            The unique <code>id</code> value for an element.     * @return The matching element.     * @since DOM Level 2     */    public Element getElementById(String elementId) {        return delegate.getElementById(elementId);    }    /**     * Node Implementation     *       */    public String getNodeName() {        return null;    }    public String getNodeValue() throws DOMException {        throw new DOMException(                DOMException.NO_DATA_ALLOWED_ERR,                "Cannot use TextNode.get in " + this);    }    public void setNodeValue(String nodeValue) throws DOMException {        throw new DOMException(                DOMException.NO_DATA_ALLOWED_ERR,                "Cannot use TextNode.set in " + this);    }    /**     * override it in sub-classes     *      * @return     */    public short getNodeType() {        return Node.DOCUMENT_NODE;    }    public Node getParentNode() {        return null;    }    public NodeList getChildNodes() {        try {            if (soapPart != null) {                NodeListImpl children = new NodeListImpl();                children.addNode(soapPart.getEnvelope());                return children;            } else {                return NodeListImpl.EMPTY_NODELIST;            }        } catch (SOAPException se) {            throw new DOMException(DOMException.INVALID_STATE_ERR, "");        }    }    /**     * Do we have to count the Attributes as node ????     *      * @return     */    public Node getFirstChild() {        try {            if (soapPart != null)                return (org.apache.axis.message.SOAPEnvelope) soapPart                .getEnvelope();            else                return null;        } catch (SOAPException se) {            throw new DOMException(DOMException.INVALID_STATE_ERR, "");        }    }    /**     * @return     */    public Node getLastChild() {        try {            if (soapPart != null)                return (org.apache.axis.message.SOAPEnvelope) soapPart                .getEnvelope();            else                return null;        } catch (SOAPException se) {            throw new DOMException(DOMException.INVALID_STATE_ERR, "");        }    }    public Node getPreviousSibling() {        return null;    }    public Node getNextSibling() {        return null;    }    public NamedNodeMap getAttributes() {        return null;    }    /**     *      * we have to have a link to them...     */    public Document getOwnerDocument() {        return null;    }    /**     */    public Node insertBefore(Node newChild, Node refChild)    throws DOMException {        throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "");    }    public Node replaceChild(Node newChild, Node oldChild)    throws DOMException {        throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "");    }    public Node removeChild(Node oldChild) throws DOMException {        try {            Node envNode;            if (soapPart != null) {                envNode = soapPart.getEnvelope();                if (envNode.equals(oldChild)) {                    return envNode;                }            }            throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "");        } catch (SOAPException se) {            throw new DOMException(DOMException.INVALID_STATE_ERR, "");        }    }    public Node appendChild(Node newChild) throws DOMException {        throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "");    }    public boolean hasChildNodes() {        try {            if (soapPart != null) {                if (soapPart.getEnvelope() != null) {                    return true;                }            }            return false;        } catch (SOAPException se) {            throw new DOMException(DOMException.INVALID_STATE_ERR, "");        }    }    /**     * @todo: Study it more.... to implement the deep mode correctly.     *       */    public Node cloneNode(boolean deep) {        throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "");    }    /**     * @todo: is it OK to simply call the superclass?     *       */    public void normalize() {        throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "");    }    // TODO: fill appropriate features    private String[] features = { "foo", "bar" };    private String version = "version 2.0";    public boolean isSupported(String feature, String version) {        if (!version.equalsIgnoreCase(version))            return false;        else            return true;    }    public String getPrefix() {        throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "");    }    public void setPrefix(String prefix) {        throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "");    }    public String getNamespaceURI() {        throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "");    }    public void setNamespaceURI(String nsURI) {        throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "");    }    public String getLocalName() {        throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "");    }    public boolean hasAttributes() {        throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "");    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -