org.apache.velocity.tools.generic
Class MarkupTool

java.lang.Object
  extended by org.apache.velocity.tools.generic.SafeConfig
      extended by org.apache.velocity.tools.generic.MarkupTool

@DefaultKey(value="mark")
public class MarkupTool
extends SafeConfig

NOTE: This tools is considered "alpha" quality due to lack of testing and a generally unpolished API. Feel free to use but expect changes. Also, this is not automatically provided via the default tools.xml file.

A tool to make it easy to generate XML or HTML on the fly. It uses a CSS-type syntax with a vaguely jQuery-ish API to help you generate the markup you need.

 Example uses in a template:
   #set( $foospan = $markup.span.id($foo.id).body($foo) )
   $markup.tag('table tr.bar td').body("This is $foospan")

 Output:
   
This is my first foo.
Example tools.xml config: <tools> <toolbox scope="application"> <tool class="org.apache.velocity.tools.generic.alpha.MarkupTool"/> </toolbox> </tools>

Since:
VelocityTools 2.0
Version:
$Id$
Author:
Nathan Bubna

Nested Class Summary
static class MarkupTool.Tag
           
 
Field Summary
static String DEFAULT_DELIMITER
           
static String DEFAULT_TAB
           
 
Fields inherited from class org.apache.velocity.tools.generic.SafeConfig
LOCK_CONFIG_KEY, OLD_LOCK_CONFIG_KEY, SAFE_MODE_KEY
 
Constructor Summary
MarkupTool()
           
 
Method Summary
 MarkupTool.Tag get(String tag)
           
 String getTab()
           
protected  MarkupTool.Tag parse(String definition)
           
 void setTab(String tab)
           
protected  String[] split(String me)
           
 MarkupTool.Tag tag(String definition)
           
 
Methods inherited from class org.apache.velocity.tools.generic.SafeConfig
configure, configure, isConfigLocked, isSafeMode, setLockConfig, setSafeMode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TAB

public static final String DEFAULT_TAB
See Also:
Constant Field Values

DEFAULT_DELIMITER

public static final String DEFAULT_DELIMITER
See Also:
Constant Field Values
Constructor Detail

MarkupTool

public MarkupTool()
Method Detail

setTab

public void setTab(String tab)

getTab

public String getTab()

get

public MarkupTool.Tag get(String tag)

tag

public MarkupTool.Tag tag(String definition)

split

protected String[] split(String me)

parse

protected MarkupTool.Tag parse(String definition)


Copyright © 2002-2011 The Apache Software Foundation. All Rights Reserved.