grails.converters
Class XML
java.lang.Object
org.codehaus.groovy.grails.web.converters.AbstractConverter<XMLStreamWriter>
grails.converters.XML
- All Implemented Interfaces:
- Converter<XMLStreamWriter>
- Direct Known Subclasses:
- XML
public class XML
- extends AbstractConverter<XMLStreamWriter>
- implements Converter<XMLStreamWriter>
A converter that converts domain classes to XML.
- Author:
- Siegfried Puchbauer, Graeme Rocher
Field Summary |
static org.apache.commons.logging.Log |
log
|
log
public static final org.apache.commons.logging.Log log
XML
public XML()
XML
public XML(Object target)
initConfig
protected ConverterConfiguration<XML> initConfig()
setTarget
public void setTarget(Object target)
- Specified by:
setTarget
in class AbstractConverter<XMLStreamWriter>
render
public void render(Writer out)
throws ConverterException
- Description copied from interface:
Converter
- Marshalls the target and writes it to a java.io.Writer
- Specified by:
render
in interface Converter<XMLStreamWriter>
- Parameters:
out
- The Writer to write to
- Throws:
ConverterException
getElementName
public String getElementName(Object o)
convertAnother
public void convertAnother(Object o)
throws ConverterException
- Specified by:
convertAnother
in interface Converter<XMLStreamWriter>
- Throws:
ConverterException
lookupObjectMarshaller
public ObjectMarshaller<XML> lookupObjectMarshaller(Object target)
- Specified by:
lookupObjectMarshaller
in interface Converter<XMLStreamWriter>
getDepth
public int getDepth()
startNode
public XML startNode(String tagName)
chars
public XML chars(String chars)
attribute
public XML attribute(String name,
String value)
end
public XML end()
handleCircularRelationship
protected void handleCircularRelationship(Object o)
throws ConverterException
- Throws:
ConverterException
render
public void render(HttpServletResponse response)
throws ConverterException
- Description copied from interface:
Converter
- Marshalls the target and writes it a HttpServletResponse
The response will be comitted after this operation
- Specified by:
render
in interface Converter<XMLStreamWriter>
- Parameters:
response
- The response to write to
- Throws:
ConverterException
getWriter
public XMLStreamWriter getWriter()
throws ConverterException
- Specified by:
getWriter
in interface Converter<XMLStreamWriter>
- Throws:
ConverterException
getStream
public StreamingMarkupWriter getStream()
build
public void build(groovy.lang.Closure c)
throws ConverterException
- Specified by:
build
in interface Converter<XMLStreamWriter>
- Throws:
ConverterException
toString
public String toString()
- Overrides:
toString
in class AbstractConverter<XMLStreamWriter>
parse
public static Object parse(String source)
throws ConverterException
- Parses the given XML
- Parameters:
source
- a String containing some XML
- Returns:
- a groovy.util.XmlSlurper
- Throws:
ConverterException
parse
public static Object parse(InputStream is,
String encoding)
throws ConverterException
- Parses the given XML
- Parameters:
is
- an InputStream to read fromencoding
- the Character Encoding to use
- Returns:
- a groovy.util.XmlSlurper
- Throws:
ConverterException
parse
public static Object parse(HttpServletRequest request)
throws ConverterException
- Parses the give XML (read from the POST Body of the Request)
- Parameters:
request
- an HttpServletRequest
- Returns:
- a groovy.util.XmlSlurper
- Throws:
ConverterException
getNamedConfig
public static ConverterConfiguration<XML> getNamedConfig(String configName)
throws ConverterException
- Throws:
ConverterException
use
public static Object use(String configName,
groovy.lang.Closure callable)
throws ConverterException
- Throws:
ConverterException
use
public static void use(String cfgName)
throws ConverterException
- Throws:
ConverterException
registerObjectMarshaller
public static void registerObjectMarshaller(Class<?> clazz,
groovy.lang.Closure callable)
throws ConverterException
- Throws:
ConverterException
registerObjectMarshaller
public static void registerObjectMarshaller(Class<?> clazz,
int priority,
groovy.lang.Closure callable)
throws ConverterException
- Throws:
ConverterException
registerObjectMarshaller
public static void registerObjectMarshaller(ObjectMarshaller<XML> om)
throws ConverterException
- Throws:
ConverterException
registerObjectMarshaller
public static void registerObjectMarshaller(ObjectMarshaller<XML> om,
int priority)
throws ConverterException
- Throws:
ConverterException
createNamedConfig
public static void createNamedConfig(String name,
groovy.lang.Closure callable)
throws ConverterException
- Throws:
ConverterException
withDefaultConfiguration
public static void withDefaultConfiguration(groovy.lang.Closure callable)
throws ConverterException
- Throws:
ConverterException