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

📄 minml.java

📁 实现了一个基于j2me移动gps定位系统
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                            }
                        }
                    } catch (final EmptyStackException e) {
                        fatalError("end tag at begining of document",
                                this.lineNumber, this.columnNumber);
                    }

                    if (mixedContentLevel != -1)
                        --mixedContentLevel;

                    break; // change state to operand

                case emitCharacters:
                    // emit characters

                    buffer.flush();
                    break; // change state to operand

                case emitCharactersSave:
                    // emit characters and save current character

                    if (mixedContentLevel == -1)
                        mixedContentLevel = 0;

                    buffer.flush();

                    buffer.saveChar((char) currentChar);

                    break; // change state to operand

                case possiblyEmitCharacters:
                    // write any skipped whitespace if in mixed content

                    if (mixedContentLevel != -1)
                        buffer.flush();
                    break; // change state to operand

                case saveAttributeName:
                    // save attribute name

                    attributeNames.addElement(buffer.getString());
                    break; // change state to operand

                case saveAttributeValue:
                    // save attribute value

                    attributeValues.addElement(buffer.getString());
                    break; // change state to operand

                case startComment:
                    // change state if we have found "<!--"

                    if (buffer.read() != '-')
                        continue; // not "<!--"

                    break; // change state to operand

                case endComment:
                    // change state if we find "-->"

                    if ((currentChar = buffer.read()) == '-') {
                        // deal with the case where we might have "------->"
                        while ((currentChar = buffer.read()) == '-')
                            ;

                        if (currentChar == '>')
                            break; // end of comment, change state to operand
                    }

                    continue; // not end of comment, don't change state

                case incLevel:

                    level++;

                    break;

                case decLevel:

                    if (level == 0)
                        break; // outer level <> change state

                    level--;

                    continue; // in nested <>, don't change state

                case startCDATA:
                    // change state if we have found "<![CDATA["

                    if (buffer.read() != 'C')
                        continue; // don't change state
                    if (buffer.read() != 'D')
                        continue; // don't change state
                    if (buffer.read() != 'A')
                        continue; // don't change state
                    if (buffer.read() != 'T')
                        continue; // don't change state
                    if (buffer.read() != 'A')
                        continue; // don't change state
                    if (buffer.read() != '[')
                        continue; // don't change state
                    break; // change state to operand

                case endCDATA:
                    // change state if we find "]]>"

                    if ((currentChar = buffer.read()) == ']') {
                        // deal with the case where we might have "]]]]]]]>"
                        while ((currentChar = buffer.read()) == ']')
                            buffer.write(']');

                        if (currentChar == '>')
                            break; // end of CDATA section, change state to
                        // operand

                        buffer.write(']');
                    }

                    buffer.write(']');
                    buffer.write(currentChar);
                    continue; // not end of CDATA section, don't change state

                case processCharRef:
                    // process character entity

                    int crefState = 0;

                    currentChar = buffer.read();

                    while (true) {
                        if ("#amp;&pos;'quot;\"gt;>lt;<".charAt(crefState) == currentChar) {
                            crefState++;

                            if (currentChar == ';') {
                                buffer.write("#amp;&pos;'quot;\"gt;>lt;<"
                                        .charAt(crefState));
                                break;

                            } else if (currentChar == '#') {
                                final int radix;

                                currentChar = buffer.read();

                                if (currentChar == 'x') {
                                    radix = 16;
                                    currentChar = buffer.read();
                                } else {
                                    radix = 10;
                                }

                                int charRef = Character.digit(
                                        (char) currentChar, radix);

                                while (true) {
                                    currentChar = buffer.read();

                                    final int digit = Character.digit(
                                            (char) currentChar, radix);

                                    if (digit == -1)
                                        break;

                                    charRef = (char) ((charRef * radix) + digit);
                                }

                                if (currentChar == ';' && charRef != -1) {
                                    buffer.write(charRef);
                                    break;
                                }

                                fatalError("invalid Character Entitiy",
                                        this.lineNumber, this.columnNumber);
                            } else {
                                currentChar = buffer.read();
                            }
                        } else {
                            crefState = ("\u0001\u000b\u0006\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff"
                                    +
                                    // # a m p ; & p o s ; '
                                    // 0 1 2 3 4 5 6 7 8 9 a
                                    "\u0011\u00ff\u00ff\u00ff\u00ff\u00ff\u0015\u00ff\u00ff\u00ff"
                                    +
                                    // q u o t ; " g t ; >
                                    // b b d e f 10 11 12 13 14
                                    "\u00ff\u00ff\u00ff").charAt(crefState);
                            // l t ;
                            // 15 16 17

                            if (crefState == 255)
                                fatalError("invalid Character Entitiy",
                                        this.lineNumber, this.columnNumber);
                        }
                    }

                    break;

                case parseError:
                    // report fatal error

                    fatalError(operand, this.lineNumber, this.columnNumber);
                    // drop through to exit parser

                case exitParser:
                    // exit parser

                    return;

                case writeCdata:
                    // write character data
                    // this will also write any skipped whitespace

                    buffer.write(currentChar);
                    break; // change state to operand

                case discardAndChange:
                    // throw saved characters away and change state

                    buffer.reset();
                    break; // change state to operand

                case discardSaveAndChange:
                    // throw saved characters away, save character and change
                    // state

                    buffer.reset();
                    // drop through to save character and change state

                case saveAndChange:
                    // save character and change state

                    buffer.saveChar((char) currentChar);
                    break; // change state to operand

                case change:
                    // change state to operand

                    break; // change state to operand
                }

                state = operand;
            }
        } catch (final IOException e) {
            this.errorHandler.fatalError(new SAXParseException(e.getMessage(),
                    null, null, this.lineNumber, this.columnNumber, e));
        } finally {
            this.errorHandler = this;
            this.documentHandler = this.extDocumentHandler = this;
            this.tags.removeAllElements();
        }
    }

    public void parse(final InputSource source) throws SAXException,
            IOException {
        if (source.getCharacterStream() != null)
            parse(source.getCharacterStream());
        else if (source.getByteStream() != null)
            parse(new InputStreamReader(source.getByteStream(), "UTF-8"));
        // else
        // parse(new InputStreamReader(new
        // URL(source.getSystemId()).openStream()));
    }

    public void parse(final String systemId) throws SAXException, IOException {
        parse(new InputSource(systemId));
    }

    // public void setLocale(final Locale locale) throws SAXException {
    // throw new SAXException("Not supported");
    // }

    public void setEntityResolver(final EntityResolver resolver) {
        // not supported
    }

    public void setDTDHandler(final DTDHandler handler) {
        // not supported
    }

    /**
     * @param handler
     *            the documentHandler to set
     * @uml.property name="documentHandler"
     */
    public void setDocumentHandler(final org.xml.sax.DocumentHandler handler) {
        this.documentHandler = (handler == null) ? this : handler;
        this.extDocumentHandler = this;
    }

    /**
     * @param handler
     *            The documentHandler to set.
     */

⌨️ 快捷键说明

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