Inheritance: java.lang.Object
Ejemplo n.º 1
0
        /**
         * "Parse" an XML document for the first occurrence of a particular substring and
         * return the position of the character <em>following</em> it.
         *
         * This enables the invoker to "count" its way through an XML document (by placing
         * the invocation in a loop), access attribute values, skip over closing XML tags,
         * and so forth.
         *
         * @param xmlDoc
         * 	The target XML document.
         * @param subStr
         * 	The target substring, typically an opening XML tag and its initial attribute
         * 	<em>or</em> a closing XML tag, such as:
         * <ul>
         * 	<li><code>&lt;part identity="</code></li>
         * 	<li><code>&lt;/part&gt;</code></li>
         * </ul>
         * @param xmlStart
         * 	The character position (from zero) in the document at which to start
         *  looking for the target substring.
         *
         * @return
         * 	A ParsePosition instance with its index set to the position of the character
         *  <em>following</em> the target substring or null if not found.
         *
         * @since 1.0
         */
        public ParsePosition getXmlSubStrPos(String xmlDoc, String subStr, ParsePosition xmlStart)
        {
            if (verboseDebugLvl)
            {
                MySession.myConsole.printf("%s.getXmlSubStrPos: xmlDoc =%n%s%nsubStr = %s%nstartIdx = %d%n",
                        MY_CLASS_TAG, xmlDoc, subStr, xmlStart.getIndex());
            }

            parsePos.setErrorIndex(-1);

            int i = xmlDoc.IndexOf(subStr, xmlStart.getIndex());
            if (i != -1)
            {
                parsePos.setIndex((i + subStr.Length));
                return (parsePos);
            }

            return (null);
        }
Ejemplo n.º 2
0
 public virtual Date parse(string source, ParsePosition pos)
 {
   return (Date) null;
 }
