public class DocumentTemplate
extends java.lang.Object
static final String SYNC_STRING = "<nds><input>" + "<sync src-dn='$src-dn$' qualified-src-dn='$qualified-src-dn$' class-name='$class-name$'>" + "<association>$association$</association>" + "</sync>" + "</input></nds>";Replacement value document:
<nds> <output> <instance class-name='User' src-dn='\\TREE\\novell\\jdoe' qualified-src-dn='O=novell\\CN=jdoe'> <association>1234</association> </instance> </output> </nds>Result string:
"<nds><input>" + "<sync src-dn='\\TREE\\novell\\jdoe' qualified-src-dn='O=novell\\CN=jdoe' class-name='User'>" + "<association>1234</association>" + "</sync>" + "</input></nds>";
Constructor and Description |
---|
DocumentTemplate(java.lang.String template)
Construct a
DocumentTemplate instance from a template String containing
zero or more replacement tokens. |
Modifier and Type | Method and Description |
---|---|
org.w3c.dom.Document |
getMappedDocument(java.util.Map replacementMap)
Get a DOM representation of the template
String with all replacement tokens
replaced. |
org.w3c.dom.Document |
getMappedDocument(org.w3c.dom.Node replacementSource)
Get a DOM representation of the template
String with all replacement tokens
replaced. |
java.lang.String |
getMappedString(java.util.Map replacementMap)
Get the template
String with all replacement tokens replaced. |
java.lang.String |
getMappedString(org.w3c.dom.Node replacementSource)
Get the template
String with all replacement tokens replaced. |
public DocumentTemplate(java.lang.String template)
DocumentTemplate
instance from a template String
containing
zero or more replacement tokens.template
- the template String
public java.lang.String getMappedString(org.w3c.dom.Node replacementSource)
String
with all replacement tokens replaced.replacementSource
- DOM node that is the top of the subtree containing
values for the replacement tokensString
public java.lang.String getMappedString(java.util.Map replacementMap)
String
with all replacement tokens replaced.replacementMap
- mapping between token identifiers and valuesString
public org.w3c.dom.Document getMappedDocument(org.w3c.dom.Node replacementSource)
String
with all replacement tokens
replaced. If the template String
is not a valid, serialized XML document then
the return value will be null
.replacementSource
- DOM node that is the top of the subtree containing
values for the replacement tokensnull
public org.w3c.dom.Document getMappedDocument(java.util.Map replacementMap)
String
with all replacement tokens
replaced. If the template String
is not a valid, serialized XML document then
the return value will be null
.replacementMap
- mapping between token identifiers and valuesnull