## 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

Nested Class Summary
`class` `XML.Builder`

Nested classes/interfaces inherited from interface org.codehaus.groovy.grails.web.converters.Converter
`Converter.CircularReferenceBehaviour`

Field Summary
`static org.apache.commons.logging.Log` `log`

Fields inherited from interface org.codehaus.groovy.grails.web.converters.Converter
`DEFAULT_REQUEST_ENCODING`

Constructor Summary
`XML()`
`XML(Object target)`

Method Summary
`XML` `attribute(String name, String value)`
`void` `build(groovy.lang.Closure c)`
`XML` `chars(String chars)`
`void` `convertAnother(Object o)`
`static void` `createNamedConfig(String name, groovy.lang.Closure callable)`
`XML` `end()`
`int` `getDepth()`
`String` `getElementName(Object o)`
`static ConverterConfiguration<XML>` `getNamedConfig(String configName)`
`StreamingMarkupWriter` `getStream()`
`XMLStreamWriter` `getWriter()`
`protected void` `handleCircularRelationship(Object o)`
`protected ConverterConfiguration<XML>` `initConfig()`
`ObjectMarshaller<XML>` `lookupObjectMarshaller(Object target)`
`static Object` `parse(HttpServletRequest request)` Parses the give XML (read from the POST Body of the Request)
`static Object` `parse(InputStream is, String encoding)` Parses the given XML
`static Object` `parse(String source)` Parses the given XML
`static void` `registerObjectMarshaller(Class clazz, groovy.lang.Closure callable)`
`static void` `registerObjectMarshaller(Class clazz, int priority, groovy.lang.Closure callable)`
`static void` `registerObjectMarshaller(ObjectMarshaller<XML> om)`
`static void` `registerObjectMarshaller(ObjectMarshaller<XML> om, int priority)`
`void` `render(HttpServletResponse response)` Marshalls the target and writes it a HttpServletResponse The response will be comitted after this operation
`void` `render(Writer out)` Marshalls the target and writes it to a java.io.Writer
`void` `setTarget(Object target)`
`XML` `startNode(String tagName)`
`String` `toString()` Renders the result to a String and returns it
`static void` `use(String cfgName)`
`static Object` `use(String configName, groovy.lang.Closure callable)`
`static void` `withDefaultConfiguration(groovy.lang.Closure callable)`

Methods inherited from class org.codehaus.groovy.grails.web.converters.AbstractConverter
`createBeanWrapper`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### log

    public static final org.apache.commons.logging.Log log

Constructor Detail

### XML

    public XML()

### XML

    public XML(Object target)

Method Detail

### 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()

  Description copied from class: `AbstractConverter`
  Renders the result to a String and returns it

  Overrides:
    `toString` in class `AbstractConverter<XMLStreamWriter>`
  Returns:
    The converted object as a string

### 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 from
    `encoding` - 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`

Copyright (c) 2005-2009 The Grails project