www.element4solution.com

e4s.util
Class E4SimpleXmlEncoder

java.lang.Object
  extended by e4s.util.E4Object
      extended by e4s.util.E4SimpleXmlEncoder

public class E4SimpleXmlEncoder
extends E4Object

Simple XML decoding, enables the encoding of simple structured XML strings.


Field Summary
 
Fields inherited from class e4s.util.E4Object
CRLF, E4S_CORE_SYSTEM_LANGUAGE, NBSP, NULLSTR, URL_ENCODING_CHARSET
 
Constructor Summary
E4SimpleXmlEncoder()
           
 
Method Summary
static java.lang.String _getSVNVersionString()
          Get version info string from subversion.
static java.lang.String[] findTags(java.lang.String xmlString)
           
static java.lang.StringBuffer get(java.io.File file)
          Open the specified file (if exists) and read the whole content.
static java.lang.String get(java.io.File file, java.lang.String tag)
          Open the specified file (if exists) and read the whole content.
static java.lang.String get(java.lang.StringBuffer buf, java.lang.String tag)
          Get the tag out of an XML string.
static java.lang.String get(java.lang.String buf, java.lang.String tag)
          Get the tag out of an XML string.
static java.lang.String get(java.lang.String buf, java.lang.String tag, boolean decode_html)
          Get the tag out of an XML string.
static java.lang.String[] getArray(java.io.File file, java.lang.String tag)
          Open the specified file (if exists), read the whole content and extract one tag as array.
static java.lang.String[] getArray(java.lang.StringBuffer buf, java.lang.String tag)
          Get the tag out of an XML string.
static java.lang.String[] getArray(java.lang.String buf, java.lang.String tag)
          Get the tag out of an XML string.
static boolean getBool(java.lang.String buf, java.lang.String tag)
          Get a flobooleanat value.
static char getChar(java.lang.String buf, java.lang.String tag)
          Get a character value.
static java.util.Date getDate(java.lang.StringBuffer buf, java.lang.String tag, java.lang.String format)
           
static java.util.Date getDate(java.lang.String buf, java.lang.String tag)
          Get a date value in the representation of the E4S datadictionary date format ("yyyyMMddHHmmss")
static java.util.Date getDate(java.lang.String buf, java.lang.String tag, java.lang.String format)
           
static float getFloat(java.lang.String buf, java.lang.String tag)
          Get a float value.
static int getInt(java.lang.StringBuffer buf, java.lang.String tag)
           
static int getInt(java.lang.String buf, java.lang.String tag)
          Get an integer value.
static java.lang.String unescapeTag(java.lang.String s)
          Replaces escaped character sequences by their real representation, useful when reading XML files pwritten with E4PrintStream.
 
Methods inherited from class e4s.util.E4Object
Calendar, CName, CName, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelSys, E4LabelSys, e4sCopyright, e4sVersion, encode, encode, encode, encodeHtml, encodeHtml, encodeHtml, encodeURL, encodeURL, encodeURL, finalize, getLINE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTraceMemory, HtmlEncode, HtmlEncode, HtmlEncode, isdecimal, isdigit, isnotok, isnotok, isnumeric, isok, isok, isok, isok, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingStack, mkdirs, null2nbsp, null2nbsp, null2nbsp, ok, ok, ok, ok, outPrintln, setLogFile4Trace, setTraceMemory, STACKTRACE, toDebug, toDouble, toFloat, toFloat, toString, TRACE_CALLS, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, wait
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

E4SimpleXmlEncoder

public E4SimpleXmlEncoder()
Method Detail

get

public static java.lang.String get(java.lang.StringBuffer buf,
                                   java.lang.String tag)
Get the tag out of an XML string. Example: get(new StringBuffer("123"),"") returns 123.

Returns:
the extracted value (might be also an XML stuff which requires further extractions).

get

public static java.lang.String get(java.lang.String buf,
                                   java.lang.String tag)
Get the tag out of an XML string. Example: get("<XML><DATA>123</DATA></XML>","DATA") returns 123.