Ejemplo n.º 3
0
 public virtual Number parse(string source, ParsePosition parsePosition)
 {
   return (Number) null;
 }
        /// <summary>
        /// Gets a copy of the date and time format symbols of this date format.
        /// </summary>
        //public DateFormatSymbols getDateFormatSymbols()
        //{
        //    return default(DateFormatSymbols);
        //}

        /// <summary>
        /// Parses text from a string to produce a <code>Date</code>.
        /// </summary>
        public override Date parse(string text, ParsePosition pos)
        {
            return default(Date);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Parses text from a string to produce an object.
 /// <para>
 /// The method attempts to parse text starting at the index given by
 /// <code>pos</code>.
 /// If parsing succeeds, then the index of <code>pos</code> is updated
 /// to the index after the last character used (parsing does not necessarily
 /// use all characters up to the end of the string), and the parsed
 /// object is returned. The updated <code>pos</code> can be used to
 /// indicate the starting point for the next call to this method.
 /// If an error occurs, then the index of <code>pos</code> is not
 /// changed, the error index of <code>pos</code> is set to the index of
 /// the character where the error occurred, and null is returned.
 ///
 /// </para>
 /// </summary>
 /// <param name="source"> A <code>String</code>, part of which should be parsed. </param>
 /// <param name="pos"> A <code>ParsePosition</code> object with index and error
 ///            index information as described above. </param>
 /// <returns> An <code>Object</code> parsed from the string. In case of
 ///         error, returns null. </returns>
 /// <exception cref="NullPointerException"> if <code>pos</code> is null. </exception>
 public abstract Object ParseObject(String source, ParsePosition pos);
Ejemplo n.º 6
0
        /// <summary>
        /// Gets a copy of the date and time format symbols of this date format.
        /// </summary>
        //public DateFormatSymbols getDateFormatSymbols()
        //{
        //    return default(DateFormatSymbols);
        //}

        /// <summary>
        /// Parses text from a string to produce a <code>Date</code>.
        /// </summary>
        public override Date parse(string text, ParsePosition pos)
        {
            return(default(Date));
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Parses text from a string to produce a <code>Date</code>.
 /// </summary>
 public object parseObject(string source, ParsePosition pos)
 {
     return(default(object));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Parse a date/time string according to the given parse position.
 /// </summary>
 public abstract Date parse(string source, ParsePosition pos);
Ejemplo n.º 9
0
 /// <summary>
 /// Parses text from a string to produce a <code>Date</code>.
 /// <para>
 /// The method attempts to parse text starting at the index given by
 /// <code>pos</code>.
 /// If parsing succeeds, then the index of <code>pos</code> is updated
 /// to the index after the last character used (parsing does not necessarily
 /// use all characters up to the end of the string), and the parsed
 /// date is returned. The updated <code>pos</code> can be used to
 /// indicate the starting point for the next call to this method.
 /// If an error occurs, then the index of <code>pos</code> is not
 /// changed, the error index of <code>pos</code> is set to the index of
 /// the character where the error occurred, and null is returned.
 /// </para>
 /// <para>
 /// See the <seealso cref="#parse(String, ParsePosition)"/> method for more information
 /// on date parsing.
 ///
 /// </para>
 /// </summary>
 /// <param name="source"> A <code>String</code>, part of which should be parsed. </param>
 /// <param name="pos"> A <code>ParsePosition</code> object with index and error
 ///            index information as described above. </param>
 /// <returns> A <code>Date</code> parsed from the string. In case of
 ///         error, returns null. </returns>
 /// <exception cref="NullPointerException"> if <code>pos</code> is null. </exception>
 public override Object ParseObject(String source, ParsePosition pos)
 {
     return(Parse(source, pos));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Parse a date/time string according to the given parse position.  For
 /// example, a time text {@code "07/10/96 4:5 PM, PDT"} will be parsed into a {@code Date}
 /// that is equivalent to {@code Date(837039900000L)}.
 ///
 /// <para> By default, parsing is lenient: If the input is not in the form used
 /// by this object's format method but can still be parsed as a date, then
 /// the parse succeeds.  Clients may insist on strict adherence to the
 /// format by calling <seealso cref="#setLenient(boolean) setLenient(false)"/>.
 ///
 /// </para>
 /// <para>This parsing operation uses the <seealso cref="#calendar"/> to produce
 /// a {@code Date}. As a result, the {@code calendar}'s date-time
 /// fields and the {@code TimeZone} value may have been
 /// overwritten, depending on subclass implementations. Any {@code
 /// TimeZone} value that has previously been set by a call to
 /// <seealso cref="#setTimeZone(java.util.TimeZone) setTimeZone"/> may need
 /// to be restored for further operations.
 ///
 /// </para>
 /// </summary>
 /// <param name="source">  The date/time string to be parsed
 /// </param>
 /// <param name="pos">   On input, the position at which to start parsing; on
 ///              output, the position at which parsing terminated, or the
 ///              start position if the parse failed.
 /// </param>
 /// <returns>      A {@code Date}, or {@code null} if the input could not be parsed </returns>
 public abstract DateTime Parse(String source, ParsePosition pos);
Ejemplo n.º 11
0
 /// <summary>
 /// Parses text from a string to produce a <code>Date</code>.
 /// </summary>
 public object parseObject(string source, ParsePosition pos)
 {
     return default(object);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Parse a date/time string according to the given parse position.
 /// </summary>
 public abstract Date parse(string source, ParsePosition pos);
Ejemplo n.º 13
0
        /**
         * "Parse" an XML document for the first occurrence of a particular tag and return its value.
         *
         * The parse terminates upon encountering the <em>first</em> opening angle bracket (<) following
         * the opening target tag.
         *
         * @param xmlDoc
         * 	The target XML document.
         * @param xmlTag
         * 	The target tag <em>including</em> the enclosing angle brackets.
         * @param xmlStart
         * 	The character position (from zero) in the document at which to start
         *  looking for the target tag.
         *
         * @return
         * 	<ul>
         * 		<li>a String representation of the element value, which will be the empty
         * 			string if target tag is empty, for example, <code>&lt;part&gt;&lt;/part&gt;</code></li>
         * 		<li>null if not found</li>
         * </ul>
         *
         * @since 1.0
         */
        public String getXmlValueStr(String xmlDoc, String xmlTag, ParsePosition xmlStart)
        {
            if (verboseDebugLvl)
            {
                MySession.myConsole.printf("%s.getXmlValueStr: xmlDoc =%n%s%nxmlTag = %s%nstartIdx = %d%n",
                                MY_CLASS_TAG, xmlDoc, xmlTag, xmlStart.getIndex());
            }

            int i = xmlDoc.IndexOf(xmlTag, xmlStart.getIndex());
            if (i != -1)
            {
                i += xmlTag.Length;
                int j = xmlDoc.IndexOf("</", i);
                return (xmlDoc.Substring(i, j));
            }
            return (null);
        }
Ejemplo n.º 14
0
        /**
         * "Parse" an XML document for the first occurrence of a particular tag and return its value, which is assumed to be a number.
         *
         * The parse terminates based on the rules for java.text.DecimalFormat, using the
         * pattern and symbol sets for the default Locale.
         *
         * @param xmlDoc
         * 	The target XML document.
         * @param xmlTag
         * 	The target tag <em>including</em> the enclosing angle brackets.
         * @param xmlStart
         * 	The character position (from zero) in the document at which to start
         *  looking for the target tag.
         *
         * @return
         * 	<ul>
         * 		<li>an integer representation of the element value</li>
         * 		<li>-1 if:
         * 			<ul>
         * 				<li>not found</li>
         * 				<li>the target tag is empty, for example, <code>&lt;part&gt;&lt;/part&gt;</code></li>
         * 				<li>a parse error occurred</li>
         * 			</ul>
         * 		</li>
         * 	</ul>
         *
         * @since 1.0
         */
        public int getXmlValueNum(String xmlDoc, String xmlTag, ParsePosition xmlStart)
        {
            if (verboseDebugLvl)
            {
                MySession.myConsole.printf("%s.getXmlValueNum: xmlDoc =%n%s%nxmlTag = %s%nstartIdx = %d%n",
                                MY_CLASS_TAG, xmlDoc, xmlTag, xmlStart.getIndex());
            }

            parseFmt.setParseBigDecimal(false);
            parsePos.setErrorIndex(-1);

            int i = xmlDoc.IndexOf(xmlTag, xmlStart.getIndex());
            if (i != -1)
            {
                parsePos.setIndex((i + xmlTag.Length));
                if ((parseResult = parseFmt.parse(xmlDoc, parsePos)) != null)
                {
                    return (parseResult.intValue());
                }
            }
            return (-1);
        }