|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmlBlaster.util.ReplaceVariable
public final class ReplaceVariable
org.xmlBlaster.test.classtest.ReplaceVariableTest
,
The util.property.env requirementField Summary | |
---|---|
private java.lang.String |
endToken
|
private int |
maxNest
|
private java.lang.String |
startToken
|
private boolean |
throwException
|
Constructor Summary | |
---|---|
ReplaceVariable()
|
|
ReplaceVariable(java.lang.String startToken,
java.lang.String endToken)
|
Method Summary | |
---|---|
java.lang.String |
charChain(char oneChar,
int count)
returns a String that contains count time the passed character |
static java.lang.String |
extract(java.lang.String xml,
java.lang.String tag)
Find the given tag from the given xml string and return its value. |
static java.lang.String |
extract(java.lang.String xml,
java.lang.String tag,
java.lang.String attributeName)
Find the given attribute from the given tag from the given xml string and return its value. |
static java.lang.String |
extractIgnoreAttr(java.lang.String xml,
java.lang.String tag)
If the tag can have attributes |
static java.lang.String |
extractWithMatchingAttrs(java.lang.String xml,
java.lang.String tag,
java.lang.String attrString)
Find the given tag from the given xml string and return its value. |
static void |
main(java.lang.String[] args)
Method for testing only. |
java.lang.String |
replace(java.lang.String text,
I_ReplaceVariable cb)
Replace dynamic variables, e.g. |
static java.lang.String |
replaceAll(java.lang.String str,
int fromIndex,
java.lang.String from,
java.lang.String to)
Replace all occurrences of "from" with to "to". |
static java.lang.String |
replaceAll(java.lang.String str,
java.lang.String from,
java.lang.String to)
Replace all occurrences of "from" with to "to". |
static java.lang.String |
replaceFirst(java.lang.String str,
java.lang.String from,
java.lang.String to)
Replace exactly one occurrence of "from" with to "to" |
void |
setMaxNest(int maxNest)
|
void |
setThrowException(boolean throwException)
|
static java.lang.String[] |
toArray(java.lang.String str,
java.lang.String separator)
Convert a separator based string to an array of strings. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int maxNest
private java.lang.String startToken
private java.lang.String endToken
private boolean throwException
Constructor Detail |
---|
public ReplaceVariable()
public ReplaceVariable(java.lang.String startToken, java.lang.String endToken)
Method Detail |
---|
public void setMaxNest(int maxNest)
public void setThrowException(boolean throwException)
public java.lang.String charChain(char oneChar, int count)
oneChar
- charcount
- int
public final java.lang.String replace(java.lang.String text, I_ReplaceVariable cb)
text
- The value string which may contain zero to many ${...} variablescb
- The callback supplied by you which replaces the found keys (from ${key})
java.lang.IllegalArgumentException
- if matching "}" is missingpublic static final java.lang.String replaceAll(java.lang.String str, int fromIndex, java.lang.String from, java.lang.String to)
public static final java.lang.String replaceAll(java.lang.String str, java.lang.String from, java.lang.String to)
public static final java.lang.String replaceFirst(java.lang.String str, java.lang.String from, java.lang.String to)
public static final java.lang.String[] toArray(java.lang.String str, java.lang.String separator)
key
- the key to look fordefaultVal
- The default value to return if key is not foundseparator
- The separator, typically ","
public static java.lang.String extract(java.lang.String xml, java.lang.String tag)
tag
- For example "nodeId" for a tag <nodeId>value</nodeId>
public static java.lang.String extractIgnoreAttr(java.lang.String xml, java.lang.String tag)
xml
- tag
- For example "nodeId" for a tag <nodeId something='ignored'>value</nodeId>
public static java.lang.String extractWithMatchingAttrs(java.lang.String xml, java.lang.String tag, java.lang.String attrString)
tag
- For example "nodeId" for a tag <nodeId>value</nodeId>attrToMatch.
- If you want to parse <nodeId name='dummy' x='3'>value</nodeId> then
you need to pass " name='dummy' x='3'" here.
public static java.lang.String extract(java.lang.String xml, java.lang.String tag, java.lang.String attributeName)
xml
- The xml string to parsetag
- For example "node" for a tag <node id='heron'>attributeName
- "id"
public static void main(java.lang.String[] args)
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |