|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.allcolor.yahp.cl.converter.utils.CPadawan
public final class CPadawan
A text validation class.
Field Summary | |
---|---|
private static java.lang.String[][] |
entity
html entity list |
private java.lang.String |
entityDecl
handle to entity declaration |
private static CPadawan |
handle
handle to the singleton |
private long |
lastModified
last modification date of the config file |
private java.util.Map |
mapFilter
contains known filters |
private static CMutex |
mutex
use for thread safety access |
Constructor Summary | |
---|---|
CPadawan()
|
Method Summary | |
---|---|
java.lang.String |
createEntityDeclaration()
Create the padawan doctype |
java.lang.String |
decode(java.lang.String toDecode)
decode entity in the string |
java.lang.String |
encode(java.lang.String toEncode)
encode entity in the string |
java.lang.String |
escape(java.lang.String in)
Escape the given string to be a valid content for an xml text node content |
java.lang.String |
escapeAttribute(java.lang.String in)
Escape the given string to be a valid content for an xml attribute |
java.lang.String |
getEntityDeclaration()
return the padawan doctype |
private java.util.List |
getFilter(java.lang.String type)
return the filters of type 'type' |
static CPadawan |
getInstance()
Return an instance of the padawan |
private java.util.List |
getMerge(java.lang.String type)
return the merge list of type 'type' |
private java.util.List |
getTags(java.lang.String type)
return the tag list of type 'type' |
private void |
init()
Initialize the class |
private boolean |
isAlone(java.lang.String tagName,
java.lang.String[] aloneTags)
return true if the given tag name is an empty tag |
private void |
parseDocument(org.w3c.dom.Node currentNode)
parse the configuration file |
private void |
renderXMLRecurs(java.io.PrintWriter out,
org.w3c.dom.Node node,
java.lang.String[] aloneTags)
rewrite the given xmlfile |
java.lang.String |
replaceExpr(java.lang.String message,
java.lang.String type)
Replace the input message using the rules 'type' found in the xml configuration file |
java.lang.String |
rewriteXml(org.w3c.dom.Node xmlDoc,
java.lang.String[] aloneTags)
rewrite the given xmlfile |
java.lang.String |
rewriteXml(org.w3c.dom.Node xmlDoc,
java.lang.String[] aloneTags,
boolean outputXmlHeader)
rewrite the given xmlfile |
java.lang.String |
rewriteXml(java.lang.String xmlFile,
java.lang.String[] aloneTags)
rewrite the given xmlfile |
java.lang.String |
rewriteXml(java.lang.String xmlFile,
java.lang.String[] aloneTags,
boolean outputXmlHeader)
rewrite the given xmlfile |
void |
rewriteXml(java.io.Writer out,
org.w3c.dom.Node xmlDoc,
java.lang.String[] aloneTags)
rewrite the given xmlfile |
void |
rewriteXml(java.io.Writer out,
org.w3c.dom.Node xmlDoc,
java.lang.String[] aloneTags,
boolean outputXmlHeader)
rewrite the given xmlfile |
void |
rewriteXml(java.io.Writer out,
java.lang.String xmlFile,
java.lang.String[] aloneTags)
rewrite the given xmlfile |
void |
rewriteXml(java.io.Writer out,
java.lang.String xmlFile,
java.lang.String[] aloneTags,
boolean outputXmlHeader)
rewrite the given xmlfile |
java.lang.String |
stringReplace(java.lang.String toBeReplaced,
java.lang.String toReplace,
java.lang.String replacement)
A replace string method |
java.lang.String |
validate(java.lang.String in,
java.lang.String type)
validate for xml the string in using the rules type 'type' |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static CPadawan handle
private static final java.lang.String[][] entity
private static final CMutex mutex
private long lastModified
private java.util.Map mapFilter
private java.lang.String entityDecl
Constructor Detail |
---|
public CPadawan()
Method Detail |
---|
public final java.lang.String replaceExpr(java.lang.String message, java.lang.String type)
message
- message to replacetype
- rule type
private final void init()
public static final CPadawan getInstance()
private final java.util.List getFilter(java.lang.String type)
type
- type of filters to get
private final java.util.List getTags(java.lang.String type)
type
- type of tag list to get
private final java.util.List getMerge(java.lang.String type)
type
- type of merge list to get
private final void parseDocument(org.w3c.dom.Node currentNode)
currentNode
- current analysed nodepublic final java.lang.String validate(java.lang.String in, java.lang.String type)
in
- the string to validatetype
- rule type
public final java.lang.String createEntityDeclaration() throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
- should not happenpublic final java.lang.String getEntityDeclaration()
public final java.lang.String decode(java.lang.String toDecode)
toDecode
- the string to decode
public final java.lang.String encode(java.lang.String toEncode)
toEncode
- the string to encode
public final java.lang.String stringReplace(java.lang.String toBeReplaced, java.lang.String toReplace, java.lang.String replacement)
toBeReplaced
- string to replacetoReplace
- regex to matchreplacement
- string replacement for each match
public final java.lang.String rewriteXml(java.lang.String xmlFile, java.lang.String[] aloneTags)
xmlFile
- xml file as a stringaloneTags
- a string array of empty tags
public final java.lang.String rewriteXml(java.lang.String xmlFile, java.lang.String[] aloneTags, boolean outputXmlHeader)
xmlFile
- xml file as a stringaloneTags
- a string array of empty tagsoutputXmlHeader
- true to output xml header
public final void rewriteXml(java.io.Writer out, java.lang.String xmlFile, java.lang.String[] aloneTags)
out
- the writer to write the xmlxmlFile
- xml file as a stringaloneTags
- a string array of empty tagspublic final void rewriteXml(java.io.Writer out, java.lang.String xmlFile, java.lang.String[] aloneTags, boolean outputXmlHeader)
out
- the writer to write the xmlxmlFile
- xml file as a stringaloneTags
- a string array of empty tagsoutputXmlHeader
- true to output xml headerpublic final java.lang.String rewriteXml(org.w3c.dom.Node xmlDoc, java.lang.String[] aloneTags)
xmlDoc
- xml file as a dom nodealoneTags
- a string array of empty tags
public final java.lang.String rewriteXml(org.w3c.dom.Node xmlDoc, java.lang.String[] aloneTags, boolean outputXmlHeader)
xmlDoc
- xml file as a dom nodealoneTags
- a string array of empty tagsoutputXmlHeader
- true to output xml header
public final void rewriteXml(java.io.Writer out, org.w3c.dom.Node xmlDoc, java.lang.String[] aloneTags)
out
- the writer to write the xmlxmlDoc
- xml file as a dom nodealoneTags
- a string array of empty tagspublic final void rewriteXml(java.io.Writer out, org.w3c.dom.Node xmlDoc, java.lang.String[] aloneTags, boolean outputXmlHeader)
out
- the writer to write the xmlxmlDoc
- xml file as a dom nodealoneTags
- a string array of empty tagsoutputXmlHeader
- true to output xml headerprivate final void renderXMLRecurs(java.io.PrintWriter out, org.w3c.dom.Node node, java.lang.String[] aloneTags)
out
- the writer to write the xmlnode
- current writed nodealoneTags
- a string array of empty tagsprivate final boolean isAlone(java.lang.String tagName, java.lang.String[] aloneTags)
tagName
- tag name to lookupaloneTags
- a string array of empty tags
public final java.lang.String escapeAttribute(java.lang.String in)
in
- the string to escape
public final java.lang.String escape(java.lang.String in)
in
- the string to escape
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |