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

📄 xmlelement.java

📁 这是linux下ssl vpn的实现程序
💻 JAVA
📖 第 1 页 / 共 5 页
字号:

    /**
     * Returns an attribute by looking up a key in a hashtable.
     * 
     * @param name name 
     * @param valueSet  value
     * @param defaultKey default
     * @return attribute
     *
     * @deprecated Use {@link #getIntAttribute(java.lang.String,
     *             java.util.Hashtable, java.lang.String, boolean)
     *             getIntAttribute} instead.
     */
    public int getIntProperty(String    name,
                              Hashtable valueSet,
                              String    defaultKey)
    {
        return this.getIntAttribute(name, valueSet, defaultKey, false);
    }


    /**
     * Returns an attribute.
     * 
     * @param name name 
     * @return attribute
     *
     * @deprecated Use {@link #getStringAttribute(java.lang.String)
     *             getStringAttribute} instead.
     */
    public String getProperty(String name)
    {
        return this.getStringAttribute(name);
    }


    /**
     * Returns an attribute.
     * 
     * @param name name
     * @param defaultValue default value 
     * @return attribute
     *
     * @deprecated Use {@link #getStringAttribute(java.lang.String,
     *             java.lang.String) getStringAttribute} instead.
     */
    public String getProperty(String name,
                              String defaultValue)
    {
        return this.getStringAttribute(name, defaultValue);
    }


    /**
     * Returns an attribute.
     * 
     * @param name name
     * @param defaultValue default value 
     * @return attribute
     *
     * @deprecated Use {@link #getIntAttribute(java.lang.String, int)
     *             getIntAttribute} instead.
     */
    public int getProperty(String name,
                           int    defaultValue)
    {
        return this.getIntAttribute(name, defaultValue);
    }


    /**
     * Returns an attribute.
     * 
     * @param name name 
     * @param defaultValue default value 
     * @return attribute
     * @deprecated Use {@link #getDoubleAttribute(java.lang.String, double)
     *             getDoubleAttribute} instead.
     */
    public double getProperty(String name,
                              double defaultValue)
    {
        return this.getDoubleAttribute(name, defaultValue);
    }


    /**
     * Returns an attribute.
     * 
     * @param key key 
     * @param trueValue true value 
     * @param falseValue fasle value
     * @param defaultValue default value
     * @return attribute
     *
     * @deprecated Use {@link #getBooleanAttribute(java.lang.String,
     *             java.lang.String, java.lang.String, boolean)
     *             getBooleanAttribute} instead.
     */
    public boolean getProperty(String  key,
                               String  trueValue,
                               String  falseValue,
                               boolean defaultValue)
    {
        return this.getBooleanAttribute(key, trueValue, falseValue,
                                        defaultValue);
    }


    /**
     * Returns an attribute by looking up a key in a hashtable.
     * 
     * @param name name  
     * @param valueSet  value set
     * @param defaultKey default key
     * @return value
     *
     * @deprecated Use {@link #getAttribute(java.lang.String,
     *             java.util.Hashtable, java.lang.String, boolean)
     *             getAttribute} instead.
     */
    public Object getProperty(String    name,
                              Hashtable valueSet,
                              String    defaultKey)
    {
        return this.getAttribute(name, valueSet, defaultKey, false);
    }


    /**
     * Returns an attribute by looking up a key in a hashtable.
     * 
     * @param name name 
     * @param valueSet value set
     * @param defaultKey default key
     * @return attribute
     *
     * @deprecated Use {@link #getStringAttribute(java.lang.String,
     *             java.util.Hashtable, java.lang.String, boolean)
     *             getStringAttribute} instead.
     */
    public String getStringProperty(String    name,
                                    Hashtable valueSet,
                                    String    defaultKey)
    {
        return this.getStringAttribute(name, valueSet, defaultKey, false);
    }


    /**
     * Returns an attribute by looking up a key in a hashtable.
     * 
     * @param name name 
     * @param valueSet value set
     * @param defaultKey default key
     * @return attribute
     * @deprecated Use {@link #getIntAttribute(java.lang.String,
     *             java.util.Hashtable, java.lang.String, boolean)
     *             getIntAttribute} instead.
     */
    public int getSpecialIntProperty(String    name,
                                     Hashtable valueSet,
                                     String    defaultKey)
    {
        return this.getIntAttribute(name, valueSet, defaultKey, true);
    }


    /**
     * Returns an attribute by looking up a key in a hashtable.
     * 
     * @param name name 
     * @param valueSet value set
     * @param defaultKey default value
     * @return attribute
     *
     * @deprecated Use {@link #getDoubleAttribute(java.lang.String,
     *             java.util.Hashtable, java.lang.String, boolean)
     *             getDoubleAttribute} instead.
     */
    public double getSpecialDoubleProperty(String    name,
                                           Hashtable valueSet,
                                           String    defaultKey)
    {
        return this.getDoubleAttribute(name, valueSet, defaultKey, true);
    }


    /**
     * Returns the name of the element.
     * 
     * @return name of element
     * @see XMLElement#setName(java.lang.String) setName(String)
     */
    public String getName()
    {
        return this.name;
    }


    /**
     * Returns the name of the element.
     * 
     * @return name of element
     * @deprecated Use {@link #getName() getName} instead.
     */
    public String getTagName()
    {
        return this.getName();
    }


    /**
     * Reads one XML element from a java.io.Reader and parses it.
     *
     * @param reader
     *     The reader from which to retrieve the XML data.
     *
     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
     * <ul><li><code>reader != null</code>
     *     <li><code>reader</code> is not closed
     * </ul></dd></dl>
     *
     * <dl><dt><b>Postconditions:</b></dt><dd>
     * <ul><li>the state of the receiver is updated to reflect the XML element
     *         parsed from the reader
     *     <li>the reader points to the first character following the last
     *         '&gt;' character of the XML element
     * </ul></dd></dl><dl>
     *
     * @throws java.io.IOException
     *     If an error occured while reading the input.
     * @throws XMLParseException
     *     If an error occured while parsing the read data.
     */
    public void parseFromReader(Reader reader)
    throws IOException, XMLParseException
    {
        this.parseFromReader(reader, /*startingLineNr*/ 1);
    }


    /**
     * Reads one XML element from a java.io.Reader and parses it.
     *
     * @param reader
     *     The reader from which to retrieve the XML data.
     * @param startingLineNr
     *     The line number of the first line in the data.
     *
     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
     * <ul><li><code>reader != null</code>
     *     <li><code>reader</code> is not closed
     * </ul></dd></dl>
     *
     * <dl><dt><b>Postconditions:</b></dt><dd>
     * <ul><li>the state of the receiver is updated to reflect the XML element
     *         parsed from the reader
     *     <li>the reader points to the first character following the last
     *         '&gt;' character of the XML element
     * </ul></dd></dl><dl>
     *
     * @throws java.io.IOException
     *     If an error occured while reading the input.
     * @throws XMLParseException
     *     If an error occured while parsing the read data.
     */
    public void parseFromReader(Reader reader,
                                int    startingLineNr)
        throws IOException, XMLParseException
    {
        this.charReadTooMuch = '\0';
        this.reader = reader;
        this.parserLineNr = startingLineNr;

        for (;;) {
            char ch = this.scanWhitespace();

            if (ch != '<') {
                throw this.expectedInput("<");
            }

            ch = this.readChar();

            if ((ch == '!') || (ch == '?')) {
                this.skipSpecialTag(0);
            } else {
                this.unreadChar(ch);
                this.scanElement(this);
                return;
            }
        }
    }


    /**
     * Reads one XML element from a String and parses it.
     *
     * @param string
     *     The string.
     *
     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
     * <ul><li><code>string != null</code>
     *     <li><code>string.length() &gt; 0</code>
     * </ul></dd></dl>
     *
     * <dl><dt><b>Postconditions:</b></dt><dd>
     * <ul><li>the state of the receiver is updated to reflect the XML element
     *         parsed from the reader
     * </ul></dd></dl><dl>
     *
     * @throws XMLParseException
     *     If an error occured while parsing the string.
     */
    public void parseString(String string)
        throws XMLParseException
    {
        try {
            this.parseFromReader(new StringReader(string),
                                 /*startingLineNr*/ 1);
        } catch (IOException e) {
            // Java exception handling suxx
        }
    }


    /**
     * Reads one XML element from a String and parses it.
     *
     * @param string
     *     The string.
     * @param offset
     *     The first character in <code>string</code> to scan.
     *
     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
     * <ul><li><code>string != null</code>
     *     <li><code>offset &lt; string.length()</code>
     *     <li><code>offset &gt;= 0</code>
     * </ul></dd></dl>
     *
     * <dl><dt><b>Postconditions:</b></dt><dd>
     * <ul><li>the state of the receiver is updated to reflect the XML element
     *         parsed from the reader
     * </ul></dd></dl><dl>
     *
     * @throws XMLParseException
     *     If an error occured while parsing the string.
     */
    public void parseString(String string,
                            int    offset)
        throws XMLParseException
    {
        this.parseString(string.substring(offset));
    }


    /**
     * Reads one XML element from a String and parses it.
     *
     * @param string
     *     The string.
     * @param offset
     *     The first character in <code>string</code> to scan.
     * @param end
     *     The character where to stop scanning.
     *     This character is not scanned.
     *
     * </dl><dl><dt><b>Preconditions:</b></dt><dd>
     * <ul><li><code>string != null</code>
     *     <li><code>end &lt;= string.length()</code>
     *     <li><code>offset &lt; end</code>
     

⌨️ 快捷键说明

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