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

📄 deserializationcontext.java

📁 Java有关XML编程需要用到axis 的源代码 把里面bin下的包导入相应的Java工程 进行使用
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                log.debug(Messages.getMessage("popHandler00", "(null)"));            } else {                log.debug(Messages.getMessage("popHandler00", "" + result));            }        }        return result;    }    boolean processingRef = false;    public void setProcessingRef(boolean ref) {        processingRef = ref;    }    public boolean isProcessingRef() {        return processingRef;    }    /****************************************************************     * SAX event handlers     */    public void startDocument() throws SAXException {        // Should never receive this in the midst of a parse.        if (!doneParsing && (recorder != null))            recorder.startDocument();    }    /**     * endDocument is invoked at the end of the document.     */    public void endDocument() throws SAXException {        if (debugEnabled) {            log.debug("Enter: DeserializationContext::endDocument()");        }        if (!doneParsing && (recorder != null))            recorder.endDocument();        doneParsing = true;        if (debugEnabled) {            log.debug("Exit: DeserializationContext::endDocument()");        }    }    /**     * Return if done parsing document.     */    public boolean isDoneParsing() {return doneParsing;}    /** Record the current set of prefix mappings in the nsMappings table.     *     * !!! We probably want to have this mapping be associated with the     *     MessageElements, since they may potentially need access to them     *     long after the end of the prefix mapping here.  (example:     *     when we need to record a long string of events scanning forward     *     in the document to find an element with a particular ID.)     */    public void startPrefixMapping(String prefix, String uri)        throws SAXException    {        if (debugEnabled) {            log.debug("Enter: DeserializationContext::startPrefixMapping(" + prefix + ", " + uri + ")");        }        if (!doneParsing && (recorder != null)) {            recorder.startPrefixMapping(prefix, uri);        }        if (startOfMappingsPos == -1) {            namespaces.push();            startOfMappingsPos = getCurrentRecordPos();        }        if (prefix != null) {            namespaces.add(uri, prefix);        } else {            namespaces.add(uri, "");        }        if (!haveSeenSchemaNS && msgContext != null) {            // If we haven't yet seen a schema namespace, check if this            // is one.  If so, set the SchemaVersion appropriately.            // Hopefully the schema def is on the outermost element so we            // get this over with quickly.            for (int i = 0; !haveSeenSchemaNS && i < schemaVersions.length;                 i++) {                SchemaVersion schemaVersion = schemaVersions[i];                if (uri.equals(schemaVersion.getXsdURI()) ||                        uri.equals(schemaVersion.getXsiURI())) {                    msgContext.setSchemaVersion(schemaVersion);                    haveSeenSchemaNS = true;                }            }        }        if (topHandler != null) {            topHandler.startPrefixMapping(prefix, uri);        }        if (debugEnabled) {            log.debug("Exit: DeserializationContext::startPrefixMapping()");        }    }    public void endPrefixMapping(String prefix)        throws SAXException    {        if (debugEnabled) {            log.debug("Enter: DeserializationContext::endPrefixMapping(" + prefix + ")");        }        if (!doneParsing && (recorder != null)) {            recorder.endPrefixMapping(prefix);        }        if (topHandler != null) {            topHandler.endPrefixMapping(prefix);        }        if (debugEnabled) {            log.debug("Exit: DeserializationContext::endPrefixMapping()");        }    }    public void setDocumentLocator(Locator locator)    {        if (!doneParsing && (recorder != null)) {            recorder.setDocumentLocator(locator);        }        this.locator = locator;    }    public Locator getDocumentLocator() {        return locator;    }    public void characters(char[] p1, int p2, int p3) throws SAXException {        if (!doneParsing && (recorder != null)) {            recorder.characters(p1, p2, p3);        }        if (topHandler != null) {            topHandler.characters(p1, p2, p3);        }    }    public void ignorableWhitespace(char[] p1, int p2, int p3) throws SAXException {        if (!doneParsing && (recorder != null)) {            recorder.ignorableWhitespace(p1, p2, p3);        }        if (topHandler != null) {            topHandler.ignorableWhitespace(p1, p2, p3);        }    }    public void processingInstruction(String p1, String p2) throws SAXException {        // must throw an error since SOAP 1.1 doesn't allow        // processing instructions anywhere in the message        throw new SAXException(Messages.getMessage("noInstructions00"));    }    public void skippedEntity(String p1) throws SAXException {        if (!doneParsing && (recorder != null)) {            recorder.skippedEntity(p1);        }        topHandler.skippedEntity(p1);    }    /**     * startElement is called when an element is read.  This is the big work-horse.     *     * This guy also handles monitoring the recording depth if we're recording     * (so we know when to stop).     */    public void startElement(String namespace, String localName,                             String qName, Attributes attributes)        throws SAXException    {        if (debugEnabled) {            log.debug("Enter: DeserializationContext::startElement(" + namespace + ", " + localName + ")");        }        if (attributes == null || attributes.getLength() == 0) {            attributes = NullAttributes.singleton;        } else {            attributes = new AttributesImpl(attributes);            SOAPConstants soapConstants = getSOAPConstants();            if (soapConstants == SOAPConstants.SOAP12_CONSTANTS) {                if (attributes.getValue(soapConstants.getAttrHref()) != null &&                    attributes.getValue(Constants.ATTR_ID) != null) {                    AxisFault fault = new AxisFault(Constants.FAULT_SOAP12_SENDER,                        null, Messages.getMessage("noIDandHREFonSameElement"), null, null, null);                    throw new SAXException(fault);                }            }        }        SOAPHandler nextHandler = null;        String prefix = "";        int idx = qName.indexOf(':');        if (idx > 0) {            prefix = qName.substring(0, idx);        }        if (topHandler != null) {            nextHandler = topHandler.onStartChild(namespace,                                                       localName,                                                       prefix,                                                       attributes,                                                       this);        }        if (nextHandler == null) {            nextHandler = new SOAPHandler();        }        pushElementHandler(nextHandler);        nextHandler.startElement(namespace, localName, prefix,                                 attributes, this);        if (!doneParsing && (recorder != null)) {            recorder.startElement(namespace, localName, qName,                                  attributes);            if (!doneParsing) {                curElement.setContentsIndex(recorder.getLength());            }        }        if (startOfMappingsPos != -1) {            startOfMappingsPos = -1;        } else {            // Push an empty frame if there are no mappings            namespaces.push();        }        if (debugEnabled) {            log.debug("Exit: DeserializationContext::startElement()");        }    }    /**     * endElement is called at the end tag of an element     */    public void endElement(String namespace, String localName, String qName)        throws SAXException    {        if (debugEnabled) {            log.debug("Enter: DeserializationContext::endElement(" + namespace + ", " + localName + ")");        }        if (!doneParsing && (recorder != null)) {            recorder.endElement(namespace, localName, qName);        }        try {            SOAPHandler handler = popElementHandler();            handler.endElement(namespace, localName, this);            if (topHandler != null) {                topHandler.onEndChild(namespace, localName, this);            } else {                // We should be done!            }        } finally {            if (curElement != null) {                curElement = (MessageElement)curElement.getParentElement();            }            namespaces.pop();            if (debugEnabled) {                String name = curElement != null ?                        curElement.getClass().getName() + ":" +                        curElement.getName() : null;                log.debug("Popped element stack to " + name);                log.debug("Exit: DeserializationContext::endElement()");            }        }    }    /**     * This class is used to map ID's to an actual value Object or Message     */    private static class LocalIDResolver implements IDResolver    {        HashMap idMap = null;        /**         * Add object associated with id         */        public void addReferencedObject(String id, Object referent)        {            if (idMap == null) {                idMap = new HashMap();            }            idMap.put(id, referent);        }        /**         * Get object referenced by href         */        public Object getReferencedObject(String href)        {            if ((idMap == null) || (href == null)) {                return null;            }            return idMap.get(href);        }    }    public void startDTD(java.lang.String name,                     java.lang.String publicId,                     java.lang.String systemId)              throws SAXException    {        /* It is possible for a malicious user to send us bad stuff in           the <!DOCTYPE ../> tag that will cause a denial of service           Example:           <?xml version="1.0" ?>            <!DOCTYPE foobar [                <!ENTITY x0 "hello">                <!ENTITY x1 "&x0;&x0;">                <!ENTITY x2 "&x1;&x1;">                  ...                <!ENTITY x99 "&x98;&x98;">                <!ENTITY x100 "&x99;&x99;">            ]>        */        throw new SAXException(Messages.getMessage("noInstructions00"));        /* if (recorder != null)            recorder.startDTD(name, publicId, systemId);        */    }    public void endDTD()            throws SAXException    {        if (recorder != null)            recorder.endDTD();    }    public void startEntity(java.lang.String name)                 throws SAXException    {        if (recorder != null)            recorder.startEntity(name);    }    public void endEntity(java.lang.String name)               throws SAXException    {        if (recorder != null)            recorder.endEntity(name);    }    public void startCDATA()                throws SAXException    {        if (recorder != null)            recorder.startCDATA();    }    public void endCDATA()              throws SAXException    {        if (recorder != null)            recorder.endCDATA();    }    public void comment(char[] ch,                    int start,                    int length)             throws SAXException    {        if (recorder != null)            recorder.comment(ch, start, length);    }    public InputSource resolveEntity(String publicId, String systemId)    {        return XMLUtils.getEmptyInputSource();    }    /** We only need one instance of this dummy handler to set into the parsers. */    private static final NullLexicalHandler nullLexicalHandler = new NullLexicalHandler();    /**     * It is illegal to set the lexical-handler property to null. To facilitate     * discarding the heavily loaded instance of DeserializationContextImpl from     * the SAXParser instance that is kept in the Stack maintained by XMLUtils     * we use this class.     */    private static class NullLexicalHandler implements LexicalHandler {    	public void startDTD(String arg0, String arg1, String arg2) throws SAXException {}    	public void endDTD() throws SAXException {}    	public void startEntity(String arg0) throws SAXException {}    	public void endEntity(String arg0) throws SAXException {}    	public void startCDATA() throws SAXException {}    	public void endCDATA() throws SAXException {}    	public void comment(char[] arg0, int arg1, int arg2) throws SAXException {}    }}

⌨️ 快捷键说明

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