Parameters:
buf - the XML like buffer
tag - the tag to be extracted (without parenthesis)
Returns:
the extracted value (might be also an XML stuff which requires further extractions).

get

public static java.lang.String get(java.lang.String buf,
                                   java.lang.String tag,
                                   boolean decode_html)
Get the tag out of an XML string. Example: get("<XML><DATA>123</DATA></XML>","DATA") returns 123.

Parameters:
buf - the XML like buffer
tag - the tag to be extracted (without parenthesis)
decode_html - see e4s.util.E4Util._decodeHtml(String)
Returns:
the extracted value (might be also an XML stuff which requires further extractions).

getArray

public static java.lang.String[] getArray(java.lang.StringBuffer buf,
                                          java.lang.String tag)
Get the tag out of an XML string. Example: get("123","") returns 123.

Returns:
the extracted value (might be also an XML stuff which requires further extractions).

getArray

public static java.lang.String[] getArray(java.lang.String buf,
                                          java.lang.String tag)
Get the tag out of an XML string. Example: get("123","") returns 123.

Returns:
the extracted value (might be also an XML stuff which requires further extractions).

getDate

public static java.util.Date getDate(java.lang.String buf,
                                     java.lang.String tag)
Get a date value in the representation of the E4S datadictionary date format ("yyyyMMddHHmmss")

Returns:
the extracted date value

getDate

public static java.util.Date getDate(java.lang.StringBuffer buf,
                                     java.lang.String tag,
                                     java.lang.String format)

getDate

public static java.util.Date getDate(java.lang.String buf,
                                     java.lang.String tag,
                                     java.lang.String format)

getInt

public static int getInt(java.lang.String buf,
                         java.lang.String tag)
Get an integer value.

Returns:
the extracted integer value

getInt

public static int getInt(java.lang.StringBuffer buf,
                         java.lang.String tag)

getChar

public static char getChar(java.lang.String buf,
                           java.lang.String tag)
Get a character value.

Returns:
the extracted integer value

getFloat

public static float getFloat(java.lang.String buf,
                             java.lang.String tag)
Get a float value.

Returns:
the extracted float value

getBool

public static boolean getBool(java.lang.String buf,
                              java.lang.String tag)
Get a flobooleanat value.

Returns:
the extracted boolean value

get

public static java.lang.String get(java.io.File file,
                                   java.lang.String tag)
                            throws java.io.IOException
Open the specified file (if exists) and read the whole content.

Parameters:
file - the file to be read
tag - the tag to be extracted
Returns:
the content in the file
Throws:
java.io.IOException
See Also:
get(String,String), getArray(java.io.File,String), #getArray(java.io.File)

getArray

public static java.lang.String[] getArray(java.io.File file,
                                          java.lang.String tag)
                                   throws java.io.IOException
Open the specified file (if exists), read the whole content and extract one tag as array.

Parameters:
file - the file to be read
tag - the tag to be extracted
Returns:
the content in the file
Throws:
java.io.IOException
See Also:
getArray(String,String), get(java.io.File), get(java.io.File,String)

get

public static java.lang.StringBuffer get(java.io.File file)
                                  throws java.io.IOException
Open the specified file (if exists) and read the whole content.

Parameters:
file - the file to be read
Returns:
the content in the file
Throws:
java.io.IOException
See Also:
getArray(String,String), get(java.io.File,String)

unescapeTag

public static java.lang.String unescapeTag(java.lang.String s)
Replaces escaped character sequences by their real representation, useful when reading XML files pwritten with E4PrintStream.

Parameters:
s - a string like "abc&lt;123&>"
res - a string like "abc<123>"
See Also:
E4PrintStream.escapeTag(String)

findTags

public static java.lang.String[] findTags(java.lang.String xmlString)

_getSVNVersionString

public static java.lang.String _getSVNVersionString()
Get version info string from subversion.

Returns:
the version info string.
See Also:
E4Util.getRevisionCodeFromSVN(Class)

www.element4solution.com