Framework Professional Edition Package


com.prosyst.util.xml
Class XMLUtil

java.lang.Object
  extended by com.prosyst.util.xml.XMLUtil

public class XMLUtil
extends java.lang.Object

Class with utility methods for extracting attributes from xml tags


Field Summary
static java.lang.String[] coded
          Coded chars placed in the xml content.
static java.lang.String[] decoded
          Corresponding decoded chars.
protected static char[] f_ent_chars
           
protected static java.lang.String[] f_entities
          Checks whether the tag name string between < and >, ends with "/".
 
Constructor Summary
XMLUtil()
           
 
Method Summary
static java.util.Vector getAttributeNames(java.lang.String tag)
          Deprecated. use TagClass.getAttrList() instead
static java.lang.String getAttributeValue(java.lang.String tag, java.lang.String att, int begin)
          Deprecated. use TagClass.getAttrList() and TagClass.getAttribute(String attr) instead
static java.util.Vector getAttributeValues(java.lang.String tag)
          Deprecated. use TagClass.getAttrList() instead
static java.lang.String getContent(TagClass tag, int pos, java.lang.String name)
          Deprecated. use TagClass.getContent(int pos, String name) instead
static java.lang.String getDecoded(java.lang.String src)
          Converts special xml chars to valid string e.g.
static java.lang.String getTagName(java.lang.String tagAndAttributes)
          Deprecated. use TagClass.getName() instead
static boolean isEmptyTag(java.lang.String tagName)
           
static void replace(java.lang.String src, java.lang.String toBeReplaced, java.lang.String toReplaceWith, com.prosyst.util.string.CharBuffer strBuf)
          Replaces a specified string in a source string with a corresponding string and adds the result in a buffer.
static java.lang.String replaceChars(java.lang.String str, java.lang.String[] toBeReplaced, java.lang.String[] replaceWith, int length)
          Replaces specified strings in a source string with corresponding strings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

coded

public static java.lang.String[] coded
Coded chars placed in the xml content.


decoded

public static java.lang.String[] decoded
Corresponding decoded chars. First five of them cannot exist in plain (decoded) form in the xml content, but the rest can be eighter coded or decoded


f_entities

protected static final java.lang.String[] f_entities
Checks whether the tag name string between < and >, ends with "/".


f_ent_chars

protected static final char[] f_ent_chars
Constructor Detail

XMLUtil

public XMLUtil()
Method Detail

replaceChars

public static java.lang.String replaceChars(java.lang.String str,
                                            java.lang.String[] toBeReplaced,
                                            java.lang.String[] replaceWith,
                                            int length)
Replaces specified strings in a source string with corresponding strings

Parameters:
str - source string
toBeReplaced - array of strings which will be replaced with the next parameter
replaceWith - array of the strings corresponding to "toBeReplaced" parameter. the length should be equal
length - specify how many parameters of the string array will be replaced, the rest of "toBeReplaced" parameter will not.
Returns:
replaced string

replace

public static void replace(java.lang.String src,
                           java.lang.String toBeReplaced,
                           java.lang.String toReplaceWith,
                           com.prosyst.util.string.CharBuffer strBuf)
Replaces a specified string in a source string with a corresponding string and adds the result in a buffer.

Parameters:
src - source string
toBeReplaced - string which will be replaced with the next parameter
toReplaceWith - the string corresponding to "toBeReplaced" parameter.
strBuf - here is added the replaced source string.

getDecoded

public static java.lang.String getDecoded(java.lang.String src)
Converts special xml chars to valid string e.g. "&lt;" becomes "<" and "&gt;" becomes ">"

Parameters:
src - source string which is coded
Returns:
decoded string

getTagName

public static java.lang.String getTagName(java.lang.String tagAndAttributes)
Deprecated. use TagClass.getName() instead

Extracts the name of the tag, from string containing the name and attributes

Parameters:
tagAndAttributes - string containing the name and attributes
Returns:
tag name string separated by space from the tag attributes

isEmptyTag

public static boolean isEmptyTag(java.lang.String tagName)

getAttributeValue

public static java.lang.String getAttributeValue(java.lang.String tag,
                                                 java.lang.String att,
                                                 int begin)
Deprecated. use TagClass.getAttrList() and TagClass.getAttribute(String attr) instead

Extracts an attribute value for a specified attribute name from tag string.

Parameters:
tag - whole tag name
att - attribute name
Returns:
value of the attribute if exists otherwise return null

getAttributeNames

public static java.util.Vector getAttributeNames(java.lang.String tag)
Deprecated. use TagClass.getAttrList() instead

Extracts attribute names from tag string.

Parameters:
tag - whole tag name
Returns:
A vector with all attribute names

getAttributeValues

public static java.util.Vector getAttributeValues(java.lang.String tag)
Deprecated. use TagClass.getAttrList() instead

Extracts attribute values from tag string.

Parameters:
tag - whole tag name
Returns:
A vector with all attribute values

getContent

public static java.lang.String getContent(TagClass tag,
                                          int pos,
                                          java.lang.String name)
                                   throws java.lang.IllegalArgumentException
Deprecated. use TagClass.getContent(int pos, String name) instead

Returns content of the specified subtag.

Parameters:
tag - parent tag
pos - position of the searched tag in child array of the parent tag
name - name of the searched tag
Returns:
content of the specified subtag
Throws:
java.lang.IllegalArgumentException - if the specified name does not match the name of the tag at specified position

Framework Professional Edition Package


Copyright © 1999-2007 ProSyst Software GmbH. All Rights Reserved